From 4fcfaf1ec7fd92ae76506a75a1081ed952677339 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Sun, 27 Dec 2015 22:08:14 +1100 Subject: [PATCH 01/41] Added emitter class, started implementing pub-sub pattern (rowsCounter) --- dist/starter.html | 4 +-- dist/tablefilter/style/colsVisibility.css | 4 +-- dist/tablefilter/style/filtersVisibility.css | 4 +-- dist/tablefilter/style/tablefilter.css | 4 +-- .../style/themes/default/default.css | 4 +-- .../style/themes/mytheme/mytheme.css | 4 +-- .../style/themes/skyblue/skyblue.css | 4 +-- dist/tablefilter/tablefilter.js | 12 ++++----- dist/tablefilter/tf-1.js | 8 +++--- package.json | 5 +++- src/emitter.js | 27 +++++++++++++++++++ .../advancedGrid/adapterEzEditTable.js | 6 +++-- src/modules/feature.js | 1 + src/modules/paging.js | 3 +++ src/modules/rowsCounter.js | 19 +++++++++++++ src/tablefilter.js | 23 +++++++++++----- 16 files changed, 99 insertions(+), 33 deletions(-) create mode 100644 src/emitter.js diff --git a/dist/starter.html b/dist/starter.html index 59624d90..d1fbf106 100644 --- a/dist/starter.html +++ b/dist/starter.html @@ -1,10 +1,10 @@ - tablefilter v0.0.21 - Starter + tablefilter v0.1.0 - Starter -

tablefilter v0.0.21

+

tablefilter v0.1.0

diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 0befe62c..2c383992 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.0.21 by Max Guglielmi - * build date: 2015-12-27T03:29:01.000Z + * tablefilter v0.1.0 by Max Guglielmi + * build date: 2015-12-27T10:57:19.453Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 3bd09f60..47128966 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.0.21 by Max Guglielmi - * build date: 2015-12-27T03:29:01.000Z + * tablefilter v0.1.0 by Max Guglielmi + * build date: 2015-12-27T10:57:19.453Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 9f970dd1..c9da3cec 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.0.21 by Max Guglielmi - * build date: 2015-12-27T03:29:01.000Z + * tablefilter v0.1.0 by Max Guglielmi + * build date: 2015-12-27T10:57:19.453Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 6f5165e8..174fef93 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.0.21 by Max Guglielmi - * build date: 2015-12-27T03:29:01.000Z + * tablefilter v0.1.0 by Max Guglielmi + * build date: 2015-12-27T10:57:19.453Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index f93fdd7b..c8e480a4 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.0.21 by Max Guglielmi - * build date: 2015-12-27T03:29:01.000Z + * tablefilter v0.1.0 by Max Guglielmi + * build date: 2015-12-27T10:57:19.453Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index f68a4752..f2461927 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.0.21 by Max Guglielmi - * build date: 2015-12-27T03:29:01.000Z + * tablefilter v0.1.0 by Max Guglielmi + * build date: 2015-12-27T10:57:19.453Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 3348be8f..7be57c87 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,10 @@ /** - * tablefilter v0.0.21 by Max Guglielmi - * build date: 2015-12-27T03:29:00.880Z + * tablefilter v0.1.0 by Max Guglielmi + * build date: 2015-12-27T10:57:19.366Z * MIT License */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(this,function(){return function(t){function e(s){if(i[s])return i[s].exports;var a=i[s]={exports:{},id:s,loaded:!1};return t[s].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var s=window.webpackJsonp;window.webpackJsonp=function(i,l){for(var n,r,o=0,h=[];on;n++)i[n]=arguments[n];if(0!==i.length){if(this.id=null,this.version="0.0.21",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,i.forEach(function(t){var s="undefined"==typeof t?"undefined":a(t);"object"===s&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===s?(e.id=t,e.tbl=u["default"].id(t)):"number"===s?e.startRow=t:"object"===s&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||B.event;if(e){var s=o["default"].keyCode(e);13===s?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,B.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){B.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var s=t||B.event,i=o["default"].keyCode(s);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=B.setInterval(e.bind(this),this.autoFilterDelay)):(B.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,B.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||B.event,s=o["default"].target(e);if(this.activeFilterId=s.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var i=this.extension("advancedGrid"),a=i._ezEditTable;i.cfg.editable&&a.Editable.Remove(),i.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||B.event,s=o["default"].target(e);if(this.activeFilterId=s.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===s.getAttribute("filled")){var i=s.getAttribute("ct");this.Mod.dropdown._build(i)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||B.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||B.event,s=o["default"].target(e);if(this.loadFltOnDemand&&"0"===s.getAttribute("filled")){var i=s.getAttribute("ct");this.Mod.checkList._build(i),this.Mod.checkList.checkListDiv[i].onclick=null,this.Mod.checkList.checkListDiv[i].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,s=this.singleSearchFlt?1:this.nbCells,i=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new x.Store(this)),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new T.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this)),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;s>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),i=n==s-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,i=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new P.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?i:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new I.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=i,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==s-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&this.enforceVisibility(),this.rowsCounter&&(e.rowsCounter=new S.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new O.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new E.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new L.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new M.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new N.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new D.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(i,!0):r.dropdown._build(i,!1,a,l);break;case e.checklist:r.checkList._build(i,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var s=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],i=s.slcIndex,a=s.slcExternal,l=s.slcId,n=s.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),B.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,s=t.length;s>e;e++){var i=t[e];this.ExtRegistry[i.name]||this.loadExtension(i)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var i=t.name,a=t.path,l=void 0;i&&a?l=t.path+i:(i=i.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,i)),s.p=this.basePath,s.e(1,function(s){var a=[s(25)("./"+l)];(function(s){var a=new s["default"](e,t);a.init(),e.ExtRegistry[i]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,s=t.length;s>e;e++){var i=t[e],a=this.ExtRegistry[i.name];a&&(a.destroy(),this.ExtRegistry[i.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var s=0,i=t.length;i>s;s++){var a=t[s],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",s)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){if(this._hasGrid){var t=this.tbl.rows,e=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&e.highlightKeyword.unhighlightAll(),this.markActiveColumns&&this.clearActiveColumns(),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,s=0;e>s;s++){var i=t[s],a=u["default"].id(i);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,s=e.cols,i=[],a=[],l=s.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?i.push(r[h]):i.push(n[h]);return o&&(a.sort(),i.sort()),[a,i]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),s=this.getFiltersByType(this.fltTypeSlc,!0),i=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,s){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(s)),""!==a&&i.highlightKeyword.highlight(s,a,i.highlightKeyword.highlightCssClass)}}function e(t,e,s){var i=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),F=g.test(t),P=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=F&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),i=U>V):D?(U=y["default"].format(t.replace(r,""),O),i=U>=V):A?(U=y["default"].format(t.replace(o,""),O),i=V>=U):B?(U=y["default"].format(t.replace(d,""),O),i=V>U):H?(U=y["default"].format(t.replace(c,""),O),i=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),i=V.toString()==U.toString()):p.test(t)?i=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),i=V.toString()===U.toString()):i=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(s),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[s]?(l=a(e,this.colNbFormat[s]),n=this.colNbFormat[s]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)i=l<=a(t.replace(r,""),n);else if(T)i=l>=a(t.replace(o,""),n);else if(u)i=la(t.replace(d,""),n);else if(R)i=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(P)i=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(F)i=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)i=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");i=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)i=f["default"].isEmpty(e);else if(L)i=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);i=W.test(e)}catch($){i=!1}else i=f["default"].contains(t,e,this.isExactMatch(s),this.caseSensitive);return i}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this);var s=this.tbl.rows,i=this.Mod,a=0;this.validRowsIndex=[],this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.popupFilters&&i.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(F=!1),this.singleSearchFlt&&R[I]&&(P=!0),this.popupFilters&&i.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&P&&(F=!0),F?(this.validateRow(x,!0),this.validRowsIndex.push(x),this.alternateRows&&i.alternateRows.setRowBg(x,this.validRowsIndex.length),this.onRowValidated&&this.onRowValidated.call(null,this,x)):(this.validateRow(x,!1),i.alternateRows&&i.alternateRows.removeRowBg(x),this.hasVisibleRows&&-1!==this.visibleRows.indexOf(x)?this.validRowsIndex.push(x):a++)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.rememberGridValues&&i.store.saveFilterValues(this.fltsValuesCookie),this.paging?(i.paging.startPagingRow=0,i.paging.currentPageNb=1,i.paging.setPagingInfo(this.validRowsIndex)):this.applyProps(),this.onAfterFilter&&this.onAfterFilter.call(null,this)}}},{key:"applyProps",value:function(){var t=this.Mod;this.hasVisibleRows&&this.enforceVisibility(),this.hasExtension("colOps")&&this.extension("colOps").calc(),this.linkedFilters&&this.linkFilters(),this.rowsCounter&&t.rowsCounter.refresh(this.nbVisibleRows),this.popupFilters&&t.popupFilter.closeAll(),this.noResults&&(this.nbVisibleRows>0?t.noResults.hide():t.noResults.show())}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],s=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],i=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]); -for(var n=this.refRow;n0&&(r=-1!=i.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=s?w["default"].removeNbFormat(d,f):d;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,s=this.getFilterElement(t);if(!s)return"";var i=this.getFilterType(t);if(i!==this.fltTypeMulti&&i!==this.fltTypeCheckList)e=s.value;else if(i===this.fltTypeMulti){e="";for(var a=0,l=s.options.length;l>a;a++)s.options[a].selected&&(e=e.concat(s.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else i===this.fltTypeCheckList&&(null!==s.getAttribute("value")?(e=s.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,s=this.fltIds.length;s>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var s=[],i=0,a=this.fltIds.length;a>i;i++){var l=this.getFilterType(i);if(l===f["default"].lower(t)){var n=e?i:this.fltIds[i];s.push(n)}}return s}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,s=this.tbl.rows.length;return t&&(e=0),parseInt(s-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.refRow;in;n++){var o=this.getCellData(l[n]);a[1].push(o)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.getValidRows(!0),a=0;aa;a++){var n=s[a],r=n[1],o=r[t];i.push(o)}return i}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var s=this.tbl.rows[t];if(s&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var i=e?"":"none",a=e?"true":"false";s.style.display=i,this.paging&&s.setAttribute("validRow",a)}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=s.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(i===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(s,"li").length;s.setAttribute("value",""),s.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(s,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function s(){for(var t=this.nbCells,s=this.colWidths,i=u["default"].tag(e,"col"),a=i.length>0,l=a?null:A.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=i[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=s[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var i=void 0;i=void 0===t?"none"!=e.rows[0].style.display?0:1:t,s.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var s=this.visibleRows[t];s<=this.nbRows&&this.validateRow(s,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.linkedFilters&&this.linkFilters(),this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),s=this.getFiltersByType(this.fltTypeCheckList,!0),i=t.concat(e);i=i.concat(s);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=i.length;r>n;n++){var o=u["default"].id(this.fltIds[i[n]]);if(l=this.getFilterValue(i[n]),a!==i[n]||this.paging&&-1!=t.indexOf(i[n])&&a===i[n]||!this.paging&&(-1!=s.indexOf(i[n])||-1!=e.indexOf(i[n]))||l===this.displayAllText){if(-1!=s.indexOf(i[n])?this.Mod.checkList.checkListDiv[i[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=s.indexOf(i[n])?this.Mod.checkList._build(i[n]):this.Mod.dropdown._build(i[n],!0),this.setFilterValue(i[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,s=e.rows,i=this.filtersRowIndex,a=s[i];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=s.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var s=!1,i=e?e:"script",a="script"==i?"src":"href",l=u["default"].tag(A,i),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){s=!0;break}return s}},{key:"import",value:function(t,e,s,i){var a=i?i:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(A,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof s&&s.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),i=arguments;if(i.length>1)for(var a=0;a0){var i=document.cookie,a=i.indexOf(s);if(-1!==a){a+=s.length;var l=i.indexOf(";",a);-1===l&&(l=i.length),e=unescape(i.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var s=this.read(t),i=s.split(e);return i},getValueByIndex:function(t,e,s){s||(s=",");var i=this.valueToArray(t,s);return i[e]}}},function(t,e){"use strict";function s(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var i=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===s(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":s(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===i},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={has:function(t,e,s){for(var i=void 0===s?!1:s,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function i(t){if(void 0===t)return 0;for(var e=void 0,s=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],i=0;i11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var s=this.format(t,e);t=s.getDate()+"/"+(s.getMonth()+1)+"/"+s.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var i=void 0,a=void 0;if("Y"===e.substring(0,1)?(i=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(i=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(i=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),i.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(s(l[2]),i(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(s(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0])}return a}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var s=t;return s="us"===l["default"].lower(e)?+s.replace(/[^\d\.-]/g,""):+s.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var s=0;s0&&i.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",i.style.tableLayout="fixed",this.headTbl.cellPadding=i.cellPadding,this.headTbl.cellSpacing=i.cellSpacing,e.setColWidths(0,this.headTbl),i.style.width="",this.headTbl.style.width=i.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var s=p["default"].target(e),i=s.scrollLeft;t.headTblCont.scrollLeft=i});var F=(s.extensions||[]).filter(function(t){return"sort"===t.name});1===F.length&&(F[0].async_sort=!0,F[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(i,"col").length>0?!0:!1;var P=function(){for(var t=e.nbCells-1;t>=0;t--){var s=u["default"].create("col",["id",e.id+"_col_"+t]);i.insertBefore(s,i.firstChild),s.style.width=e.colWidths[t],this.gridColElms[t]=s}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(i,"col"),S=0;S',e.popUpDivCssClass=i.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(i.on_before_popup_filter_open)?i.on_before_popup_filter_open:null, -e.onAfterPopUpOpen=u["default"].isFn(i.on_after_popup_filter_open)?i.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(i.on_before_popup_filter_close)?i.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(i.on_after_popup_filter_close)?i.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(s,e),r(s,[{key:"onClick",value:function(e){var s=e||t.event,i=s.target.parentNode,a=parseInt(i.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(s),p["default"].stop(s)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,s=0;sC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,s,i,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,s=d["default"].lower(this.slcFillingMethod);if("innerhtml"===s)this.slcInnerHtml+='";else{var i=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(i.style.display="none"),t.appendChild(i),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={ignoreCase:function(t,e){var s=l["default"].lower(t),i=l["default"].lower(e);return i>s?-1:s>i?1:0}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var s=0;s_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var s=this,i=this.tf,a=this.addTChecks(t,e),l=[],n=i.feature("store"),o=n?n.getFilterValues(i.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(i.hasCustomSlcOptions&&-1!=i.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+i.orOperator+" "));for(var u=0;u0?1:0),l=a+i.pagingLength-1<=e.nbVisibleRows?a+i.pagingLength-1:e.nbVisibleRows;s=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else s=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=s,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,s)}}},{key:"destroy",value:function(){this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.initialized=!1)}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s",s.btnPrevPageText=i.btn_prev_page_text||"<",s.btnLastPageText=i.btn_last_page_text||">|",s.btnFirstPageText=i.btn_first_page_text||"|<",s.btnNextPageHtml=i.btn_next_page_html||(t.enableIcons?'':null),s.btnPrevPageHtml=i.btn_prev_page_html||(t.enableIcons?'':null),s.btnFirstPageHtml=i.btn_first_page_html||(t.enableIcons?'':null),s.btnLastPageHtml=i.btn_last_page_html||(t.enableIcons?'':null),s.pageText=i.page_text||" Page ",s.ofText=i.of_text||" of ",s.nbPgSpanCssClass=i.nb_pages_css_class||"nbpg",s.hasPagingBtns=i.paging_btns===!1?!1:!0,s.pageSelectorType=i.page_selector_type||t.fltTypeSlc,s.onBeforeChangePage=c["default"].isFn(i.on_before_change_page)?i.on_before_change_page:null,s.onAfterChangePage=c["default"].isFn(i.on_after_change_page)?i.on_after_change_page:null,s.prfxSlcPages="slcPages_",s.prfxSlcResults="slcResults_",s.prfxSlcResultsTxt="slcResultsTxt_",s.prfxBtnNextSpan="btnNextSpan_",s.prfxBtnPrevSpan="btnPrevSpan_",s.prfxBtnLastSpan="btnLastSpan_",s.prfxBtnFirstSpan="btnFirstSpan_",s.prfxBtnNext="btnNext_",s.prfxBtnPrev="btnPrev_",s.prfxBtnLast="btnLast_",s.prfxBtnFirst="btnFirst_",s.prfxPgSpan="pgspan_",s.prfxPgBeforeSpan="pgbeforespan_",s.prfxPgAfterSpan="pgafterspan_";var a=s.refRow,r=s.nbRows;s.nbPages=Math.ceil((r-a)/s.pagingLength);var o=s;return s.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var s=b["default"].keyCode(e);13===s&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},s}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,s=this.tf,i=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),i.slcPagesChange=function(t){var s=t.target;e.changePage(s.selectedIndex)},this.pageSelectorType===s.fltTypeSlc&&(t=d["default"].create(s.fltTypeSlc,["id",this.prfxSlcPages+s.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",i.slcPagesChange)),this.pageSelectorType===s.fltTypeInp&&(t=d["default"].create(s.fltTypeInp,["id",this.prfxSlcPages+s.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",i._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+s.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+s.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+s.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+s.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",i.next);else{var o=d["default"].create(s.fltTypeInp,["id",this.prfxBtnNext+s.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",i.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",i.prev);else{var h=d["default"].create(s.fltTypeInp,["id",this.prfxBtnPrev+s.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",i.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",i.last);else{var u=d["default"].create(s.fltTypeInp,["id",this.prfxBtnLast+s.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",i.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",i.first);else{var f=d["default"].create(s.fltTypeInp,["id",this.prfxBtnFirst+s.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",i.first),r.appendChild(f)}}this.pagingTgtId||s.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):s.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+s.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+s.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+s.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+s.id),s.rememberGridValues||this.setPagingInfo(),s.fltGrid||(s.validateAllRows(),this.setPagingInfo(s.validRowsIndex)),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"setPagingInfo",value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,s=e.tbl.rows,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=i[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&s&&s.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&s&&s.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,e.applyProps()}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var s=this.evt,i="undefined"==typeof t?"undefined":a(t);if("string"===i)switch(g["default"].lower(t)){case"next":s.next();break;case"previous":s.prev();break;case"last":s.last();break;case"first":s.first();break;default:s.next()}else"number"===i&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,s=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){s.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var i=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);i.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn), -o.btn.parentNode.insertBefore(i,o.btn)):(r.appendChild(n),r.appendChild(i));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,s=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*s,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var i=this.pagingSlc.options.length-1<=s?this.pagingSlc.options.length-1:s;this.pagingSlc.options[i].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,s=e.feature("store").getPageNb(t);""!==s&&this.changePage(s-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var s=e.feature("store").getPageLength(t);""!==s&&(this.resultsPerPageSlc.options[s].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=d["default"].id(this.prfxBtnNextSpan+t.id),s=d["default"].id(this.prfxBtnPrevSpan+t.id),i=d["default"].id(this.prfxBtnLastSpan+t.id),a=d["default"].id(this.prfxBtnFirstSpan+t.id),l=d["default"].id(this.prfxPgBeforeSpan+t.id),n=d["default"].id(this.prfxPgAfterSpan+t.id),r=d["default"].id(this.prfxPgSpan+t.id),o=this.evt;this.pagingSlc&&(this.pageSelectorType===t.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",o.slcPagesChange):this.pageSelectorType===t.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",o._detectKey),d["default"].remove(this.pagingSlc)),e&&(b["default"].remove(e,"click",o.next),d["default"].remove(e)),s&&(b["default"].remove(s,"click",o.prev),d["default"].remove(s)),i&&(b["default"].remove(i,"click",o.last),d["default"].remove(i)),a&&(b["default"].remove(a,"click",o.first),d["default"].remove(a)),l&&d["default"].remove(l),n&&d["default"].remove(n),r&&d["default"].remove(r),this.hasResultsPerPage&&this.removeResultsPerPage(),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s':null),s.prfxResetSpan="resetspan_",s}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var s=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var i=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(i.appendChild(s),this.btnResetHtml){s.innerHTML=this.btnResetHtml;var a=s.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),s.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=s.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',s.instrHtml=i.help_instructions_html||null,s.btnText=i.help_instructions_btn_text||"?",s.btnHtml=i.help_instructions_btn_html||null,s.btnCssClass=i.help_instructions_btn_css_class||"helpBtn",s.contCssClass=i.help_instructions_container_css_class||"helpCont",s.btn=null,s.cont=null,s.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',s.prfxHelpSpan="helpSpan_",s.prfxHelpDiv="helpDiv_",s}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,s=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),i=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(s);var l=this.contTgtId?u["default"].id(this.contTgtId):s;if(this.btnHtml){s.innerHTML=this.btnHtml;var n=s.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(i)}else{l.appendChild(i);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),s.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(i),i.innerHTML=this.instrHtml,this.contTgtId||(i.className=this.contCssClass,f["default"].add(i,"dblclick",function(){t.toggle()}))):(i.innerHTML=this.instrText,i.className=this.contCssClass,f["default"].add(i,"dblclick",function(){t.toggle()})),i.innerHTML+=this.defaultHtml,f["default"].add(i,"click",function(){t.toggle()}),this.cont=i,this.btn=s,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;sn;n++){var r=s?n:e[n];this.setRowBg(r,l),l++}this.initialized=!0}}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var s=this.tf.tbl.rows,i=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(s[t],i%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){if(this.initialized){for(var t=this.tf.refRow;tn;n++)i[n]=arguments[n];if(0!==i.length){if(this.id=null,this.version="0.1.0",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,i.forEach(function(t){var s="undefined"==typeof t?"undefined":a(t);"object"===s&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===s?(e.id=t,e.tbl=u["default"].id(t)):"number"===s?e.startRow=t:"object"===s&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var s=o["default"].keyCode(e);13===s?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var s=t||A.event,i=o["default"].keyCode(s);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,s=o["default"].target(e);if(this.activeFilterId=s.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var i=this.extension("advancedGrid"),a=i._ezEditTable;i.cfg.editable&&a.Editable.Remove(),i.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,s=o["default"].target(e);if(this.activeFilterId=s.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===s.getAttribute("filled")){var i=s.getAttribute("ct");this.Mod.dropdown._build(i)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,s=o["default"].target(e);if(this.loadFltOnDemand&&"0"===s.getAttribute("filled")){var i=s.getAttribute("ct");this.Mod.checkList._build(i),this.Mod.checkList.checkListDiv[i].onclick=null,this.Mod.checkList.checkListDiv[i].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,s=this.singleSearchFlt?1:this.nbCells,i=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this)),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new F.HighlightKeyword(this)),this.popupFilters&&(e.popupFilter||(e.popupFilter=new P.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;s>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),i=n==s-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,i=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?i:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=i,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==s-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&this.enforceVisibility(),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(i,!0):r.dropdown._build(i,!1,a,l);break;case e.checklist:r.checkList._build(i,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var s=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],i=s.slcIndex,a=s.slcExternal,l=s.slcId,n=s.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,s=t.length;s>e;e++){var i=t[e];this.ExtRegistry[i.name]||this.loadExtension(i)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var i=t.name,a=t.path,l=void 0;i&&a?l=t.path+i:(i=i.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,i)),s.p=this.basePath,s.e(1,function(s){var a=[s(26)("./"+l)];(function(s){var a=new s["default"](e,t);a.init(),e.ExtRegistry[i]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,s=t.length;s>e;e++){var i=t[e],a=this.ExtRegistry[i.name];a&&(a.destroy(),this.ExtRegistry[i.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var s=0,i=t.length;i>s;s++){var a=t[s],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",s)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){if(this._hasGrid){var t=this.tbl.rows,e=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&e.highlightKeyword.unhighlightAll(),this.markActiveColumns&&this.clearActiveColumns(),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,s=0;e>s;s++){var i=t[s],a=u["default"].id(i);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,s=e.cols,i=[],a=[],l=s.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?i.push(r[h]):i.push(n[h]);return o&&(a.sort(),i.sort()),[a,i]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),s=this.getFiltersByType(this.fltTypeSlc,!0),i=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,s){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(s)),""!==a&&i.highlightKeyword.highlight(s,a,i.highlightKeyword.highlightCssClass)}}function e(t,e,s){var i=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),F=g.test(t),P=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=F&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),i=U>V):D?(U=y["default"].format(t.replace(r,""),O),i=U>=V):A?(U=y["default"].format(t.replace(o,""),O),i=V>=U):B?(U=y["default"].format(t.replace(d,""),O),i=V>U):H?(U=y["default"].format(t.replace(c,""),O),i=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),i=V.toString()==U.toString()):p.test(t)?i=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),i=V.toString()===U.toString()):i=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(s),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[s]?(l=a(e,this.colNbFormat[s]),n=this.colNbFormat[s]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)i=l<=a(t.replace(r,""),n);else if(T)i=l>=a(t.replace(o,""),n);else if(u)i=la(t.replace(d,""),n);else if(R)i=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(P)i=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(F)i=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)i=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");i=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)i=f["default"].isEmpty(e);else if(L)i=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);i=W.test(e)}catch($){i=!1}else i=f["default"].contains(t,e,this.isExactMatch(s),this.caseSensitive);return i}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var s=this.tbl.rows,i=this.Mod,a=0;this.validRowsIndex=[],this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.popupFilters&&i.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(F=!1),this.singleSearchFlt&&R[I]&&(P=!0),this.popupFilters&&i.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&P&&(F=!0),F?(this.validateRow(x,!0),this.validRowsIndex.push(x),this.alternateRows&&i.alternateRows.setRowBg(x,this.validRowsIndex.length),this.onRowValidated&&this.onRowValidated.call(null,this,x)):(this.validateRow(x,!1),i.alternateRows&&i.alternateRows.removeRowBg(x),this.hasVisibleRows&&-1!==this.visibleRows.indexOf(x)?this.validRowsIndex.push(x):a++)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.rememberGridValues&&i.store.saveFilterValues(this.fltsValuesCookie),this.paging?(i.paging.startPagingRow=0,i.paging.currentPageNb=1,i.paging.setPagingInfo(this.validRowsIndex)):this.applyProps(),this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"applyProps",value:function(){var t=this.Mod;this.hasVisibleRows&&this.enforceVisibility(),this.hasExtension("colOps")&&this.extension("colOps").calc(),this.linkedFilters&&this.linkFilters(),this.popupFilters&&t.popupFilter.closeAll(),this.noResults&&(this.nbVisibleRows>0?t.noResults.hide():t.noResults.show())}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],s=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],i=arguments.length<=3||void 0===arguments[3]?[]:arguments[3]; +if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=i.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=s?w["default"].removeNbFormat(d,f):d;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,s=this.getFilterElement(t);if(!s)return"";var i=this.getFilterType(t);if(i!==this.fltTypeMulti&&i!==this.fltTypeCheckList)e=s.value;else if(i===this.fltTypeMulti){e="";for(var a=0,l=s.options.length;l>a;a++)s.options[a].selected&&(e=e.concat(s.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else i===this.fltTypeCheckList&&(null!==s.getAttribute("value")?(e=s.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,s=this.fltIds.length;s>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var s=[],i=0,a=this.fltIds.length;a>i;i++){var l=this.getFilterType(i);if(l===f["default"].lower(t)){var n=e?i:this.fltIds[i];s.push(n)}}return s}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,s=this.tbl.rows.length;return t&&(e=0),parseInt(s-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.refRow;in;n++){var o=this.getCellData(l[n]);a[1].push(o)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.getValidRows(!0),a=0;aa;a++){var n=s[a],r=n[1],o=r[t];i.push(o)}return i}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var s=this.tbl.rows[t];if(s&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var i=e?"":"none",a=e?"true":"false";s.style.display=i,this.paging&&s.setAttribute("validRow",a)}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=s.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(i===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(s,"li").length;s.setAttribute("value",""),s.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(s,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function s(){for(var t=this.nbCells,s=this.colWidths,i=u["default"].tag(e,"col"),a=i.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=i[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=s[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var i=void 0;i=void 0===t?"none"!=e.rows[0].style.display?0:1:t,s.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var s=this.visibleRows[t];s<=this.nbRows&&this.validateRow(s,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.linkedFilters&&this.linkFilters(),this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),s=this.getFiltersByType(this.fltTypeCheckList,!0),i=t.concat(e);i=i.concat(s);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=i.length;r>n;n++){var o=u["default"].id(this.fltIds[i[n]]);if(l=this.getFilterValue(i[n]),a!==i[n]||this.paging&&-1!=t.indexOf(i[n])&&a===i[n]||!this.paging&&(-1!=s.indexOf(i[n])||-1!=e.indexOf(i[n]))||l===this.displayAllText){if(-1!=s.indexOf(i[n])?this.Mod.checkList.checkListDiv[i[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=s.indexOf(i[n])?this.Mod.checkList._build(i[n]):this.Mod.dropdown._build(i[n],!0),this.setFilterValue(i[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,s=e.rows,i=this.filtersRowIndex,a=s[i];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=s.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var s=!1,i=e?e:"script",a="script"==i?"src":"href",l=u["default"].tag(H,i),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){s=!0;break}return s}},{key:"import",value:function(t,e,s,i){var a=i?i:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof s&&s.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),i=arguments;if(i.length>1)for(var a=0;a0){var i=document.cookie,a=i.indexOf(s);if(-1!==a){a+=s.length;var l=i.indexOf(";",a);-1===l&&(l=i.length),e=unescape(i.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var s=this.read(t),i=s.split(e);return i},getValueByIndex:function(t,e,s){s||(s=",");var i=this.valueToArray(t,s);return i[e]}}},function(t,e){"use strict";function s(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var i=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===s(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":s(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===i},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={has:function(t,e,s){for(var i=void 0===s?!1:s,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function i(t){if(void 0===t)return 0;for(var e=void 0,s=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],i=0;i11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var s=this.format(t,e);t=s.getDate()+"/"+(s.getMonth()+1)+"/"+s.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var i=void 0,a=void 0;if("Y"===e.substring(0,1)?(i=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(i=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(i=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),i.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(s(l[2]),i(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(s(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0])}return a}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var s=t;return s="us"===l["default"].lower(e)?+s.replace(/[^\d\.-]/g,""):+s.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var s=0;s0&&i.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",i.style.tableLayout="fixed",this.headTbl.cellPadding=i.cellPadding,this.headTbl.cellSpacing=i.cellSpacing,e.setColWidths(0,this.headTbl),i.style.width="",this.headTbl.style.width=i.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var s=p["default"].target(e),i=s.scrollLeft;t.headTblCont.scrollLeft=i});var F=(s.extensions||[]).filter(function(t){return"sort"===t.name});1===F.length&&(F[0].async_sort=!0,F[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(i,"col").length>0?!0:!1;var P=function(){for(var t=e.nbCells-1;t>=0;t--){var s=u["default"].create("col",["id",e.id+"_col_"+t]);i.insertBefore(s,i.firstChild),s.style.width=e.colWidths[t],this.gridColElms[t]=s}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(i,"col"),S=0;S',e.popUpDivCssClass=i.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(i.on_before_popup_filter_open)?i.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(i.on_after_popup_filter_open)?i.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(i.on_before_popup_filter_close)?i.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(i.on_after_popup_filter_close)?i.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(s,e),r(s,[{key:"onClick",value:function(e){var s=e||t.event,i=s.target.parentNode,a=parseInt(i.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(s),p["default"].stop(s)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,s=0;sC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,s,i,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,s=d["default"].lower(this.slcFillingMethod);if("innerhtml"===s)this.slcInnerHtml+='";else{var i=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(i.style.display="none"),t.appendChild(i),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={ignoreCase:function(t,e){var s=l["default"].lower(t),i=l["default"].lower(e);return i>s?-1:s>i?1:0}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var s=0;s_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var s=this,i=this.tf,a=this.addTChecks(t,e),l=[],n=i.feature("store"),o=n?n.getFilterValues(i.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(i.hasCustomSlcOptions&&-1!=i.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+i.orOperator+" "));for(var u=0;u0?1:0),l=a+i.pagingLength-1<=e.nbVisibleRows?a+i.pagingLength-1:e.nbVisibleRows;s=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else s=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=s,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,s)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s",s.btnPrevPageText=i.btn_prev_page_text||"<",s.btnLastPageText=i.btn_last_page_text||">|",s.btnFirstPageText=i.btn_first_page_text||"|<",s.btnNextPageHtml=i.btn_next_page_html||(t.enableIcons?'':null),s.btnPrevPageHtml=i.btn_prev_page_html||(t.enableIcons?'':null),s.btnFirstPageHtml=i.btn_first_page_html||(t.enableIcons?'':null),s.btnLastPageHtml=i.btn_last_page_html||(t.enableIcons?'':null),s.pageText=i.page_text||" Page ",s.ofText=i.of_text||" of ",s.nbPgSpanCssClass=i.nb_pages_css_class||"nbpg",s.hasPagingBtns=i.paging_btns===!1?!1:!0,s.pageSelectorType=i.page_selector_type||t.fltTypeSlc,s.onBeforeChangePage=c["default"].isFn(i.on_before_change_page)?i.on_before_change_page:null,s.onAfterChangePage=c["default"].isFn(i.on_after_change_page)?i.on_after_change_page:null,s.prfxSlcPages="slcPages_",s.prfxSlcResults="slcResults_",s.prfxSlcResultsTxt="slcResultsTxt_",s.prfxBtnNextSpan="btnNextSpan_",s.prfxBtnPrevSpan="btnPrevSpan_",s.prfxBtnLastSpan="btnLastSpan_",s.prfxBtnFirstSpan="btnFirstSpan_",s.prfxBtnNext="btnNext_",s.prfxBtnPrev="btnPrev_",s.prfxBtnLast="btnLast_",s.prfxBtnFirst="btnFirst_",s.prfxPgSpan="pgspan_",s.prfxPgBeforeSpan="pgbeforespan_",s.prfxPgAfterSpan="pgafterspan_";var a=s.refRow,r=s.nbRows;s.nbPages=Math.ceil((r-a)/s.pagingLength);var o=s;return s.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var s=b["default"].keyCode(e);13===s&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},s}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,s=this.tf,i=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),i.slcPagesChange=function(t){var s=t.target;e.changePage(s.selectedIndex)},this.pageSelectorType===s.fltTypeSlc&&(t=d["default"].create(s.fltTypeSlc,["id",this.prfxSlcPages+s.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",i.slcPagesChange)),this.pageSelectorType===s.fltTypeInp&&(t=d["default"].create(s.fltTypeInp,["id",this.prfxSlcPages+s.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",i._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+s.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+s.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+s.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+s.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",i.next);else{var o=d["default"].create(s.fltTypeInp,["id",this.prfxBtnNext+s.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",i.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",i.prev);else{var h=d["default"].create(s.fltTypeInp,["id",this.prfxBtnPrev+s.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",i.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",i.last);else{var u=d["default"].create(s.fltTypeInp,["id",this.prfxBtnLast+s.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",i.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",i.first);else{var f=d["default"].create(s.fltTypeInp,["id",this.prfxBtnFirst+s.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",i.first),r.appendChild(f)}}this.pagingTgtId||s.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):s.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+s.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+s.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+s.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+s.id),s.rememberGridValues||this.setPagingInfo(),s.fltGrid||(s.validateAllRows(),this.setPagingInfo(s.validRowsIndex)),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"setPagingInfo",value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,s=e.tbl.rows,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=i[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&s&&s.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&s&&s.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,e.applyProps(),this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var s=this.evt,i="undefined"==typeof t?"undefined":a(t);if("string"===i)switch(g["default"].lower(t)){case"next":s.next();break;case"previous":s.prev();break;case"last":s.last();break;case"first":s.first();break;default:s.next()}else"number"===i&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,s=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){s.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var i=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);i.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(i,o.btn)):(r.appendChild(n),r.appendChild(i));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,s=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*s,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var i=this.pagingSlc.options.length-1<=s?this.pagingSlc.options.length-1:s;this.pagingSlc.options[i].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,s=e.feature("store").getPageNb(t);""!==s&&this.changePage(s-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var s=e.feature("store").getPageLength(t);""!==s&&(this.resultsPerPageSlc.options[s].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=d["default"].id(this.prfxBtnNextSpan+t.id),s=d["default"].id(this.prfxBtnPrevSpan+t.id),i=d["default"].id(this.prfxBtnLastSpan+t.id),a=d["default"].id(this.prfxBtnFirstSpan+t.id),l=d["default"].id(this.prfxPgBeforeSpan+t.id),n=d["default"].id(this.prfxPgAfterSpan+t.id),r=d["default"].id(this.prfxPgSpan+t.id),o=this.evt;this.pagingSlc&&(this.pageSelectorType===t.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",o.slcPagesChange):this.pageSelectorType===t.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",o._detectKey),d["default"].remove(this.pagingSlc)),e&&(b["default"].remove(e,"click",o.next),d["default"].remove(e)),s&&(b["default"].remove(s,"click",o.prev),d["default"].remove(s)),i&&(b["default"].remove(i,"click",o.last),d["default"].remove(i)),a&&(b["default"].remove(a,"click",o.first),d["default"].remove(a)),l&&d["default"].remove(l),n&&d["default"].remove(n),r&&d["default"].remove(r),this.hasResultsPerPage&&this.removeResultsPerPage(),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s':null),s.prfxResetSpan="resetspan_",s}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var s=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var i=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(i.appendChild(s),this.btnResetHtml){s.innerHTML=this.btnResetHtml;var a=s.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),s.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=s.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',s.instrHtml=i.help_instructions_html||null,s.btnText=i.help_instructions_btn_text||"?",s.btnHtml=i.help_instructions_btn_html||null,s.btnCssClass=i.help_instructions_btn_css_class||"helpBtn",s.contCssClass=i.help_instructions_container_css_class||"helpCont",s.btn=null,s.cont=null,s.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',s.prfxHelpSpan="helpSpan_",s.prfxHelpDiv="helpDiv_",s}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,s=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),i=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(s);var l=this.contTgtId?u["default"].id(this.contTgtId):s;if(this.btnHtml){s.innerHTML=this.btnHtml;var n=s.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(i)}else{l.appendChild(i);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),s.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(i),i.innerHTML=this.instrHtml,this.contTgtId||(i.className=this.contCssClass,f["default"].add(i,"dblclick",function(){t.toggle()}))):(i.innerHTML=this.instrText,i.className=this.contCssClass,f["default"].add(i,"dblclick",function(){t.toggle()})),i.innerHTML+=this.defaultHtml,f["default"].add(i,"click",function(){t.toggle()}),this.cont=i,this.btn=s,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;sn;n++){var r=s?n:e[n];this.setRowBg(r,l),l++}this.initialized=!0}}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var s=this.tf.tbl.rows,i=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(s[t],i%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){if(this.initialized){for(var t=this.tf.refRow;t0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),g=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+g?d[l+g]:[u-1]:l-g<=d[0]?d[0]:d[l-g],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var m=l+g;o=m>u-1?d[u-1]:d[m]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-g];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.feature("rowsCounter").refresh(),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var g=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.feature("rowsCounter").refresh(),t.alternateRows&&t.feature("alternateRows").init(),g&&g.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(m){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(26),i=r(s);t["default"]=i["default"]},28:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){}}]),ColOps}();exports["default"]=ColOps},29:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},31:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),g=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+g?d[l+g]:[u-1]:l-g<=d[0]?d[0]:d[l-g],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var m=l+g;o=m>u-1?d[u-1]:d[m]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-g];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var g=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),g&&g.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(m){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/package.json b/package.json index bb1f82c7..c2224e3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tablefilter", - "version": "0.0.21", + "version": "0.1.0", "description": "A Javascript library making HTML tables filterable and a bit more", "license": "MIT", "author": { @@ -24,6 +24,9 @@ "scripts": { "test": "grunt test" }, + "publishConfig": { + "tag": "next" + }, "devDependencies": { "babel-core": "^6.1.2", "babel-loader": "^6.0.1", diff --git a/src/emitter.js b/src/emitter.js new file mode 100644 index 00000000..42d957ea --- /dev/null +++ b/src/emitter.js @@ -0,0 +1,27 @@ +export class Emitter { + constructor() { + this.events = {}; + } + + on(evt, fn) { + this.events[evt] = this.events[evt] || []; + this.events[evt].push(fn); + } + + off(evt, fn) { + if(evt in this.events === false) { + return; + } + + this.events[evt].splice(this.events[evt].indexOf(fn), 1); + } + + emit(evt /*, args...*/) { + if(evt in this.events === false) { + return; + } + for(var i = 0; i < this.events[evt].length; i++) { + this.events[evt][i].apply(this, [].slice.call(arguments, 1)); + } + } +} diff --git a/src/extensions/advancedGrid/adapterEzEditTable.js b/src/extensions/advancedGrid/adapterEzEditTable.js index 98dc8020..a08ed906 100644 --- a/src/extensions/advancedGrid/adapterEzEditTable.js +++ b/src/extensions/advancedGrid/adapterEzEditTable.js @@ -293,7 +293,8 @@ export default class AdapterEzEditTable { cfg.on_added_dom_row = function(){ tf.nbFilterableRows++; if(!tf.paging){ - tf.feature('rowsCounter').refresh(); + tf.emitter.emit('rows-changed', tf, this); + //tf.feature('rowsCounter').refresh(); } else { tf.nbRows++; tf.nbVisibleRows++; @@ -314,7 +315,8 @@ export default class AdapterEzEditTable { cfg.actions['delete'].on_after_submit = function(){ tf.nbFilterableRows--; if(!tf.paging){ - tf.feature('rowsCounter').refresh(); + // tf.feature('rowsCounter').refresh(); + tf.emitter.emit('rows-changed', tf, this); } else { tf.nbRows--; tf.nbVisibleRows--; diff --git a/src/modules/feature.js b/src/modules/feature.js index f7861ce2..b8c9f6fa 100644 --- a/src/modules/feature.js +++ b/src/modules/feature.js @@ -7,6 +7,7 @@ export class Feature { this.feature = feature; this.enabled = tf[feature]; this.config = tf.config(); + this.emitter = tf.emitter; this.initialized = false; } diff --git a/src/modules/paging.js b/src/modules/paging.js index 7bc6ecce..d55fc5ed 100644 --- a/src/modules/paging.js +++ b/src/modules/paging.js @@ -451,6 +451,9 @@ export class Paging extends Feature{ tf.nbVisibleRows = tf.validRowsIndex.length; //re-applies filter behaviours after filtering process tf.applyProps(); + + // broadcast grouping by page + this.emitter.emit('grouped-by-page', tf, this); } /** diff --git a/src/modules/rowsCounter.js b/src/modules/rowsCounter.js index c0dfaaa1..e9c0df17 100644 --- a/src/modules/rowsCounter.js +++ b/src/modules/rowsCounter.js @@ -76,6 +76,13 @@ export class RowsCounter extends Feature{ this.rowsCounterDiv = countDiv; this.rowsCounterSpan = countSpan; + // subscribe to after-filtering event + this.emitter.on('after-filtering', ()=> this.refresh(tf.nbVisibleRows)); + // subscribe to grouped-by-page event + this.emitter.on('grouped-by-page', ()=> this.refresh(tf.nbVisibleRows)); + // subscribe to rows-changed event + this.emitter.on('rows-changed', ()=> this.refresh()); + this.initialized = true; this.refresh(); } @@ -132,6 +139,18 @@ export class RowsCounter extends Feature{ } this.rowsCounterSpan = null; this.rowsCounterDiv = null; + + // unsubscribe to events + this.emitter.off( + 'after-filtering', + ()=> this.refresh(tf.nbVisibleRows) + ); + this.emitter.off( + 'grouped-by-page', + ()=> this.refresh(tf.nbVisibleRows) + ); + this.emitter.off('rows-changed', ()=> this.refresh()); + this.initialized = false; } } diff --git a/src/tablefilter.js b/src/tablefilter.js index dfa3adf9..fa97bb44 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -6,6 +6,7 @@ import Types from './types'; import Arr from './array'; import DateHelper from './date'; import Helpers from './helpers'; +import {Emitter} from './emitter'; // Features import {Store} from './modules/store'; @@ -26,7 +27,7 @@ import {NoResults} from './modules/noResults'; let global = window, doc = global.document; -export class TableFilter{ +export class TableFilter { /** * TableFilter object constructor @@ -54,6 +55,7 @@ export class TableFilter{ // TODO: use for-of with babel plug-in args.forEach((arg)=> { + // for (let arg of args) { let argtype = typeof arg; if(argtype === 'object' && arg && arg.nodeName === 'TABLE'){ this.tbl = arg; @@ -66,6 +68,7 @@ export class TableFilter{ } else if(argtype === 'object'){ this.cfg = arg; } + // } }); if(!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0){ @@ -76,6 +79,8 @@ export class TableFilter{ // configuration object let f = this.cfg; + this.emitter = new Emitter(); + //Start row et cols nb this.refRow = this.startRow === null ? 2 : (this.startRow+1); try{ this.nbCells = this.getCellsNb(this.refRow); } @@ -935,6 +940,8 @@ export class TableFilter{ if(this.onFiltersLoaded){ this.onFiltersLoaded.call(null, this); } + + this.emitter.emit('initialized', this); } /** @@ -1492,6 +1499,7 @@ export class TableFilter{ if(this.onBeforeFilter){ this.onBeforeFilter.call(null, this); } + this.emitter.emit('before-filtering', this); let row = this.tbl.rows, Mod = this.Mod, @@ -1857,7 +1865,9 @@ export class TableFilter{ if(this.rememberGridValues){ Mod.store.saveFilterValues(this.fltsValuesCookie); } + //applies filter props after filtering process + // TODO remove below if statement when custom events in place if(!this.paging){ this.applyProps(); } else { @@ -1867,10 +1877,11 @@ export class TableFilter{ Mod.paging.currentPageNb = 1; Mod.paging.setPagingInfo(this.validRowsIndex); } - //invokes onafter callback + //invokes onafterfilter callback if(this.onAfterFilter){ - this.onAfterFilter.call(null,this); + this.onAfterFilter.call(null, this); } + this.emitter.emit('after-filtering', this); } /** @@ -1895,9 +1906,9 @@ export class TableFilter{ this.linkFilters(); } - if(this.rowsCounter){ - Mod.rowsCounter.refresh(this.nbVisibleRows); - } + // if(this.rowsCounter){ + // Mod.rowsCounter.refresh(this.nbVisibleRows); + // } if(this.popupFilters){ Mod.popupFilter.closeAll(); From b20e9899b1e1f0458bddb77ac59e96993be4f03a Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Mon, 28 Dec 2015 11:18:55 +1100 Subject: [PATCH 02/41] Added unit tests for emiitter --- dist/starter.html | 514 ------------------ dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 4 +- dist/tablefilter/tf-1.js | 2 +- src/emitter.js | 6 +- test/test-alternate-rows.js | 1 + test/test-clear-button.js | 6 +- test/test-emitter.html | 78 +++ test/test-emitter.js | 55 ++ test/test-help.js | 1 + test/test-no-results-message.js | 2 + test/test-paging.js | 1 + test/test-popup-filter.js | 2 + test/test-rows-counter.js | 2 + test/test-status-bar.js | 2 + 20 files changed, 159 insertions(+), 529 deletions(-) delete mode 100644 dist/starter.html create mode 100644 test/test-emitter.html create mode 100644 test/test-emitter.js diff --git a/dist/starter.html b/dist/starter.html deleted file mode 100644 index d1fbf106..00000000 --- a/dist/starter.html +++ /dev/null @@ -1,514 +0,0 @@ - - - - tablefilter v0.1.0 - Starter - - -

tablefilter v0.1.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
countryisoyearPOPXRATPPPcgdpccci
BeninBEN19985950.33589.9517822190.951178.4690.987.55
BeninBEN19996109.53615.6990967200.191174.9092.617.86
BeninBEN20006272.00711.9763184200.611224.7492.278.25
Burkina FasoBFA19949755.03555.2047119125.76838.7679.816.57
Burkina FasoBFA19959988.00499.148407136.65860.8980.419.29
Burkina FasoBFA199610225.00511.5523987144.18881.1180.4012.12
Burkina FasoBFA199710473.53583.6693726141.78899.0176.9414.94
RussiaRUS1998146899.019.7050828932.647086.3967.739.20
RussiaRUS1999146308.9924.61993984.038074.7057.358.81
RussiaRUS2000145555.0128.129169464.859995.9154.748.79
RwandaRWA19946230.00194.51750.39529.48132.164.48
RwandaRWA19956400.00262.197509870.67746.3492.773.08
RwandaRWA19966727.00306.820007377.90823.2589.713.21
RwandaRWA19977895.18301.529785284.13847.7991.443.72
RwandaRWA19988105.00312.314086985.32914.2289.344.22
El SalvadorSLV19955669.008.7545833593.544143.5989.3110.35
El SalvadorSLV19965798.008.7550001143.694235.7988.777.79
El SalvadorSLV19975911.008.7562503813.744408.4187.057.90
Slovak RepublicSVK20005401.0046.035213.0212618.5352.2224.78
SloveniaSVN19941988.90128.808593879.9711662.1253.2119.87
SloveniaSVN19951990.00118.518501389.0312574.9654.4623.11
SloveniaSVN19961991.00135.364303697.2713151.5154.3223.23
SloveniaSVN19971985.96159.6882935103.9614143.0253.2424.14
SloveniaSVN19981982.60166.134201108.9315067.3452.8225.35
ZambiaZMB19948740.72669.3706055307.48834.1975.439.86
ZambiaZMB19958980.00864.1192017402.40829.3776.5510.31
ZambiaZMB19969214.401207.900024515.01838.0578.7410.99
ZambiaZMB19979443.211314.498047596.97851.4777.5912.15
ZambiaZMB19989665.711862.06897744.91800.6985.1213.75
ZambiaZMB19999881.212388.019043941.87765.2491.8215.30
ZambiaZMB200010089.003110.8439941157.63840.9786.3315.38
ZimbabweZWE199410775.358.1515388492.012586.8460.1018.53
ZimbabweZWE199511011.008.665375712.152603.3766.8915.03
ZimbabweZWE199611242.1610.002349852.642860.2372.0611.32
ZimbabweZWE199711923.5212.111289983.172727.0682.8211.01
ZimbabweZWE199812153.8523.679109574.062799.8577.6610.75
ZimbabweZWE199912388.3238.301200876.122770.4876.8910.73
ZimbabweZWE200012627.0044.417919169.482607.0369.238.62
- - - - - - -

-
-
-
-
-
-
-
-
-
diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index 2c383992..4e442dd0 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-27T10:57:19.453Z 
+ *	 build date: 2015-12-28T00:17:35.892Z 
  *	 MIT License  
  */ 
 span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
\ No newline at end of file
diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css
index 47128966..a59ec73a 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-27T10:57:19.453Z 
+ *	 build date: 2015-12-28T00:17:35.892Z 
  *	 MIT License  
  */ 
 span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
\ No newline at end of file
diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css
index c9da3cec..1d32167a 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-27T10:57:19.453Z 
+ *	 build date: 2015-12-28T00:17:35.892Z 
  *	 MIT License  
  */ 
 .activeHeader{background-color:#66afe9 !important;color:#fff !important}
diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css
index 174fef93..f0e0365f 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-27T10:57:19.453Z 
+ *	 build date: 2015-12-28T00:17:35.892Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css
index c8e480a4..9454e65a 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-27T10:57:19.453Z 
+ *	 build date: 2015-12-28T00:17:35.892Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css
index f2461927..1ae35fe4 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-27T10:57:19.453Z 
+ *	 build date: 2015-12-28T00:17:35.892Z 
  *	 MIT License  
  */ 
 table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
index 7be57c87..e4438711 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -1,10 +1,10 @@
 /** 
  *	 tablefilter v0.1.0 by Max Guglielmi
- *	 build date: 2015-12-27T10:57:19.366Z 
+ *	 build date: 2015-12-28T00:17:35.798Z 
  *	 MIT License  
  */ 
 
 !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(this,function(){return function(t){function e(s){if(i[s])return i[s].exports;var a=i[s]={exports:{},id:s,loaded:!1};return t[s].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var s=window.webpackJsonp;window.webpackJsonp=function(i,l){for(var n,r,o=0,h=[];on;n++)i[n]=arguments[n];if(0!==i.length){if(this.id=null,this.version="0.1.0",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,i.forEach(function(t){var s="undefined"==typeof t?"undefined":a(t);"object"===s&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===s?(e.id=t,e.tbl=u["default"].id(t)):"number"===s?e.startRow=t:"object"===s&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var s=o["default"].keyCode(e);13===s?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var s=t||A.event,i=o["default"].keyCode(s);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,s=o["default"].target(e);if(this.activeFilterId=s.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var i=this.extension("advancedGrid"),a=i._ezEditTable;i.cfg.editable&&a.Editable.Remove(),i.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,s=o["default"].target(e);if(this.activeFilterId=s.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===s.getAttribute("filled")){var i=s.getAttribute("ct");this.Mod.dropdown._build(i)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,s=o["default"].target(e);if(this.loadFltOnDemand&&"0"===s.getAttribute("filled")){var i=s.getAttribute("ct");this.Mod.checkList._build(i),this.Mod.checkList.checkListDiv[i].onclick=null,this.Mod.checkList.checkListDiv[i].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,s=this.singleSearchFlt?1:this.nbCells,i=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this)),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new F.HighlightKeyword(this)),this.popupFilters&&(e.popupFilter||(e.popupFilter=new P.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;s>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),i=n==s-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,i=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?i:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=i,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==s-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&this.enforceVisibility(),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(i,!0):r.dropdown._build(i,!1,a,l);break;case e.checklist:r.checkList._build(i,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var s=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],i=s.slcIndex,a=s.slcExternal,l=s.slcId,n=s.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,s=t.length;s>e;e++){var i=t[e];this.ExtRegistry[i.name]||this.loadExtension(i)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var i=t.name,a=t.path,l=void 0;i&&a?l=t.path+i:(i=i.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,i)),s.p=this.basePath,s.e(1,function(s){var a=[s(26)("./"+l)];(function(s){var a=new s["default"](e,t);a.init(),e.ExtRegistry[i]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,s=t.length;s>e;e++){var i=t[e],a=this.ExtRegistry[i.name];a&&(a.destroy(),this.ExtRegistry[i.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var s=0,i=t.length;i>s;s++){var a=t[s],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",s)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){if(this._hasGrid){var t=this.tbl.rows,e=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&e.highlightKeyword.unhighlightAll(),this.markActiveColumns&&this.clearActiveColumns(),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,s=0;e>s;s++){var i=t[s],a=u["default"].id(i);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,s=e.cols,i=[],a=[],l=s.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?i.push(r[h]):i.push(n[h]);return o&&(a.sort(),i.sort()),[a,i]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),s=this.getFiltersByType(this.fltTypeSlc,!0),i=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,s){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(s)),""!==a&&i.highlightKeyword.highlight(s,a,i.highlightKeyword.highlightCssClass)}}function e(t,e,s){var i=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),F=g.test(t),P=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=F&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),i=U>V):D?(U=y["default"].format(t.replace(r,""),O),i=U>=V):A?(U=y["default"].format(t.replace(o,""),O),i=V>=U):B?(U=y["default"].format(t.replace(d,""),O),i=V>U):H?(U=y["default"].format(t.replace(c,""),O),i=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),i=V.toString()==U.toString()):p.test(t)?i=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),i=V.toString()===U.toString()):i=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(s),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[s]?(l=a(e,this.colNbFormat[s]),n=this.colNbFormat[s]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)i=l<=a(t.replace(r,""),n);else if(T)i=l>=a(t.replace(o,""),n);else if(u)i=la(t.replace(d,""),n);else if(R)i=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(P)i=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(F)i=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)i=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");i=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)i=f["default"].isEmpty(e);else if(L)i=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);i=W.test(e)}catch($){i=!1}else i=f["default"].contains(t,e,this.isExactMatch(s),this.caseSensitive);return i}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var s=this.tbl.rows,i=this.Mod,a=0;this.validRowsIndex=[],this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.popupFilters&&i.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(F=!1),this.singleSearchFlt&&R[I]&&(P=!0),this.popupFilters&&i.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&P&&(F=!0),F?(this.validateRow(x,!0),this.validRowsIndex.push(x),this.alternateRows&&i.alternateRows.setRowBg(x,this.validRowsIndex.length),this.onRowValidated&&this.onRowValidated.call(null,this,x)):(this.validateRow(x,!1),i.alternateRows&&i.alternateRows.removeRowBg(x),this.hasVisibleRows&&-1!==this.visibleRows.indexOf(x)?this.validRowsIndex.push(x):a++)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.rememberGridValues&&i.store.saveFilterValues(this.fltsValuesCookie),this.paging?(i.paging.startPagingRow=0,i.paging.currentPageNb=1,i.paging.setPagingInfo(this.validRowsIndex)):this.applyProps(),this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"applyProps",value:function(){var t=this.Mod;this.hasVisibleRows&&this.enforceVisibility(),this.hasExtension("colOps")&&this.extension("colOps").calc(),this.linkedFilters&&this.linkFilters(),this.popupFilters&&t.popupFilter.closeAll(),this.noResults&&(this.nbVisibleRows>0?t.noResults.hide():t.noResults.show())}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],s=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],i=arguments.length<=3||void 0===arguments[3]?[]:arguments[3]; -if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=i.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=s?w["default"].removeNbFormat(d,f):d;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,s=this.getFilterElement(t);if(!s)return"";var i=this.getFilterType(t);if(i!==this.fltTypeMulti&&i!==this.fltTypeCheckList)e=s.value;else if(i===this.fltTypeMulti){e="";for(var a=0,l=s.options.length;l>a;a++)s.options[a].selected&&(e=e.concat(s.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else i===this.fltTypeCheckList&&(null!==s.getAttribute("value")?(e=s.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,s=this.fltIds.length;s>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var s=[],i=0,a=this.fltIds.length;a>i;i++){var l=this.getFilterType(i);if(l===f["default"].lower(t)){var n=e?i:this.fltIds[i];s.push(n)}}return s}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,s=this.tbl.rows.length;return t&&(e=0),parseInt(s-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.refRow;in;n++){var o=this.getCellData(l[n]);a[1].push(o)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.getValidRows(!0),a=0;aa;a++){var n=s[a],r=n[1],o=r[t];i.push(o)}return i}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var s=this.tbl.rows[t];if(s&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var i=e?"":"none",a=e?"true":"false";s.style.display=i,this.paging&&s.setAttribute("validRow",a)}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=s.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(i===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(s,"li").length;s.setAttribute("value",""),s.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(s,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function s(){for(var t=this.nbCells,s=this.colWidths,i=u["default"].tag(e,"col"),a=i.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=i[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=s[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var i=void 0;i=void 0===t?"none"!=e.rows[0].style.display?0:1:t,s.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var s=this.visibleRows[t];s<=this.nbRows&&this.validateRow(s,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.linkedFilters&&this.linkFilters(),this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),s=this.getFiltersByType(this.fltTypeCheckList,!0),i=t.concat(e);i=i.concat(s);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=i.length;r>n;n++){var o=u["default"].id(this.fltIds[i[n]]);if(l=this.getFilterValue(i[n]),a!==i[n]||this.paging&&-1!=t.indexOf(i[n])&&a===i[n]||!this.paging&&(-1!=s.indexOf(i[n])||-1!=e.indexOf(i[n]))||l===this.displayAllText){if(-1!=s.indexOf(i[n])?this.Mod.checkList.checkListDiv[i[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=s.indexOf(i[n])?this.Mod.checkList._build(i[n]):this.Mod.dropdown._build(i[n],!0),this.setFilterValue(i[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,s=e.rows,i=this.filtersRowIndex,a=s[i];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=s.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var s=!1,i=e?e:"script",a="script"==i?"src":"href",l=u["default"].tag(H,i),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){s=!0;break}return s}},{key:"import",value:function(t,e,s,i){var a=i?i:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof s&&s.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),i=arguments;if(i.length>1)for(var a=0;a0){var i=document.cookie,a=i.indexOf(s);if(-1!==a){a+=s.length;var l=i.indexOf(";",a);-1===l&&(l=i.length),e=unescape(i.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var s=this.read(t),i=s.split(e);return i},getValueByIndex:function(t,e,s){s||(s=",");var i=this.valueToArray(t,s);return i[e]}}},function(t,e){"use strict";function s(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var i=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===s(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":s(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===i},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={has:function(t,e,s){for(var i=void 0===s?!1:s,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function i(t){if(void 0===t)return 0;for(var e=void 0,s=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],i=0;i11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var s=this.format(t,e);t=s.getDate()+"/"+(s.getMonth()+1)+"/"+s.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var i=void 0,a=void 0;if("Y"===e.substring(0,1)?(i=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(i=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(i=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),i.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(s(l[2]),i(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(s(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0])}return a}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var s=t;return s="us"===l["default"].lower(e)?+s.replace(/[^\d\.-]/g,""):+s.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var s=0;s0&&i.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",i.style.tableLayout="fixed",this.headTbl.cellPadding=i.cellPadding,this.headTbl.cellSpacing=i.cellSpacing,e.setColWidths(0,this.headTbl),i.style.width="",this.headTbl.style.width=i.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var s=p["default"].target(e),i=s.scrollLeft;t.headTblCont.scrollLeft=i});var F=(s.extensions||[]).filter(function(t){return"sort"===t.name});1===F.length&&(F[0].async_sort=!0,F[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(i,"col").length>0?!0:!1;var P=function(){for(var t=e.nbCells-1;t>=0;t--){var s=u["default"].create("col",["id",e.id+"_col_"+t]);i.insertBefore(s,i.firstChild),s.style.width=e.colWidths[t],this.gridColElms[t]=s}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(i,"col"),S=0;S0&&(r=-1!=i.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=s?w["default"].removeNbFormat(d,f):d;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,s=this.getFilterElement(t);if(!s)return"";var i=this.getFilterType(t);if(i!==this.fltTypeMulti&&i!==this.fltTypeCheckList)e=s.value;else if(i===this.fltTypeMulti){e="";for(var a=0,l=s.options.length;l>a;a++)s.options[a].selected&&(e=e.concat(s.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else i===this.fltTypeCheckList&&(null!==s.getAttribute("value")?(e=s.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,s=this.fltIds.length;s>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var s=[],i=0,a=this.fltIds.length;a>i;i++){var l=this.getFilterType(i);if(l===f["default"].lower(t)){var n=e?i:this.fltIds[i];s.push(n)}}return s}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,s=this.tbl.rows.length;return t&&(e=0),parseInt(s-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.refRow;in;n++){var o=this.getCellData(l[n]);a[1].push(o)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.getValidRows(!0),a=0;aa;a++){var n=s[a],r=n[1],o=r[t];i.push(o)}return i}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var s=this.tbl.rows[t];if(s&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var i=e?"":"none",a=e?"true":"false";s.style.display=i,this.paging&&s.setAttribute("validRow",a)}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=s.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(i===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(s,"li").length;s.setAttribute("value",""),s.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(s,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function s(){for(var t=this.nbCells,s=this.colWidths,i=u["default"].tag(e,"col"),a=i.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=i[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=s[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var i=void 0;i=void 0===t?"none"!=e.rows[0].style.display?0:1:t,s.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var s=this.visibleRows[t];s<=this.nbRows&&this.validateRow(s,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.linkedFilters&&this.linkFilters(),this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),s=this.getFiltersByType(this.fltTypeCheckList,!0),i=t.concat(e);i=i.concat(s);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=i.length;r>n;n++){var o=u["default"].id(this.fltIds[i[n]]);if(l=this.getFilterValue(i[n]),a!==i[n]||this.paging&&-1!=t.indexOf(i[n])&&a===i[n]||!this.paging&&(-1!=s.indexOf(i[n])||-1!=e.indexOf(i[n]))||l===this.displayAllText){if(-1!=s.indexOf(i[n])?this.Mod.checkList.checkListDiv[i[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=s.indexOf(i[n])?this.Mod.checkList._build(i[n]):this.Mod.dropdown._build(i[n],!0),this.setFilterValue(i[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,s=e.rows,i=this.filtersRowIndex,a=s[i];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=s.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var s=!1,i=e?e:"script",a="script"==i?"src":"href",l=u["default"].tag(H,i),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){s=!0;break}return s}},{key:"import",value:function(t,e,s,i){var a=i?i:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof s&&s.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),i=arguments;if(i.length>1)for(var a=0;a0){var i=document.cookie,a=i.indexOf(s);if(-1!==a){a+=s.length;var l=i.indexOf(";",a);-1===l&&(l=i.length),e=unescape(i.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var s=this.read(t),i=s.split(e);return i},getValueByIndex:function(t,e,s){s||(s=",");var i=this.valueToArray(t,s);return i[e]}}},function(t,e){"use strict";function s(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var i=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===s(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":s(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===i},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={has:function(t,e,s){for(var i=void 0===s?!1:s,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function i(t){if(void 0===t)return 0;for(var e=void 0,s=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],i=0;i11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var s=this.format(t,e);t=s.getDate()+"/"+(s.getMonth()+1)+"/"+s.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var i=void 0,a=void 0;if("Y"===e.substring(0,1)?(i=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(i=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(i=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),i.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(s(l[2]),i(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(s(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0])}return a}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var s=t;return s="us"===l["default"].lower(e)?+s.replace(/[^\d\.-]/g,""):+s.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var s=0;s0&&i.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",i.style.tableLayout="fixed",this.headTbl.cellPadding=i.cellPadding,this.headTbl.cellSpacing=i.cellSpacing,e.setColWidths(0,this.headTbl),i.style.width="",this.headTbl.style.width=i.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var s=p["default"].target(e),i=s.scrollLeft;t.headTblCont.scrollLeft=i});var F=(s.extensions||[]).filter(function(t){return"sort"===t.name});1===F.length&&(F[0].async_sort=!0,F[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(i,"col").length>0?!0:!1;var P=function(){for(var t=e.nbCells-1;t>=0;t--){var s=u["default"].create("col",["id",e.id+"_col_"+t]);i.insertBefore(s,i.firstChild),s.style.width=e.colWidths[t],this.gridColElms[t]=s}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(i,"col"),S=0;S',e.popUpDivCssClass=i.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(i.on_before_popup_filter_open)?i.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(i.on_after_popup_filter_open)?i.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(i.on_before_popup_filter_close)?i.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(i.on_after_popup_filter_close)?i.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(s,e),r(s,[{key:"onClick",value:function(e){var s=e||t.event,i=s.target.parentNode,a=parseInt(i.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(s),p["default"].stop(s)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,s=0;sC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,s,i,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,s=d["default"].lower(this.slcFillingMethod);if("innerhtml"===s)this.slcInnerHtml+='";else{var i=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(i.style.display="none"),t.appendChild(i),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={ignoreCase:function(t,e){var s=l["default"].lower(t),i=l["default"].lower(e);return i>s?-1:s>i?1:0}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var s=0;s_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var s=this,i=this.tf,a=this.addTChecks(t,e),l=[],n=i.feature("store"),o=n?n.getFilterValues(i.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(i.hasCustomSlcOptions&&-1!=i.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+i.orOperator+" "));for(var u=0;u0?1:0),l=a+i.pagingLength-1<=e.nbVisibleRows?a+i.pagingLength-1:e.nbVisibleRows;s=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else s=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=s,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,s)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s",s.btnPrevPageText=i.btn_prev_page_text||"<",s.btnLastPageText=i.btn_last_page_text||">|",s.btnFirstPageText=i.btn_first_page_text||"|<",s.btnNextPageHtml=i.btn_next_page_html||(t.enableIcons?'':null),s.btnPrevPageHtml=i.btn_prev_page_html||(t.enableIcons?'':null),s.btnFirstPageHtml=i.btn_first_page_html||(t.enableIcons?'':null),s.btnLastPageHtml=i.btn_last_page_html||(t.enableIcons?'':null),s.pageText=i.page_text||" Page ",s.ofText=i.of_text||" of ",s.nbPgSpanCssClass=i.nb_pages_css_class||"nbpg",s.hasPagingBtns=i.paging_btns===!1?!1:!0,s.pageSelectorType=i.page_selector_type||t.fltTypeSlc,s.onBeforeChangePage=c["default"].isFn(i.on_before_change_page)?i.on_before_change_page:null,s.onAfterChangePage=c["default"].isFn(i.on_after_change_page)?i.on_after_change_page:null,s.prfxSlcPages="slcPages_",s.prfxSlcResults="slcResults_",s.prfxSlcResultsTxt="slcResultsTxt_",s.prfxBtnNextSpan="btnNextSpan_",s.prfxBtnPrevSpan="btnPrevSpan_",s.prfxBtnLastSpan="btnLastSpan_",s.prfxBtnFirstSpan="btnFirstSpan_",s.prfxBtnNext="btnNext_",s.prfxBtnPrev="btnPrev_",s.prfxBtnLast="btnLast_",s.prfxBtnFirst="btnFirst_",s.prfxPgSpan="pgspan_",s.prfxPgBeforeSpan="pgbeforespan_",s.prfxPgAfterSpan="pgafterspan_";var a=s.refRow,r=s.nbRows;s.nbPages=Math.ceil((r-a)/s.pagingLength);var o=s;return s.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var s=b["default"].keyCode(e);13===s&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},s}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,s=this.tf,i=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),i.slcPagesChange=function(t){var s=t.target;e.changePage(s.selectedIndex)},this.pageSelectorType===s.fltTypeSlc&&(t=d["default"].create(s.fltTypeSlc,["id",this.prfxSlcPages+s.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",i.slcPagesChange)),this.pageSelectorType===s.fltTypeInp&&(t=d["default"].create(s.fltTypeInp,["id",this.prfxSlcPages+s.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",i._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+s.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+s.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+s.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+s.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",i.next);else{var o=d["default"].create(s.fltTypeInp,["id",this.prfxBtnNext+s.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",i.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",i.prev);else{var h=d["default"].create(s.fltTypeInp,["id",this.prfxBtnPrev+s.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",i.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",i.last);else{var u=d["default"].create(s.fltTypeInp,["id",this.prfxBtnLast+s.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",i.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",i.first);else{var f=d["default"].create(s.fltTypeInp,["id",this.prfxBtnFirst+s.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",i.first),r.appendChild(f)}}this.pagingTgtId||s.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):s.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+s.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+s.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+s.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+s.id),s.rememberGridValues||this.setPagingInfo(),s.fltGrid||(s.validateAllRows(),this.setPagingInfo(s.validRowsIndex)),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"setPagingInfo",value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,s=e.tbl.rows,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=i[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&s&&s.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&s&&s.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,e.applyProps(),this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var s=this.evt,i="undefined"==typeof t?"undefined":a(t);if("string"===i)switch(g["default"].lower(t)){case"next":s.next();break;case"previous":s.prev();break;case"last":s.last();break;case"first":s.first();break;default:s.next()}else"number"===i&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,s=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){s.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var i=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);i.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(i,o.btn)):(r.appendChild(n),r.appendChild(i));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,s=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*s,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var i=this.pagingSlc.options.length-1<=s?this.pagingSlc.options.length-1:s;this.pagingSlc.options[i].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,s=e.feature("store").getPageNb(t);""!==s&&this.changePage(s-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var s=e.feature("store").getPageLength(t);""!==s&&(this.resultsPerPageSlc.options[s].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=d["default"].id(this.prfxBtnNextSpan+t.id),s=d["default"].id(this.prfxBtnPrevSpan+t.id),i=d["default"].id(this.prfxBtnLastSpan+t.id),a=d["default"].id(this.prfxBtnFirstSpan+t.id),l=d["default"].id(this.prfxPgBeforeSpan+t.id),n=d["default"].id(this.prfxPgAfterSpan+t.id),r=d["default"].id(this.prfxPgSpan+t.id),o=this.evt;this.pagingSlc&&(this.pageSelectorType===t.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",o.slcPagesChange):this.pageSelectorType===t.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",o._detectKey),d["default"].remove(this.pagingSlc)),e&&(b["default"].remove(e,"click",o.next),d["default"].remove(e)),s&&(b["default"].remove(s,"click",o.prev),d["default"].remove(s)),i&&(b["default"].remove(i,"click",o.last),d["default"].remove(i)),a&&(b["default"].remove(a,"click",o.first),d["default"].remove(a)),l&&d["default"].remove(l),n&&d["default"].remove(n),r&&d["default"].remove(r),this.hasResultsPerPage&&this.removeResultsPerPage(),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s':null),s.prfxResetSpan="resetspan_",s}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var s=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var i=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(i.appendChild(s),this.btnResetHtml){s.innerHTML=this.btnResetHtml;var a=s.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),s.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=s.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',s.instrHtml=i.help_instructions_html||null,s.btnText=i.help_instructions_btn_text||"?",s.btnHtml=i.help_instructions_btn_html||null,s.btnCssClass=i.help_instructions_btn_css_class||"helpBtn",s.contCssClass=i.help_instructions_container_css_class||"helpCont",s.btn=null,s.cont=null,s.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',s.prfxHelpSpan="helpSpan_",s.prfxHelpDiv="helpDiv_",s}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,s=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),i=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(s);var l=this.contTgtId?u["default"].id(this.contTgtId):s;if(this.btnHtml){s.innerHTML=this.btnHtml;var n=s.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(i)}else{l.appendChild(i);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),s.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(i),i.innerHTML=this.instrHtml,this.contTgtId||(i.className=this.contCssClass,f["default"].add(i,"dblclick",function(){t.toggle()}))):(i.innerHTML=this.instrText,i.className=this.contCssClass,f["default"].add(i,"dblclick",function(){t.toggle()})),i.innerHTML+=this.defaultHtml,f["default"].add(i,"click",function(){t.toggle()}),this.cont=i,this.btn=s,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;sn;n++){var r=s?n:e[n];this.setRowBg(r,l),l++}this.initialized=!0}}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var s=this.tf.tbl.rows,i=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(s[t],i%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){if(this.initialized){for(var t=this.tf.refRow;t + + + + TableFilter event emitter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FromDestinationRoad Distance (km)By Air (hrs)By Rail (hrs)
SydneyAdelaide14121.425.3
SydneyBrisbane9821.516
SydneyCanberra286.64.3
SydneyMelbourne8721.110.5
AdelaidePerth27813.138
AdelaideAlice Springs1533220.25
AdelaideBrisbane20452.1540
+ + + + +
+
+ + \ No newline at end of file diff --git a/test/test-emitter.js b/test/test-emitter.js new file mode 100644 index 00000000..b3c4f9ce --- /dev/null +++ b/test/test-emitter.js @@ -0,0 +1,55 @@ + +var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/' +}); +tf.init(); + +module('Sanity checks'); +test('Emitter instance', function() { + deepEqual(typeof tf.emitter, 'object', 'Emitter instanciated'); + deepEqual(typeof tf.emitter.events, 'object', 'Emitter events property'); + deepEqual(typeof tf.emitter.on, 'function', 'Emitter on method'); + deepEqual(typeof tf.emitter.off, 'function', 'Emitter off method'); + deepEqual(typeof tf.emitter.emit, 'function', 'Emitter emit method'); +}); + +module('Behaviour'); +test('Can subscribe', function(){ + var emitter = tf.emitter; + var output = null; + emitter.on('before-filtering', function(){ output = 'before-filtering'; }); + + tf.filter(); + + deepEqual(emitter.events['before-filtering'].length, 1, + 'Expected number of listeners'); + deepEqual(output, 'before-filtering', 'Expected output'); +}); + +test('Can unsubscribe', function(){ + var emitter = tf.emitter; + var output = null; + emitter.off('before-filtering', function(){ output = 'before-filtering'; }); + + tf.filter(); + + deepEqual(emitter.events['before-filtering'].length, 0, + 'Expected number of listeners'); + deepEqual(output, null, 'Expected output'); +}); + +test('Can emit', function(){ + var emitter = tf.emitter; + var output = null; + emitter.on('hello', function(arg){ output = arg; }); + + emitter.emit('hello', 'world'); + + deepEqual(output, 'world', 'Event emitted'); +}); + +module('Tear-down'); +test('can destroy TableFilter DOM elements', function() { + tf.destroy(); + deepEqual(tf.hasGrid(), false, 'Filters removed'); +}); diff --git a/test/test-help.js b/test/test-help.js index fc08835b..b934500d 100644 --- a/test/test-help.js +++ b/test/test-help.js @@ -18,6 +18,7 @@ test('Properties', function() { deepEqual(help.feature, 'help', 'Feature name'); deepEqual(help.enabled, true, 'Feature enabled'); deepEqual(help.initialized, true, 'Feature enabled'); + deepEqual(typeof help.emitter, 'object', 'Feature has emitter instance'); deepEqual(typeof help.config, 'object', 'TF configuration object'); deepEqual(typeof help.init, 'function', 'Feature init method'); deepEqual(typeof help.destroy, 'function', 'Feature destroy method'); diff --git a/test/test-no-results-message.js b/test/test-no-results-message.js index 9a091f14..7bf45cf2 100644 --- a/test/test-no-results-message.js +++ b/test/test-no-results-message.js @@ -19,6 +19,8 @@ test('No Results Feature', function() { deepEqual(noResults.feature, 'noResults', 'Feature name'); deepEqual(noResults.enabled, true, 'Feature enabled'); deepEqual(noResults.initialized, true, 'Feature initialized'); + deepEqual(typeof noResults.emitter, 'object', + 'Feature has emitter instance'); deepEqual(typeof noResults.config, 'object', 'TF configuration object'); deepEqual(typeof noResults.init, 'function', 'Feature init method'); deepEqual(typeof noResults.destroy, 'function', diff --git a/test/test-paging.js b/test/test-paging.js index 1a2d4ae8..e5c5fb27 100644 --- a/test/test-paging.js +++ b/test/test-paging.js @@ -23,6 +23,7 @@ test('Properties', function() { deepEqual(paging.feature, 'paging', 'Feature name'); deepEqual(paging.enabled, true, 'Feature enabled'); deepEqual(paging.initialized, true, 'Feature enabled'); + deepEqual(typeof paging.emitter, 'object', 'Feature has emitter instance'); deepEqual(typeof paging.config, 'object', 'TF configuration object'); deepEqual(typeof paging.init, 'function', 'Feature init method'); deepEqual(typeof paging.destroy, 'function', 'Feature destroy method'); diff --git a/test/test-popup-filter.js b/test/test-popup-filter.js index 47a44f20..d7b31184 100644 --- a/test/test-popup-filter.js +++ b/test/test-popup-filter.js @@ -92,6 +92,8 @@ test('Properties', function() { deepEqual(popupFilter.feature, 'popupFilters', 'Feature name'); deepEqual(popupFilter.enabled, true, 'Feature enabled'); deepEqual(popupFilter.initialized, true, 'Feature enabled'); + deepEqual(typeof popupFilter.emitter, 'object', + 'Feature has emitter instance'); deepEqual(typeof popupFilter.config, 'object', 'TF configuration object'); deepEqual(typeof popupFilter.init, 'function', 'Feature init method'); deepEqual(typeof popupFilter.destroy, 'function', 'Feature destroy method'); diff --git a/test/test-rows-counter.js b/test/test-rows-counter.js index 1abf3889..6e3cd60e 100644 --- a/test/test-rows-counter.js +++ b/test/test-rows-counter.js @@ -18,6 +18,8 @@ test('Properties', function() { deepEqual(rowsCounter.feature, 'rowsCounter', 'Feature name'); deepEqual(rowsCounter.enabled, true, 'Feature enabled'); deepEqual(rowsCounter.initialized, true, 'Feature enabled'); + deepEqual(typeof rowsCounter.emitter, 'object', + 'Feature has emitter instance'); deepEqual(typeof rowsCounter.config, 'object', 'TF configuration object'); deepEqual(typeof rowsCounter.init, 'function', 'Feature init method'); deepEqual(typeof rowsCounter.destroy, 'function', 'Feature destroy method'); diff --git a/test/test-status-bar.js b/test/test-status-bar.js index 6edd00f1..ef5792c9 100644 --- a/test/test-status-bar.js +++ b/test/test-status-bar.js @@ -18,6 +18,8 @@ test('Properties', function() { deepEqual(statusBar.feature, 'statusBar', 'Feature name'); deepEqual(statusBar.enabled, true, 'Feature enabled'); deepEqual(statusBar.initialized, true, 'Feature enabled'); + deepEqual(typeof statusBar.emitter, 'object', + 'Feature has emitter instance'); deepEqual(typeof statusBar.config, 'object', 'TF configuration object'); deepEqual(typeof statusBar.init, 'function', 'Feature init method'); deepEqual(typeof statusBar.destroy, 'function', 'Feature destroy method'); From da9f8ad885a45c50f464617a5188e57b1ed4be30 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Mon, 28 Dec 2015 17:53:03 +1100 Subject: [PATCH 03/41] Finalised unit tests, removed applyProps method in tablefilter class --- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 10 +- dist/tablefilter/tf-1.js | 6 +- src/extensions/colOps/colOps.js | 8 +- src/modules/noResults.js | 14 ++ src/modules/paging.js | 15 +- src/modules/popupFilter.js | 9 ++ src/modules/store.js | 12 +- src/tablefilter.js | 88 ++++-------- test/test-always-visible-rows.js | 134 +++++++++--------- 15 files changed, 163 insertions(+), 145 deletions(-) diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 4e442dd0..b65b0160 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.0 by Max Guglielmi - * build date: 2015-12-28T00:17:35.892Z + * build date: 2015-12-28T06:48:43.448Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index a59ec73a..15eac1cd 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.0 by Max Guglielmi - * build date: 2015-12-28T00:17:35.892Z + * build date: 2015-12-28T06:48:43.448Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 1d32167a..43d297fe 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.0 by Max Guglielmi - * build date: 2015-12-28T00:17:35.892Z + * build date: 2015-12-28T06:48:43.448Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index f0e0365f..09154d01 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.0 by Max Guglielmi - * build date: 2015-12-28T00:17:35.892Z + * build date: 2015-12-28T06:48:43.448Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 9454e65a..b3affa24 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.0 by Max Guglielmi - * build date: 2015-12-28T00:17:35.892Z + * build date: 2015-12-28T06:48:43.448Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 1ae35fe4..6a9adbbd 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.0 by Max Guglielmi - * build date: 2015-12-28T00:17:35.892Z + * build date: 2015-12-28T06:48:43.448Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index e4438711..40298dca 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,10 @@ /** * tablefilter v0.1.0 by Max Guglielmi - * build date: 2015-12-28T00:17:35.798Z + * build date: 2015-12-28T06:48:43.385Z * MIT License */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(this,function(){return function(t){function e(s){if(i[s])return i[s].exports;var a=i[s]={exports:{},id:s,loaded:!1};return t[s].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var s=window.webpackJsonp;window.webpackJsonp=function(i,l){for(var n,r,o=0,h=[];on;n++)i[n]=arguments[n];if(0!==i.length){if(this.id=null,this.version="0.1.0",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,i.forEach(function(t){var s="undefined"==typeof t?"undefined":a(t);"object"===s&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===s?(e.id=t,e.tbl=u["default"].id(t)):"number"===s?e.startRow=t:"object"===s&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var s=o["default"].keyCode(e);13===s?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var s=t||A.event,i=o["default"].keyCode(s);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,s=o["default"].target(e);if(this.activeFilterId=s.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var i=this.extension("advancedGrid"),a=i._ezEditTable;i.cfg.editable&&a.Editable.Remove(),i.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,s=o["default"].target(e);if(this.activeFilterId=s.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===s.getAttribute("filled")){var i=s.getAttribute("ct");this.Mod.dropdown._build(i)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,s=o["default"].target(e);if(this.loadFltOnDemand&&"0"===s.getAttribute("filled")){var i=s.getAttribute("ct");this.Mod.checkList._build(i),this.Mod.checkList.checkListDiv[i].onclick=null,this.Mod.checkList.checkListDiv[i].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,s=this.singleSearchFlt?1:this.nbCells,i=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this)),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new F.HighlightKeyword(this)),this.popupFilters&&(e.popupFilter||(e.popupFilter=new P.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;s>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),i=n==s-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,i=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?i:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=i,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==s-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&this.enforceVisibility(),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(i,!0):r.dropdown._build(i,!1,a,l);break;case e.checklist:r.checkList._build(i,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var s=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],i=s.slcIndex,a=s.slcExternal,l=s.slcId,n=s.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,s=t.length;s>e;e++){var i=t[e];this.ExtRegistry[i.name]||this.loadExtension(i)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var i=t.name,a=t.path,l=void 0;i&&a?l=t.path+i:(i=i.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,i)),s.p=this.basePath,s.e(1,function(s){var a=[s(26)("./"+l)];(function(s){var a=new s["default"](e,t);a.init(),e.ExtRegistry[i]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,s=t.length;s>e;e++){var i=t[e],a=this.ExtRegistry[i.name];a&&(a.destroy(),this.ExtRegistry[i.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var s=0,i=t.length;i>s;s++){var a=t[s],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",s)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){if(this._hasGrid){var t=this.tbl.rows,e=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&e.highlightKeyword.unhighlightAll(),this.markActiveColumns&&this.clearActiveColumns(),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,s=0;e>s;s++){var i=t[s],a=u["default"].id(i);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,s=e.cols,i=[],a=[],l=s.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?i.push(r[h]):i.push(n[h]);return o&&(a.sort(),i.sort()),[a,i]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),s=this.getFiltersByType(this.fltTypeSlc,!0),i=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,s){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(s)),""!==a&&i.highlightKeyword.highlight(s,a,i.highlightKeyword.highlightCssClass)}}function e(t,e,s){var i=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),F=g.test(t),P=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=F&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),i=U>V):D?(U=y["default"].format(t.replace(r,""),O),i=U>=V):A?(U=y["default"].format(t.replace(o,""),O),i=V>=U):B?(U=y["default"].format(t.replace(d,""),O),i=V>U):H?(U=y["default"].format(t.replace(c,""),O),i=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),i=V.toString()==U.toString()):p.test(t)?i=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),i=V.toString()===U.toString()):i=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(s),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[s]?(l=a(e,this.colNbFormat[s]),n=this.colNbFormat[s]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)i=l<=a(t.replace(r,""),n);else if(T)i=l>=a(t.replace(o,""),n);else if(u)i=la(t.replace(d,""),n);else if(R)i=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(P)i=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(F)i=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)i=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");i=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)i=f["default"].isEmpty(e);else if(L)i=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);i=W.test(e)}catch($){i=!1}else i=f["default"].contains(t,e,this.isExactMatch(s),this.caseSensitive);return i}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var s=this.tbl.rows,i=this.Mod,a=0;this.validRowsIndex=[],this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.popupFilters&&i.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(F=!1),this.singleSearchFlt&&R[I]&&(P=!0),this.popupFilters&&i.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&P&&(F=!0),F?(this.validateRow(x,!0),this.validRowsIndex.push(x),this.alternateRows&&i.alternateRows.setRowBg(x,this.validRowsIndex.length),this.onRowValidated&&this.onRowValidated.call(null,this,x)):(this.validateRow(x,!1),i.alternateRows&&i.alternateRows.removeRowBg(x),this.hasVisibleRows&&-1!==this.visibleRows.indexOf(x)?this.validRowsIndex.push(x):a++)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.rememberGridValues&&i.store.saveFilterValues(this.fltsValuesCookie),this.paging?(i.paging.startPagingRow=0,i.paging.currentPageNb=1,i.paging.setPagingInfo(this.validRowsIndex)):this.applyProps(),this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"applyProps",value:function(){var t=this.Mod;this.hasVisibleRows&&this.enforceVisibility(),this.hasExtension("colOps")&&this.extension("colOps").calc(),this.linkedFilters&&this.linkFilters(),this.popupFilters&&t.popupFilter.closeAll(),this.noResults&&(this.nbVisibleRows>0?t.noResults.hide():t.noResults.show())}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],s=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],i=arguments.length<=3||void 0===arguments[3]?[]:arguments[3]; -if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=i.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=s?w["default"].removeNbFormat(d,f):d;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,s=this.getFilterElement(t);if(!s)return"";var i=this.getFilterType(t);if(i!==this.fltTypeMulti&&i!==this.fltTypeCheckList)e=s.value;else if(i===this.fltTypeMulti){e="";for(var a=0,l=s.options.length;l>a;a++)s.options[a].selected&&(e=e.concat(s.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else i===this.fltTypeCheckList&&(null!==s.getAttribute("value")?(e=s.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,s=this.fltIds.length;s>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var s=[],i=0,a=this.fltIds.length;a>i;i++){var l=this.getFilterType(i);if(l===f["default"].lower(t)){var n=e?i:this.fltIds[i];s.push(n)}}return s}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,s=this.tbl.rows.length;return t&&(e=0),parseInt(s-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.refRow;in;n++){var o=this.getCellData(l[n]);a[1].push(o)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,s=[];t&&s.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var i=this.getValidRows(!0),a=0;aa;a++){var n=s[a],r=n[1],o=r[t];i.push(o)}return i}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var s=this.tbl.rows[t];if(s&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var i=e?"":"none",a=e?"true":"false";s.style.display=i,this.paging&&s.setAttribute("validRow",a)}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=s.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(i===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(s,"li").length;s.setAttribute("value",""),s.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(s,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function s(){for(var t=this.nbCells,s=this.colWidths,i=u["default"].tag(e,"col"),a=i.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=i[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=s[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var i=void 0;i=void 0===t?"none"!=e.rows[0].style.display?0:1:t,s.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var s=this.visibleRows[t];s<=this.nbRows&&this.validateRow(s,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.linkedFilters&&this.linkFilters(),this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),s=this.getFiltersByType(this.fltTypeCheckList,!0),i=t.concat(e);i=i.concat(s);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=i.length;r>n;n++){var o=u["default"].id(this.fltIds[i[n]]);if(l=this.getFilterValue(i[n]),a!==i[n]||this.paging&&-1!=t.indexOf(i[n])&&a===i[n]||!this.paging&&(-1!=s.indexOf(i[n])||-1!=e.indexOf(i[n]))||l===this.displayAllText){if(-1!=s.indexOf(i[n])?this.Mod.checkList.checkListDiv[i[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=s.indexOf(i[n])?this.Mod.checkList._build(i[n]):this.Mod.dropdown._build(i[n],!0),this.setFilterValue(i[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,s=e.rows,i=this.filtersRowIndex,a=s[i];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=s.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var s=!1,i=e?e:"script",a="script"==i?"src":"href",l=u["default"].tag(H,i),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){s=!0;break}return s}},{key:"import",value:function(t,e,s,i){var a=i?i:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof s&&s.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),i=arguments;if(i.length>1)for(var a=0;a0){var i=document.cookie,a=i.indexOf(s);if(-1!==a){a+=s.length;var l=i.indexOf(";",a);-1===l&&(l=i.length),e=unescape(i.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var s=this.read(t),i=s.split(e);return i},getValueByIndex:function(t,e,s){s||(s=",");var i=this.valueToArray(t,s);return i[e]}}},function(t,e){"use strict";function s(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var i=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===s(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":s(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===i},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={has:function(t,e,s){for(var i=void 0===s?!1:s,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function i(t){if(void 0===t)return 0;for(var e=void 0,s=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],i=0;i11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var s=this.format(t,e);t=s.getDate()+"/"+(s.getMonth()+1)+"/"+s.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var i=void 0,a=void 0;if("Y"===e.substring(0,1)?(i=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(i=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(i=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),i.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(s(l[2]),i(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(s(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(s(l[2]),l[1]-1,l[0])}return a}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var s=t;return s="us"===l["default"].lower(e)?+s.replace(/[^\d\.-]/g,""):+s.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var s=0;s0&&i.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",i.style.tableLayout="fixed",this.headTbl.cellPadding=i.cellPadding,this.headTbl.cellSpacing=i.cellSpacing,e.setColWidths(0,this.headTbl),i.style.width="",this.headTbl.style.width=i.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var s=p["default"].target(e),i=s.scrollLeft;t.headTblCont.scrollLeft=i});var F=(s.extensions||[]).filter(function(t){return"sort"===t.name});1===F.length&&(F[0].async_sort=!0,F[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(i,"col").length>0?!0:!1;var P=function(){for(var t=e.nbCells-1;t>=0;t--){var s=u["default"].create("col",["id",e.id+"_col_"+t]);i.insertBefore(s,i.firstChild),s.style.width=e.colWidths[t],this.gridColElms[t]=s}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(i,"col"),S=0;S',e.popUpDivCssClass=i.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(i.on_before_popup_filter_open)?i.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(i.on_after_popup_filter_open)?i.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(i.on_before_popup_filter_close)?i.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(i.on_after_popup_filter_close)?i.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(s,e),r(s,[{key:"onClick",value:function(e){var s=e||t.event,i=s.target.parentNode,a=parseInt(i.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(s),p["default"].stop(s)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,s=0;sC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,s,i,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,s=d["default"].lower(this.slcFillingMethod);if("innerhtml"===s)this.slcInnerHtml+='";else{var i=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(i.style.display="none"),t.appendChild(i),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=s(3),l=i(a);e["default"]={ignoreCase:function(t,e){var s=l["default"].lower(t),i=l["default"].lower(e);return i>s?-1:s>i?1:0}}},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var s=0;s_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var s=this,i=this.tf,a=this.addTChecks(t,e),l=[],n=i.feature("store"),o=n?n.getFilterValues(i.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(i.hasCustomSlcOptions&&-1!=i.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+i.orOperator+" "));for(var u=0;u0?1:0),l=a+i.pagingLength-1<=e.nbVisibleRows?a+i.pagingLength-1:e.nbVisibleRows;s=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else s=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=s,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,s)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s",s.btnPrevPageText=i.btn_prev_page_text||"<",s.btnLastPageText=i.btn_last_page_text||">|",s.btnFirstPageText=i.btn_first_page_text||"|<",s.btnNextPageHtml=i.btn_next_page_html||(t.enableIcons?'':null),s.btnPrevPageHtml=i.btn_prev_page_html||(t.enableIcons?'':null),s.btnFirstPageHtml=i.btn_first_page_html||(t.enableIcons?'':null),s.btnLastPageHtml=i.btn_last_page_html||(t.enableIcons?'':null),s.pageText=i.page_text||" Page ",s.ofText=i.of_text||" of ",s.nbPgSpanCssClass=i.nb_pages_css_class||"nbpg",s.hasPagingBtns=i.paging_btns===!1?!1:!0,s.pageSelectorType=i.page_selector_type||t.fltTypeSlc,s.onBeforeChangePage=c["default"].isFn(i.on_before_change_page)?i.on_before_change_page:null,s.onAfterChangePage=c["default"].isFn(i.on_after_change_page)?i.on_after_change_page:null,s.prfxSlcPages="slcPages_",s.prfxSlcResults="slcResults_",s.prfxSlcResultsTxt="slcResultsTxt_",s.prfxBtnNextSpan="btnNextSpan_",s.prfxBtnPrevSpan="btnPrevSpan_",s.prfxBtnLastSpan="btnLastSpan_",s.prfxBtnFirstSpan="btnFirstSpan_",s.prfxBtnNext="btnNext_",s.prfxBtnPrev="btnPrev_",s.prfxBtnLast="btnLast_",s.prfxBtnFirst="btnFirst_",s.prfxPgSpan="pgspan_",s.prfxPgBeforeSpan="pgbeforespan_",s.prfxPgAfterSpan="pgafterspan_";var a=s.refRow,r=s.nbRows;s.nbPages=Math.ceil((r-a)/s.pagingLength);var o=s;return s.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var s=b["default"].keyCode(e);13===s&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},s}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,s=this.tf,i=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),i.slcPagesChange=function(t){var s=t.target;e.changePage(s.selectedIndex)},this.pageSelectorType===s.fltTypeSlc&&(t=d["default"].create(s.fltTypeSlc,["id",this.prfxSlcPages+s.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",i.slcPagesChange)),this.pageSelectorType===s.fltTypeInp&&(t=d["default"].create(s.fltTypeInp,["id",this.prfxSlcPages+s.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",i._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+s.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+s.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+s.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+s.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",i.next);else{var o=d["default"].create(s.fltTypeInp,["id",this.prfxBtnNext+s.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",i.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",i.prev);else{var h=d["default"].create(s.fltTypeInp,["id",this.prfxBtnPrev+s.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",i.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",i.last);else{var u=d["default"].create(s.fltTypeInp,["id",this.prfxBtnLast+s.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",i.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",i.first);else{var f=d["default"].create(s.fltTypeInp,["id",this.prfxBtnFirst+s.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",i.first),r.appendChild(f)}}this.pagingTgtId||s.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):s.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+s.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+s.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+s.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+s.id),s.rememberGridValues||this.setPagingInfo(),s.fltGrid||(s.validateAllRows(),this.setPagingInfo(s.validRowsIndex)),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"setPagingInfo",value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,s=e.tbl.rows,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=i[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&s&&s.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&s&&s.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,e.applyProps(),this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var s=this.evt,i="undefined"==typeof t?"undefined":a(t);if("string"===i)switch(g["default"].lower(t)){case"next":s.next();break;case"previous":s.prev();break;case"last":s.last();break;case"first":s.first();break;default:s.next()}else"number"===i&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,s=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){s.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var i=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);i.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(i,o.btn)):(r.appendChild(n),r.appendChild(i));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,s=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*s,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var i=this.pagingSlc.options.length-1<=s?this.pagingSlc.options.length-1:s;this.pagingSlc.options[i].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,s=e.feature("store").getPageNb(t);""!==s&&this.changePage(s-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var s=e.feature("store").getPageLength(t);""!==s&&(this.resultsPerPageSlc.options[s].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=d["default"].id(this.prfxBtnNextSpan+t.id),s=d["default"].id(this.prfxBtnPrevSpan+t.id),i=d["default"].id(this.prfxBtnLastSpan+t.id),a=d["default"].id(this.prfxBtnFirstSpan+t.id),l=d["default"].id(this.prfxPgBeforeSpan+t.id),n=d["default"].id(this.prfxPgAfterSpan+t.id),r=d["default"].id(this.prfxPgSpan+t.id),o=this.evt;this.pagingSlc&&(this.pageSelectorType===t.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",o.slcPagesChange):this.pageSelectorType===t.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",o._detectKey),d["default"].remove(this.pagingSlc)),e&&(b["default"].remove(e,"click",o.next),d["default"].remove(e)),s&&(b["default"].remove(s,"click",o.prev),d["default"].remove(s)),i&&(b["default"].remove(i,"click",o.last),d["default"].remove(i)),a&&(b["default"].remove(a,"click",o.first),d["default"].remove(a)),l&&d["default"].remove(l),n&&d["default"].remove(n),r&&d["default"].remove(r),this.hasResultsPerPage&&this.removeResultsPerPage(),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s':null),s.prfxResetSpan="resetspan_",s}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var s=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var i=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(i.appendChild(s),this.btnResetHtml){s.innerHTML=this.btnResetHtml;var a=s.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),s.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=s.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;s<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',s.instrHtml=i.help_instructions_html||null,s.btnText=i.help_instructions_btn_text||"?",s.btnHtml=i.help_instructions_btn_html||null,s.btnCssClass=i.help_instructions_btn_css_class||"helpBtn",s.contCssClass=i.help_instructions_container_css_class||"helpCont",s.btn=null,s.cont=null,s.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',s.prfxHelpSpan="helpSpan_",s.prfxHelpDiv="helpDiv_",s}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,s=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),i=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(s);var l=this.contTgtId?u["default"].id(this.contTgtId):s;if(this.btnHtml){s.innerHTML=this.btnHtml;var n=s.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(i)}else{l.appendChild(i);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),s.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(i),i.innerHTML=this.instrHtml,this.contTgtId||(i.className=this.contCssClass,f["default"].add(i,"dblclick",function(){t.toggle()}))):(i.innerHTML=this.instrText,i.className=this.contCssClass,f["default"].add(i,"dblclick",function(){t.toggle()})),i.innerHTML+=this.defaultHtml,f["default"].add(i,"click",function(){t.toggle()}),this.cont=i,this.btn=s,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,s){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var s=0;sn;n++){var r=s?n:e[n];this.setRowBg(r,l),l++}this.initialized=!0}}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var s=this.tf.tbl.rows,i=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(s[t],i%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){if(this.initialized){for(var t=this.tf.refRow;tn;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.0",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":a(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),a=s._ezEditTable;s.cfg.editable&&a.Editable.Remove(),s.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this)),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,a,l);break;case e.checklist:r.checkList._build(s,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,a=i.slcExternal,l=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,a=t.path,l=void 0;s&&a?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var a=[i(26)("./"+l)];(function(i){var a=new i["default"](e,t);a.init(),e.ExtRegistry[s]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],a=this.ExtRegistry[s.name];a&&(a.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var a=t[i],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&this.clearActiveColumns(),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],a=u["default"].id(s);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],a=[],l=i.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(a.sort(),s.sort()),[a,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(i)),""!==a&&s.highlightKeyword.highlight(i,a,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=a(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)s=l<=a(t.replace(r,""),n);else if(T)s=l>=a(t.replace(o,""),n);else if(u)s=la(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,a=0;this.validRowsIndex=[],this.highlightKeywords&&s.highlightKeyword.unhighlightAll(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.popupFilters&&s.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&F&&(P=!0),P?(this.validateRow(x,!0),this.validRowsIndex.push(x),this.alternateRows&&s.alternateRows.setRowBg(x,this.validRowsIndex.length),this.onRowValidated&&this.onRowValidated.call(null,this,x)):(this.validateRow(x,!1),s.alternateRows&&s.alternateRows.removeRowBg(x),this.hasVisibleRows&&-1!==this.visibleRows.indexOf(x)?this.validRowsIndex.push(x):a++)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n)); +var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var a=0,l=i.options.length;l>a;a++)i.options[a].selected&&(e=e.concat(i.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,a=this.fltIds.length;a>s;s++){var l=this.getFilterType(s);if(l===f["default"].lower(t)){var n=e?s:this.fltIds[s];i.push(n)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sn;n++){var o=this.getCellData(l[n]);a[1].push(o)}i.push(a)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),a=0;aa;a++){var n=i[a],r=n[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",a=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",a)}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),a=s.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=s[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=i[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("cleared-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=s.length;r>n;n++){var o=u["default"].id(this.fltIds[s[n]]);if(l=this.getFilterValue(s[n]),a!==s[n]||this.paging&&-1!=t.indexOf(s[n])&&a===s[n]||!this.paging&&(-1!=i.indexOf(s[n])||-1!=e.indexOf(s[n]))||l===this.displayAllText){if(-1!=i.indexOf(s[n])?this.Mod.checkList.checkListDiv[s[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[n])?this.Mod.checkList._build(s[n]):this.Mod.dropdown._build(s[n],!0),this.setFilterValue(s[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,a=i[s];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",a="script"==s?"src":"href",l=u["default"].tag(H,s),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var a=s?s:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var a=0;a0){var s=document.cookie,a=s.indexOf(i);if(-1!==a){a+=i.length;var l=s.indexOf(";",a);-1===l&&(l=s.length),e=unescape(s.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,a=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0])}return a}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,a=parseInt(s.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,i,s,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var i=0;i_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,a=this.addTChecks(t,e),l=[],n=s.feature("store"),o=n?n.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),l=a+s.pagingLength-1<=e.nbVisibleRows?a+s.pagingLength-1:e.nbVisibleRows;i=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var a=i.refRow,r=i.nbRows;i.nbPages=Math.ceil((r-a)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,i=e.tbl.rows,s=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(s.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=s[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&i&&i.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&i&&i.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":a(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),a=d["default"].id(this.prfxBtnLastSpan+e.id),l=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),a&&(b["default"].remove(a,"click",h.last),d["default"].remove(a)),l&&(b["default"].remove(l,"click",h.first),d["default"].remove(l)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var a=i.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;in;n++){var r=i?n:e[n];this.setRowBg(r,l),l++}this.initialized=!0}}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){if(this.initialized){for(var t=this.tf.refRow;t0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index f7f7c341..f7cdac07 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,8 +1,8 @@ /** * tablefilter v0.1.0 by Max Guglielmi - * build date: 2015-12-28T00:17:35.798Z + * build date: 2015-12-28T06:48:43.385Z * MIT License */ -webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),g=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+g?d[l+g]:[u-1]:l-g<=d[0]?d[0]:d[l-g],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var m=l+g;o=m>u-1?d[u-1]:d[m]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-g];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var g=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),g&&g.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(m){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),g=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+g?d[l+g]:[u-1]:l-g<=d[0]?d[0]:d[l-g],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var m=l+g;o=m>u-1?d[u-1]:d[m]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-g];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var g=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),g&&g.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(m){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off("after-filtering",function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/src/extensions/colOps/colOps.js b/src/extensions/colOps/colOps.js index aa9ca668..899345d7 100644 --- a/src/extensions/colOps/colOps.js +++ b/src/extensions/colOps/colOps.js @@ -22,6 +22,9 @@ export default class ColOps{ } init(){ + // subscribe to events + this.tf.emitter.on('after-filtering', ()=> this.calc()); + this.calc(); } @@ -310,6 +313,9 @@ export default class ColOps{ } } - destroy(){} + destroy(){ + // unsubscribe to events + this.tf.emitter.off('after-filtering', ()=> this.calc()); + } } diff --git a/src/modules/noResults.js b/src/modules/noResults.js index 1938b30a..b1e58c33 100644 --- a/src/modules/noResults.js +++ b/src/modules/noResults.js @@ -59,10 +59,22 @@ export class NoResults extends Feature{ } this.cont = cont; + + // subscribe to after-filtering event + this.emitter.on('after-filtering', ()=> this.toggle()); + this.initialized = true; this.hide(); } + toggle(){ + if(this.tf.nbVisibleRows > 0){ + this.hide(); + } else { + this.show(); + } + } + show(){ if(!this.initialized || !this.isEnabled()){ return; @@ -115,6 +127,8 @@ export class NoResults extends Feature{ } Dom.remove(this.cont); this.cont = null; + // unsubscribe to after-filtering event + this.emitter.off('after-filtering', ()=> this.toggle()); this.initialized = false; } } diff --git a/src/modules/paging.js b/src/modules/paging.js index d55fc5ed..83e54ead 100644 --- a/src/modules/paging.js +++ b/src/modules/paging.js @@ -334,6 +334,8 @@ export class Paging extends Feature{ this.setPagingInfo(tf.validRowsIndex); } + this.emitter.on('after-filtering', ()=> this.resetPagingInfo()); + this.initialized = true; } @@ -354,6 +356,15 @@ export class Paging extends Feature{ } } + /** + * Reset paging info from scratch after a filtering process + */ + resetPagingInfo(){ + this.startPagingRow = 0; + this.currentPageNb = 1; + this.setPagingInfo(this.tf.validRowsIndex); + } + /** * Calculate number of pages based on valid rows * Refresh paging select according to number of pages @@ -449,8 +460,6 @@ export class Paging extends Feature{ } tf.nbVisibleRows = tf.validRowsIndex.length; - //re-applies filter behaviours after filtering process - tf.applyProps(); // broadcast grouping by page this.emitter.emit('grouped-by-page', tf, this); @@ -779,6 +788,8 @@ export class Paging extends Feature{ this.removeResultsPerPage(); } + this.emitter.off('after-filtering', ()=> this.resetPagingInfo()); + this.pagingSlc = null; this.nbPages = 0; this.disable(); diff --git a/src/modules/popupFilter.js b/src/modules/popupFilter.js index b4762129..68e1db5a 100644 --- a/src/modules/popupFilter.js +++ b/src/modules/popupFilter.js @@ -101,6 +101,10 @@ export class PopupFilter extends Feature{ this.popUpFltImgs[i] = popUpSpan.firstChild; } + // subscribe to events + this.emitter.on('before-filtering', ()=> this.buildIcons()); + this.emitter.on('after-filtering', ()=> this.closeAll()); + this.initialized = true; } @@ -245,6 +249,11 @@ export class PopupFilter extends Feature{ this.popUpFltElms = []; this.popUpFltSpans = []; this.popUpFltImgs = []; + + // unsubscribe to events + this.emitter.off('before-filtering', ()=> this.buildIcons()); + this.emitter.off('after-filtering', ()=> this.closeAll()); + this.initialized = false; } diff --git a/src/modules/store.js b/src/modules/store.js index d24757dd..dd796de5 100644 --- a/src/modules/store.js +++ b/src/modules/store.js @@ -8,13 +8,19 @@ export class Store{ * * TODO: use localStorage and fallback to cookie persistence */ - constructor(tf) { + constructor(tf){ var f = tf.config(); this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; this.tf = tf; + this.emitter = tf.emitter; + } + + init(){ + this.emitter.on('after-filtering', + ()=> this.saveFilterValues(this.tf.fltsValuesCookie)); } /** @@ -97,4 +103,8 @@ export class Store{ return Cookie.read(name); } + destroy(){ + this.emitter.off('after-filtering', + ()=> this.saveFilterValues(this.tf.fltsValuesCookie)); + } } diff --git a/src/tablefilter.js b/src/tablefilter.js index fa97bb44..4ec7e99a 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -635,6 +635,7 @@ export class TableFilter { if(this.rememberGridValues || this.rememberPageNb || this.rememberPageLen){ Mod.store = new Store(this); + Mod.store.init(); } if(this.gridLayout){ @@ -874,6 +875,7 @@ export class TableFilter { /* Features */ if(this.hasVisibleRows){ + this.emitter.on('after-filtering', ()=> this.enforceVisibility()); this.enforceVisibility(); } if(this.rowsCounter){ @@ -937,6 +939,11 @@ export class TableFilter { this.initExtensions(); } + // Subscribe to event + if(this.linkedFilters){ + this.emitter.on('after-filtering', ()=> this.linkFilters()); + } + if(this.onFiltersLoaded){ this.onFiltersLoaded.call(null, this); } @@ -1219,13 +1226,21 @@ export class TableFilter { } // Destroy modules - Object.keys(Mod).forEach(function(key) { + Object.keys(Mod).forEach(function(key){ var feature = Mod[key]; if(feature && Types.isFn(feature.destroy)){ feature.destroy(); } }); + // unsubscribe to events + if(this.hasVisibleRows){ + this.emitter.off('after-filtering', ()=> this.enforceVisibility()); + } + if(this.linkedFilters){ + this.emitter.off('after-filtering', ()=> this.linkFilters()); + } + Dom.removeClass(this.tbl, this.prfxTf); this.nbHiddenRows = 0; this.validRowsIndex = null; @@ -1512,9 +1527,9 @@ export class TableFilter { Mod.highlightKeyword.unhighlightAll(); } //removes popup filters active icons - if(this.popupFilters){ - Mod.popupFilter.buildIcons(); - } + // if(this.popupFilters){ + // Mod.popupFilter.buildIcons(); + // } //removes active column header class if(this.markActiveColumns){ this.clearActiveColumns(); @@ -1862,67 +1877,14 @@ export class TableFilter { this.nbVisibleRows = this.validRowsIndex.length; this.nbHiddenRows = hiddenrows; - if(this.rememberGridValues){ - Mod.store.saveFilterValues(this.fltsValuesCookie); - } - - //applies filter props after filtering process - // TODO remove below if statement when custom events in place - if(!this.paging){ - this.applyProps(); - } else { - // Shouldn't need to care of that here... - // TODO: provide a method in paging module - Mod.paging.startPagingRow = 0; - Mod.paging.currentPageNb = 1; - Mod.paging.setPagingInfo(this.validRowsIndex); - } //invokes onafterfilter callback if(this.onAfterFilter){ this.onAfterFilter.call(null, this); } + this.emitter.emit('after-filtering', this); } - /** - * Re-apply the features/behaviour concerned by filtering/paging operation - * - * NOTE: this will disappear whenever custom events in place - */ - applyProps(){ - let Mod = this.Mod; - - //shows rows always visible - if(this.hasVisibleRows){ - this.enforceVisibility(); - } - //columns operations - if(this.hasExtension('colOps')){ - this.extension('colOps').calc(); - } - - //re-populates drop-down filters - if(this.linkedFilters){ - this.linkFilters(); - } - - // if(this.rowsCounter){ - // Mod.rowsCounter.refresh(this.nbVisibleRows); - // } - - if(this.popupFilters){ - Mod.popupFilter.closeAll(); - } - - if(this.noResults){ - if(this.nbVisibleRows > 0){ - Mod.noResults.hide(); - } else { - Mod.noResults.show(); - } - } - } - /** * Return the data of a specified colum * @param {Number} colIndex Column index @@ -2400,12 +2362,14 @@ export class TableFilter { for(let i=0, len=this.fltIds.length; i Date: Mon, 28 Dec 2015 17:54:22 +1100 Subject: [PATCH 04/41] Included starter.html into git --- dist/starter.html | 514 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 514 insertions(+) create mode 100644 dist/starter.html diff --git a/dist/starter.html b/dist/starter.html new file mode 100644 index 00000000..d1fbf106 --- /dev/null +++ b/dist/starter.html @@ -0,0 +1,514 @@ + + + + tablefilter v0.1.0 - Starter + + +

tablefilter v0.1.0

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
countryisoyearPOPXRATPPPcgdpccci
BeninBEN19985950.33589.9517822190.951178.4690.987.55
BeninBEN19996109.53615.6990967200.191174.9092.617.86
BeninBEN20006272.00711.9763184200.611224.7492.278.25
Burkina FasoBFA19949755.03555.2047119125.76838.7679.816.57
Burkina FasoBFA19959988.00499.148407136.65860.8980.419.29
Burkina FasoBFA199610225.00511.5523987144.18881.1180.4012.12
Burkina FasoBFA199710473.53583.6693726141.78899.0176.9414.94
RussiaRUS1998146899.019.7050828932.647086.3967.739.20
RussiaRUS1999146308.9924.61993984.038074.7057.358.81
RussiaRUS2000145555.0128.129169464.859995.9154.748.79
RwandaRWA19946230.00194.51750.39529.48132.164.48
RwandaRWA19956400.00262.197509870.67746.3492.773.08
RwandaRWA19966727.00306.820007377.90823.2589.713.21
RwandaRWA19977895.18301.529785284.13847.7991.443.72
RwandaRWA19988105.00312.314086985.32914.2289.344.22
El SalvadorSLV19955669.008.7545833593.544143.5989.3110.35
El SalvadorSLV19965798.008.7550001143.694235.7988.777.79
El SalvadorSLV19975911.008.7562503813.744408.4187.057.90
Slovak RepublicSVK20005401.0046.035213.0212618.5352.2224.78
SloveniaSVN19941988.90128.808593879.9711662.1253.2119.87
SloveniaSVN19951990.00118.518501389.0312574.9654.4623.11
SloveniaSVN19961991.00135.364303697.2713151.5154.3223.23
SloveniaSVN19971985.96159.6882935103.9614143.0253.2424.14
SloveniaSVN19981982.60166.134201108.9315067.3452.8225.35
ZambiaZMB19948740.72669.3706055307.48834.1975.439.86
ZambiaZMB19958980.00864.1192017402.40829.3776.5510.31
ZambiaZMB19969214.401207.900024515.01838.0578.7410.99
ZambiaZMB19979443.211314.498047596.97851.4777.5912.15
ZambiaZMB19989665.711862.06897744.91800.6985.1213.75
ZambiaZMB19999881.212388.019043941.87765.2491.8215.30
ZambiaZMB200010089.003110.8439941157.63840.9786.3315.38
ZimbabweZWE199410775.358.1515388492.012586.8460.1018.53
ZimbabweZWE199511011.008.665375712.152603.3766.8915.03
ZimbabweZWE199611242.1610.002349852.642860.2372.0611.32
ZimbabweZWE199711923.5212.111289983.172727.0682.8211.01
ZimbabweZWE199812153.8523.679109574.062799.8577.6610.75
ZimbabweZWE199912388.3238.301200876.122770.4876.8910.73
ZimbabweZWE200012627.0044.417919169.482607.0369.238.62
+ + + + + + +

+
+
+
+
+
+
+
+
+

From 5da3079c1350f894e7b4c130d4a51402875fabc5 Mon Sep 17 00:00:00 2001
From: Max Guglielmi 
Date: Tue, 29 Dec 2015 17:05:36 +1100
Subject: [PATCH 05/41] Added comments to emitter class

---
 package.json   |  2 +-
 src/emitter.js | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/package.json b/package.json
index c2224e3b..ff4687b3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "tablefilter",
-  "version": "0.1.0",
+  "version": "0.1.1",
   "description": "A Javascript library making HTML tables filterable and a bit more",
   "license": "MIT",
   "author": {
diff --git a/src/emitter.js b/src/emitter.js
index 22bbec1a..5357bb6f 100644
--- a/src/emitter.js
+++ b/src/emitter.js
@@ -1,19 +1,41 @@
+/**
+ * Event emitter class
+ */
 export class Emitter {
     constructor() {
+        /**
+         * Events object
+         * @type {Object}
+         */
         this.events = {};
     }
 
+    /**
+     * Subscribe to an event
+     * @param  {String}   evt Event name
+     * @param  {Function} fn  Function invoked when event is emitted
+     */
     on(evt, fn) {
         this.events[evt] = this.events[evt] || [];
         this.events[evt].push(fn);
     }
 
+    /**
+     * Unsubscribe to an event
+     * @param  {String}   evt Event name
+     * @param  {Function} fn  Function invoked when event is emitted
+     */
     off(evt, fn) {
         if(evt in this.events) {
             this.events[evt].splice(this.events[evt].indexOf(fn), 1);
         }
     }
 
+    /**
+     * Emit an event
+     * @param  {String} evt Event name followed by any other argument passed to
+     * the invoked function
+     */
     emit(evt /*, args...*/) {
         if(evt in this.events === false) {
             return;

From 9ab5f5fb9deafd9c8f62fbd510e445d37fe75a1b Mon Sep 17 00:00:00 2001
From: Max Guglielmi 
Date: Tue, 29 Dec 2015 17:13:08 +1100
Subject: [PATCH 06/41] Hooked-up highlight keyword feature

---
 dist/tablefilter/style/colsVisibility.css     |    4 +-
 dist/tablefilter/style/filtersVisibility.css  |    4 +-
 dist/tablefilter/style/tablefilter.css        |    4 +-
 .../style/themes/default/default.css          |    4 +-
 .../style/themes/mytheme/mytheme.css          |    4 +-
 .../style/themes/skyblue/skyblue.css          |    4 +-
 dist/tablefilter/tablefilter.js               | 7673 ++++++++++++++++-
 dist/tablefilter/tf-1.js                      | 2224 ++++-
 src/modules/highlightKeywords.js              |    9 +
 src/tablefilter.js                            |    7 +-
 10 files changed, 9906 insertions(+), 31 deletions(-)

diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index b65b0160..2265d0c6 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-28T06:48:43.448Z 
+ *	 tablefilter v0.1.1 by Max Guglielmi 
+ *	 build date: 2015-12-29T06:10:22.693Z 
  *	 MIT License  
  */ 
 span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
\ No newline at end of file
diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css
index 15eac1cd..9c286a3b 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-28T06:48:43.448Z 
+ *	 tablefilter v0.1.1 by Max Guglielmi 
+ *	 build date: 2015-12-29T06:10:22.693Z 
  *	 MIT License  
  */ 
 span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
\ No newline at end of file
diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css
index 43d297fe..c7f4a680 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-28T06:48:43.448Z 
+ *	 tablefilter v0.1.1 by Max Guglielmi 
+ *	 build date: 2015-12-29T06:10:22.693Z 
  *	 MIT License  
  */ 
 .activeHeader{background-color:#66afe9 !important;color:#fff !important}
diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css
index 09154d01..b6adbdee 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-28T06:48:43.448Z 
+ *	 tablefilter v0.1.1 by Max Guglielmi 
+ *	 build date: 2015-12-29T06:10:22.693Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css
index b3affa24..f8aaa87d 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-28T06:48:43.448Z 
+ *	 tablefilter v0.1.1 by Max Guglielmi 
+ *	 build date: 2015-12-29T06:10:22.693Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css
index 6a9adbbd..93717009 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.0 by Max Guglielmi 
- *	 build date: 2015-12-28T06:48:43.448Z 
+ *	 tablefilter v0.1.1 by Max Guglielmi 
+ *	 build date: 2015-12-29T06:10:22.693Z 
  *	 MIT License  
  */ 
 table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
index 40298dca..c9ddad7b 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -1,10 +1,7665 @@
-/** 
- *	 tablefilter v0.1.0 by Max Guglielmi
- *	 build date: 2015-12-28T06:48:43.385Z 
- *	 MIT License  
- */ 
+(function webpackUniversalModuleDefinition(root, factory) {
+	if(typeof exports === 'object' && typeof module === 'object')
+		module.exports = factory();
+	else if(typeof define === 'function' && define.amd)
+		define([], factory);
+	else {
+		var a = factory();
+		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
+	}
+})(this, function() {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ 	// install a JSONP callback for chunk loading
+/******/ 	var parentJsonpFunction = window["webpackJsonp"];
+/******/ 	window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
+/******/ 		// add "moreModules" to the modules object,
+/******/ 		// then flag all "chunkIds" as loaded and fire callback
+/******/ 		var moduleId, chunkId, i = 0, callbacks = [];
+/******/ 		for(;i < chunkIds.length; i++) {
+/******/ 			chunkId = chunkIds[i];
+/******/ 			if(installedChunks[chunkId])
+/******/ 				callbacks.push.apply(callbacks, installedChunks[chunkId]);
+/******/ 			installedChunks[chunkId] = 0;
+/******/ 		}
+/******/ 		for(moduleId in moreModules) {
+/******/ 			modules[moduleId] = moreModules[moduleId];
+/******/ 		}
+/******/ 		if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
+/******/ 		while(callbacks.length)
+/******/ 			callbacks.shift().call(null, __webpack_require__);
+/******/
+/******/ 	};
+/******/
+/******/ 	// The module cache
+/******/ 	var installedModules = {};
+/******/
+/******/ 	// object to store loaded and loading chunks
+/******/ 	// "0" means "already loaded"
+/******/ 	// Array means "loading", array contains callbacks
+/******/ 	var installedChunks = {
+/******/ 		0:0
+/******/ 	};
+/******/
+/******/ 	// The require function
+/******/ 	function __webpack_require__(moduleId) {
+/******/
+/******/ 		// Check if module is in cache
+/******/ 		if(installedModules[moduleId])
+/******/ 			return installedModules[moduleId].exports;
+/******/
+/******/ 		// Create a new module (and put it into the cache)
+/******/ 		var module = installedModules[moduleId] = {
+/******/ 			exports: {},
+/******/ 			id: moduleId,
+/******/ 			loaded: false
+/******/ 		};
+/******/
+/******/ 		// Execute the module function
+/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ 		// Flag the module as loaded
+/******/ 		module.loaded = true;
+/******/
+/******/ 		// Return the exports of the module
+/******/ 		return module.exports;
+/******/ 	}
+/******/
+/******/ 	// This file contains only the entry chunk.
+/******/ 	// The chunk loading function for additional chunks
+/******/ 	__webpack_require__.e = function requireEnsure(chunkId, callback) {
+/******/ 		// "0" is the signal for "already loaded"
+/******/ 		if(installedChunks[chunkId] === 0)
+/******/ 			return callback.call(null, __webpack_require__);
+/******/
+/******/ 		// an array means "currently loading".
+/******/ 		if(installedChunks[chunkId] !== undefined) {
+/******/ 			installedChunks[chunkId].push(callback);
+/******/ 		} else {
+/******/ 			// start chunk loading
+/******/ 			installedChunks[chunkId] = [callback];
+/******/ 			var head = document.getElementsByTagName('head')[0];
+/******/ 			var script = document.createElement('script');
+/******/ 			script.type = 'text/javascript';
+/******/ 			script.charset = 'utf-8';
+/******/ 			script.async = true;
+/******/
+/******/ 			script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js";
+/******/ 			head.appendChild(script);
+/******/ 		}
+/******/ 	};
+/******/
+/******/ 	// expose the modules object (__webpack_modules__)
+/******/ 	__webpack_require__.m = modules;
+/******/
+/******/ 	// expose the module cache
+/******/ 	__webpack_require__.c = installedModules;
+/******/
+/******/ 	// __webpack_public_path__
+/******/ 	__webpack_require__.p = "";
+/******/
+/******/ 	// Load entry module and return exports
+/******/ 	return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
 
-!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var a=s[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var n,r,o=0,h=[];on;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.0",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":a(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),a=s._ezEditTable;s.cfg.editable&&a.Editable.Remove(),s.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this)),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,a,l);break;case e.checklist:r.checkList._build(s,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,a=i.slcExternal,l=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,a=t.path,l=void 0;s&&a?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var a=[i(26)("./"+l)];(function(i){var a=new i["default"](e,t);a.init(),e.ExtRegistry[s]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],a=this.ExtRegistry[s.name];a&&(a.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var a=t[i],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&this.clearActiveColumns(),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],a=u["default"].id(s);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],a=[],l=i.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(a.sort(),s.sort()),[a,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(i)),""!==a&&s.highlightKeyword.highlight(i,a,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=a(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)s=l<=a(t.replace(r,""),n);else if(T)s=l>=a(t.replace(o,""),n);else if(u)s=la(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,a=0;this.validRowsIndex=[],this.highlightKeywords&&s.highlightKeyword.unhighlightAll(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.popupFilters&&s.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&F&&(P=!0),P?(this.validateRow(x,!0),this.validRowsIndex.push(x),this.alternateRows&&s.alternateRows.setRowBg(x,this.validRowsIndex.length),this.onRowValidated&&this.onRowValidated.call(null,this,x)):(this.validateRow(x,!1),s.alternateRows&&s.alternateRows.removeRowBg(x),this.hasVisibleRows&&-1!==this.visibleRows.indexOf(x)?this.validRowsIndex.push(x):a++)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n)); -var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var a=0,l=i.options.length;l>a;a++)i.options[a].selected&&(e=e.concat(i.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,a=this.fltIds.length;a>s;s++){var l=this.getFilterType(s);if(l===f["default"].lower(t)){var n=e?s:this.fltIds[s];i.push(n)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sn;n++){var o=this.getCellData(l[n]);a[1].push(o)}i.push(a)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),a=0;aa;a++){var n=i[a],r=n[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",a=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",a)}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),a=s.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=s[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=i[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("cleared-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=s.length;r>n;n++){var o=u["default"].id(this.fltIds[s[n]]);if(l=this.getFilterValue(s[n]),a!==s[n]||this.paging&&-1!=t.indexOf(s[n])&&a===s[n]||!this.paging&&(-1!=i.indexOf(s[n])||-1!=e.indexOf(s[n]))||l===this.displayAllText){if(-1!=i.indexOf(s[n])?this.Mod.checkList.checkListDiv[s[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[n])?this.Mod.checkList._build(s[n]):this.Mod.dropdown._build(s[n],!0),this.setFilterValue(s[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,a=i[s];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",a="script"==s?"src":"href",l=u["default"].tag(H,s),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var a=s?s:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var a=0;a0){var s=document.cookie,a=s.indexOf(i);if(-1!==a){a+=i.length;var l=s.indexOf(";",a);-1===l&&(l=s.length),e=unescape(s.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,a=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0])}return a}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,a=parseInt(s.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,i,s,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var i=0;i_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,a=this.addTChecks(t,e),l=[],n=s.feature("store"),o=n?n.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),l=a+s.pagingLength-1<=e.nbVisibleRows?a+s.pagingLength-1:e.nbVisibleRows;i=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var a=i.refRow,r=i.nbRows;i.nbPages=Math.ceil((r-a)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,i=e.tbl.rows,s=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(s.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=s[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&i&&i.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&i&&i.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":a(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),a=d["default"].id(this.prfxBtnLastSpan+e.id),l=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),a&&(b["default"].remove(a,"click",h.last),d["default"].remove(a)),l&&(b["default"].remove(l,"click",h.first),d["default"].remove(l)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var a=i.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;in;n++){var r=i?n:e[n];this.setRowBg(r,l),l++}this.initialized=!0}}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){if(this.initialized){for(var t=this.tf.refRow;t0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + // Features + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.TableFilter = undefined; + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + var _emitter = __webpack_require__(9); + + var _store = __webpack_require__(10); + + var _gridLayout = __webpack_require__(11); + + var _loader = __webpack_require__(13); + + var _highlightKeywords = __webpack_require__(14); + + var _popupFilter = __webpack_require__(15); + + var _dropdown = __webpack_require__(16); + + var _checkList = __webpack_require__(18); + + var _rowsCounter = __webpack_require__(19); + + var _statusBar = __webpack_require__(20); + + var _paging = __webpack_require__(21); + + var _clearButton = __webpack_require__(22); + + var _help = __webpack_require__(23); + + var _alternateRows = __webpack_require__(24); + + var _noResults = __webpack_require__(25); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var global = window, + doc = global.document; + + var TableFilter = exports.TableFilter = (function () { + + /** + * TableFilter object constructor + * requires `table` or `id` arguments, `row` and `configuration` optional + * @param {DOMElement} table Table DOM element + * @param {String} id Table id + * @param {Number} row index indicating the 1st row + * @param {Object} configuration object + */ + + function TableFilter() { + var _this = this; + + _classCallCheck(this, TableFilter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (args.length === 0) { + return; + } + + this.id = null; + this.version = '0.1.1'; + this.year = new Date().getFullYear(); + this.tbl = null; + this.startRow = null; + this.refRow = null; + this.headersRow = null; + this.cfg = {}; + this.nbFilterableRows = null; + this.nbRows = null; + this.nbCells = null; + this._hasGrid = false; + + // TODO: use for-of with babel plug-in + args.forEach(function (arg) { + // for (let arg of args) { + var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); + if (argtype === 'object' && arg && arg.nodeName === 'TABLE') { + _this.tbl = arg; + _this.id = arg.id || 'tf_' + new Date().getTime() + '_'; + } else if (argtype === 'string') { + _this.id = arg; + _this.tbl = _dom2.default.id(arg); + } else if (argtype === 'number') { + _this.startRow = arg; + } else if (argtype === 'object') { + _this.cfg = arg; + } + // } + }); + + if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) { + throw new Error('Could not instantiate TableFilter: HTML table not found.'); + } + + // configuration object + var f = this.cfg; + + this.emitter = new _emitter.Emitter(); + + //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 || 'tablefilter/'; + + /*** filter types ***/ + this.fltTypeInp = 'input'; + this.fltTypeSlc = 'select'; + this.fltTypeMulti = 'multiple'; + this.fltTypeCheckList = 'checklist'; + this.fltTypeNone = 'none'; + + /*** filters' grid properties ***/ + + //enables/disables filter grid + this.fltGrid = f.grid === false ? false : true; + + //enables/disables grid layout (fixed headers) + this.gridLayout = Boolean(f.grid_layout); + + this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index; + this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index; + + 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 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; + + //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.stylePath = f.style_path || this.basePath + 'style/'; + this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows); + //defines widths of columns + this.hasColWidths = _types2.default.isArray(f.col_widths); + this.colWidths = this.hasColWidths ? f.col_widths : null; + //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'; + + /*** filters' grid behaviours ***/ + //enables/disables enter key + this.enterKey = f.enter_key === false ? false : true; + //calls function before filtering starts + this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null; + //calls function after filtering + this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null; + //enables/disables case sensitivity + this.caseSensitive = Boolean(f.case_sensitive); + //has exact match per column + this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match); + this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : []; + //enables/disbles exact match for search + this.exactMatch = Boolean(f.exact_match); + //refreshes drop-down lists upon validation + this.linkedFilters = Boolean(f.linked_filters); + //wheter excluded options are disabled + this.disableExcludedOptions = Boolean(f.disable_excluded_options); + //stores active filter element + this.activeFlt = null; + //id of active filter + this.activeFilterId = null; + //enables always visible rows + this.hasVisibleRows = Boolean(f.rows_always_visible); + //array containing always visible rows + this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; + //enables/disables external filters generation + this.isExternalFlt = Boolean(f.external_flt_grid); + //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null; + //enables/disables single filter search + this.singleSearchFlt = Boolean(f.single_filter); + //calls function after row is validated + this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null; + //input watermark text array + this.watermark = f.watermark || ''; + this.isWatermarkArray = _types2.default.isArray(this.watermark); + //id of toolbar container element + this.toolBarTgtId = f.toolbar_target_id || null; + //enables/disables help div + this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions); + //popup filters + this.popupFilters = Boolean(f.popup_filters); + //active columns color + this.markActiveColumns = Boolean(f.mark_active_columns); + //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null; + //calls function after active column header is marked + this.onAfterActiveColumn = _types2.default.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 || 'Clear'; + //enables/disables empty option in combo-box filters + this.enableEmptyOption = Boolean(f.enable_empty_option); + //defines empty option text + this.emptyText = f.empty_text || '(Empty)'; + //enables/disables non empty option in combo-box filters + this.enableNonEmptyOption = Boolean(f.enable_non_empty_option); + //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 = Boolean(f.sort_num_asc); + this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null; + //enables/disables descending numeric options sorting + this.isSortNumDesc = Boolean(f.sort_num_desc); + this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null; + //Select filters are populated on demand + this.loadFltOnDemand = Boolean(f.load_filters_on_demand); + this.hasCustomOptions = _types2.default.isObj(f.custom_options); + this.customOptions = f.custom_options; + + /*** 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 || '^[¥£€$]'; + this.separator = f.separator || ','; + + /*** rows counter ***/ + //show/hides rows counter + this.rowsCounter = Boolean(f.rows_counter); + + /*** status bar ***/ + //show/hides status bar + this.statusBar = Boolean(f.status_bar); + + /*** loader ***/ + //enables/disables loader/spinner indicator + this.loader = Boolean(f.loader); + + /*** validation - reset buttons/links ***/ + //show/hides filter's validation button + this.displayBtn = Boolean(f.btn); + //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 = Boolean(f.btn_reset); + //defines css class for reset button + this.btnResetCssClass = f.btn_reset_css_class || 'reset'; + //callback function before filters are cleared + this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null; + //callback function after filters are cleared + this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null; + + /*** paging ***/ + //enables/disables table paging + this.paging = Boolean(f.paging); + this.nbVisibleRows = 0; //nb visible rows + this.nbHiddenRows = 0; //nb hidden rows + + /*** autofilter on typing ***/ + //enables/disables auto filtering, table is filtered when user stops + //typing + this.autoFilter = Boolean(f.auto_filter); + //onkeyup delay timer (msecs) + this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900; + //typing indicator + this.isUserTyping = null; + this.autoFilterTimer = null; + + /*** keyword highlighting ***/ + //enables/disables keyword highlighting + this.highlightKeywords = Boolean(f.highlight_keywords); + + /*** No results feature ***/ + this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message); + + /*** 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 = _types2.default.isArray(f.col_number_format); + //array containing columns nb formats + this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null; + //enables date type per column + this.hasColDateType = _types2.default.isArray(f.col_date_type); + //array containing columns date type + this.colDateType = 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_'; + //filter values cookie + this.prfxCookieFltsValues = 'tf_flts_'; + //page nb cookie + this.prfxCookiePageNb = 'tf_pgnb_'; + //page length cookie + this.prfxCookiePageLen = 'tf_pglen_'; + + /*** cookies ***/ + this.hasStoredValues = false; + //remembers filters values on page load + this.rememberGridValues = Boolean(f.remember_grid_values); + //cookie storing filter values + this.fltsValuesCookie = this.prfxCookieFltsValues + this.id; + //remembers page nb on page load + this.rememberPageNb = this.paging && f.remember_page_number; + //cookie storing page nb + this.pgNbCookie = this.prfxCookiePageNb + this.id; + //remembers page length on page load + this.rememberPageLen = this.paging && f.remember_page_length; + //cookie storing page length + this.pgLenCookie = this.prfxCookiePageLen + this.id; + + /*** extensions ***/ + //imports external script + this.extensions = f.extensions; + this.hasExtensions = _types2.default.isArray(this.extensions); + + /*** themes ***/ + this.enableDefaultTheme = Boolean(f.enable_default_theme); + //imports themes + this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes); + this.themes = f.themes || []; + //themes path + this.themesPath = f.themes_path || this.stylePath + 'themes/'; + + // Features registry + this.Mod = {}; + + // Extensions registry + this.ExtRegistry = {}; + + /*** TF events ***/ + this.Evt = { + name: { + filter: 'Filter', + dropdown: 'DropDown', + checklist: 'CheckList', + changepage: 'ChangePage', + clear: 'Clear', + changeresultsperpage: 'ChangeResults', + resetvalues: 'ResetValues', + resetpage: 'ResetPage', + resetpagelength: 'ResetPageLength', + loadextensions: 'LoadExtensions', + loadthemes: 'LoadThemes' + }, + + // Detect key + detectKey: function detectKey(e) { + if (!this.enterKey) { + return; + } + var _ev = e || global.event; + if (_ev) { + var key = _event2.default.keyCode(_ev); + if (key === 13) { + this.filter(); + _event2.default.cancel(_ev); + _event2.default.stop(_ev); + } else { + this.isUserTyping = true; + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + } + }, + + // if auto-filter on, detect user is typing and filter columns + onKeyUp: function onKeyUp(e) { + if (!this.autoFilter) { + return; + } + var _ev = e || global.event; + var key = _event2.default.keyCode(_ev); + this.isUserTyping = false; + + function filter() { + /*jshint validthis:true */ + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + if (!this.isUserTyping) { + this.filter(); + this.isUserTyping = null; + } + } + + if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) { + if (this.autoFilterTimer === null) { + this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay); + } + } else { + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + }, + + // if auto-filter on, detect user is typing + onKeyDown: function onKeyDown() { + if (!this.autoFilter) { + return; + } + this.isUserTyping = true; + }, + + // if auto-filter on, clear interval on filter blur + onInpBlur: function onInpBlur() { + if (this.autoFilter) { + this.isUserTyping = false; + global.clearInterval(this.autoFilterTimer); + } + // TODO: hack to prevent ezEditTable enter key event hijaking. + // Needs to be fixed in the vendor's library + if (this.hasExtension('advancedGrid')) { + var advGrid = this.extension('advancedGrid'); + var ezEditTable = advGrid._ezEditTable; + if (advGrid.cfg.editable) { + ezEditTable.Editable.Set(); + } + if (advGrid.cfg.selection) { + ezEditTable.Selection.Set(); + } + } + }, + + // set focused text-box filter as active + onInpFocus: function onInpFocus(e) { + var _ev = e || global.event; + var elm = _event2.default.target(_ev); + this.activeFilterId = elm.getAttribute('id'); + this.activeFlt = _dom2.default.id(this.activeFilterId); + if (this.popupFilters) { + _event2.default.cancel(_ev); + _event2.default.stop(_ev); + } + // TODO: hack to prevent ezEditTable enter key event hijaking. + // Needs to be fixed in the vendor's library + if (this.hasExtension('advancedGrid')) { + var advGrid = this.extension('advancedGrid'); + var ezEditTable = advGrid._ezEditTable; + if (advGrid.cfg.editable) { + ezEditTable.Editable.Remove(); + } + if (advGrid.cfg.selection) { + ezEditTable.Selection.Remove(); + } + } + }, + + // set focused drop-down filter as active + onSlcFocus: function onSlcFocus(e) { + var _ev = e || global.event; + var elm = _event2.default.target(_ev); + this.activeFilterId = elm.getAttribute('id'); + this.activeFlt = _dom2.default.id(this.activeFilterId); + // select is populated when element has focus + if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + this.Mod.dropdown._build(ct); + } + if (this.popupFilters) { + _event2.default.cancel(_ev); + _event2.default.stop(_ev); + } + }, + + // filter columns on drop-down filter change + onSlcChange: function onSlcChange(e) { + if (!this.activeFlt) { + return; + } + var _ev = e || global.event; + if (this.popupFilters) { + _event2.default.stop(_ev); + } + if (this.onSlcChange) { + this.filter(); + } + }, + + // fill checklist filter on click if required + onCheckListClick: function onCheckListClick(e) { + var _ev = e || global.event; + var elm = _event2.default.target(_ev); + if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + this.Mod.checkList._build(ct); + this.Mod.checkList.checkListDiv[ct].onclick = null; + this.Mod.checkList.checkListDiv[ct].title = ''; + } + } + }; + } + + /** + * Initialise filtering grid bar behaviours and layout + * + * TODO: decompose in smaller methods + */ + + _createClass(TableFilter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this._hasGrid) { + return; + } + if (!this.tbl) { + this.tbl = _dom2.default.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 Mod = this.Mod; + var n = this.singleSearchFlt ? 1 : this.nbCells, + inpclass = undefined; + + //loads stylesheet if not imported + this.import(this.stylesheetId, this.stylesheet, null, 'link'); + + //loads theme + if (this.hasThemes) { + this._loadThemes(); + } + + if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { + Mod.store = new _store.Store(this); + Mod.store.init(); + } + + if (this.gridLayout) { + Mod.gridLayout = new _gridLayout.GridLayout(this); + Mod.gridLayout.init(); + } + + if (this.loader) { + if (!Mod.loader) { + Mod.loader = new _loader.Loader(this); + } + Mod.loader.init(); + } + + if (this.highlightKeywords) { + Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this); + Mod.highlightKeyword.init(); + } + + if (this.popupFilters) { + if (!Mod.popupFilter) { + Mod.popupFilter = new _popupFilter.PopupFilter(this); + } + Mod.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 = undefined; + if (!this.gridLayout) { + var thead = _dom2.default.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.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) { + Mod.popupFilter.build(i); + } + + var fltcell = _dom2.default.create(this.fltCellTag), + col = this.getFilterType(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; + + //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 (!Mod.dropdown) { + Mod.dropdown = new _dropdown.Dropdown(this); + } + var dropdown = Mod.dropdown; + + var slc = _dom2.default.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 = _string2.default.lower(col) === this.fltTypeSlc ? inpclass : this.fltMultiCssClass; + + //filter is appended in desired external element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(slc); + this.externalFltEls.push(slc); + } else { + fltcell.appendChild(slc); + } + + this.fltIds.push(this.prfxFlt + i + '_' + this.id); + + if (!this.loadFltOnDemand) { + dropdown._build(i); + } + + _event2.default.add(slc, 'keypress', this.Evt.detectKey.bind(this)); + _event2.default.add(slc, 'change', this.Evt.onSlcChange.bind(this)); + _event2.default.add(slc, 'focus', this.Evt.onSlcFocus.bind(this)); + + //1st option is created here since dropdown.build isn't + //invoked + if (this.loadFltOnDemand) { + var opt0 = _dom2.default.createOpt(this.displayAllText, ''); + slc.appendChild(opt0); + } + } + // checklist + else if (col === this.fltTypeCheckList) { + var checkList = undefined; + Mod.checkList = new _checkList.CheckList(this); + checkList = Mod.checkList; + + var divCont = _dom2.default.create('div', ['id', checkList.prfxCheckListDiv + i + '_' + this.id], ['ct', i], ['filled', '0']); + divCont.className = checkList.checkListDivCssClass; + + //filter is appended in desired element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(divCont); + this.externalFltEls.push(divCont); + } else { + fltcell.appendChild(divCont); + } + + checkList.checkListDiv[i] = divCont; + this.fltIds.push(this.prfxFlt + i + '_' + this.id); + if (!this.loadFltOnDemand) { + checkList._build(i); + } + + if (this.loadFltOnDemand) { + _event2.default.add(divCont, 'click', this.Evt.onCheckListClick.bind(this)); + divCont.appendChild(_dom2.default.text(checkList.activateCheckListTxt)); + } + } else { + //show/hide input + var inptype = col === this.fltTypeInp ? 'text' : 'hidden'; + var inp = _dom2.default.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; + _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this)); + + //filter is appended in desired element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(inp); + this.externalFltEls.push(inp); + } else { + fltcell.appendChild(inp); + } + + this.fltIds.push(this.prfxFlt + i + '_' + this.id); + + _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this)); + _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this)); + _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this)); + _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this)); + + if (this.rememberGridValues) { + var flts_values = this.Mod.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 = _dom2.default.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) { + _dom2.default.id(externalFltTgtId).appendChild(btn); + } else { + fltcell.appendChild(btn); + } + + _event2.default.add(btn, 'click', function () { + return _this2.filter(); + }); + } //if + } // for i + } else { + this._resetGrid(); + } //if isFirstLoad + } //if this.fltGrid + + /* Features */ + if (this.hasVisibleRows) { + this.emitter.on('after-filtering', function () { + return _this2.enforceVisibility(); + }); + this.enforceVisibility(); + } + if (this.rowsCounter) { + Mod.rowsCounter = new _rowsCounter.RowsCounter(this); + Mod.rowsCounter.init(); + } + if (this.statusBar) { + Mod.statusBar = new _statusBar.StatusBar(this); + Mod.statusBar.init(); + } + if (this.paging || Mod.paging) { + if (!Mod.paging) { + Mod.paging = new _paging.Paging(this); + Mod.paging.init(); + } + Mod.paging.reset(); + } + if (this.btnReset) { + Mod.clearButton = new _clearButton.ClearButton(this); + Mod.clearButton.init(); + } + if (this.help) { + if (!Mod.help) { + Mod.help = new _help.Help(this); + } + Mod.help.init(); + } + if (this.hasColWidths && !this.gridLayout) { + this.setColWidths(); + } + if (this.alternateRows) { + Mod.alternateRows = new _alternateRows.AlternateRows(this); + Mod.alternateRows.init(); + } + if (this.noResults) { + if (!Mod.noResults) { + Mod.noResults = new _noResults.NoResults(this); + } + Mod.noResults.init(); + } + + 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) { + _dom2.default.addClass(this.tbl, this.prfxTf); + } + + if (this.loader) { + Mod.loader.show('none'); + } + + /* Loads extensions */ + if (this.hasExtensions) { + this.initExtensions(); + } + + // Subscribe to event + if (this.linkedFilters) { + this.emitter.on('after-filtering', function () { + return _this2.linkFilters(); + }); + } + + if (this.onFiltersLoaded) { + this.onFiltersLoaded.call(null, this); + } + + this.emitter.emit('initialized', this); + } + + /** + * Manages state messages + * @param {String} evt Event name + * @param {Object} cfg Config object + */ + + }, { + key: 'EvtManager', + value: function EvtManager(evt) { + var cfg = arguments.length <= 1 || arguments[1] === undefined ? { slcIndex: null, slcExternal: false, slcId: null, pgIndex: null } : arguments[1]; + + var slcIndex = cfg.slcIndex; + var slcExternal = cfg.slcExternal; + var slcId = cfg.slcId; + var pgIndex = cfg.pgIndex; + var cpt = this.Mod; + + function efx() { + /*jshint validthis:true */ + var ev = this.Evt.name; + + switch (evt) { + case ev.filter: + this._filter(); + break; + case ev.dropdown: + if (this.linkedFilters) { + cpt.dropdown._build(slcIndex, true); + } else { + cpt.dropdown._build(slcIndex, false, slcExternal, slcId); + } + break; + case ev.checklist: + cpt.checkList._build(slcIndex, slcExternal, slcId); + break; + case ev.changepage: + cpt.paging._changePage(pgIndex); + break; + case ev.clear: + this._clearFilters(); + this._filter(); + break; + case ev.changeresultsperpage: + cpt.paging._changeResultsPerPage(); + break; + case ev.resetvalues: + this._resetValues(); + this._filter(); + break; + case ev.resetpage: + cpt.paging._resetPage(this.pgNbCookie); + break; + case ev.resetpagelength: + cpt.paging._resetPageLength(this.pgLenCookie); + break; + case ev.loadextensions: + this._loadExtensions(); + break; + case ev.loadthemes: + this._loadThemes(); + break; + } + if (this.statusBar) { + cpt.statusBar.message(''); + } + if (this.loader) { + cpt.loader.show('none'); + } + } + + if (!this.loader && !this.statusBar && !this.linkedFilters) { + efx.call(this); + } else { + if (this.loader) { + cpt.loader.show(''); + } + if (this.statusBar) { + cpt.statusBar.message(this['msg' + evt]); + } + global.setTimeout(efx.bind(this), this.execDelay); + } + } + + /** + * Return a feature instance for a given name + * @param {String} name Name of the feature + * @return {Object} + */ + + }, { + key: 'feature', + value: function feature(name) { + return this.Mod[name]; + } + + /** + * Initialise all the extensions defined in the configuration object + */ + + }, { + key: 'initExtensions', + value: function initExtensions() { + var exts = this.extensions; + + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + if (!this.ExtRegistry[ext.name]) { + this.loadExtension(ext); + } + } + } + + /** + * Load an extension module + * @param {Object} ext Extension config object + */ + + }, { + key: 'loadExtension', + value: function loadExtension(ext) { + var _this3 = this; + + if (!ext || !ext.name) { + return; + } + + var name = ext.name; + var path = ext.path; + var modulePath = undefined; + + if (name && path) { + modulePath = ext.path + name; + } else { + name = name.replace('.js', ''); + modulePath = 'extensions/{}/{}'.replace(/{}/g, name); + } + + // Trick to set config's publicPath dynamically for Webpack... + __webpack_require__.p = this.basePath; + + __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) { + var inst = new mod.default(_this3, ext); + inst.init(); + _this3.ExtRegistry[name] = inst; + }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}); + } + + /** + * Get an extension instance + * @param {String} name Name of the extension + * @return {Object} Extension instance + */ + + }, { + key: 'extension', + value: function extension(name) { + return this.ExtRegistry[name]; + } + + /** + * Check passed extension name exists + * @param {String} name Name of the extension + * @return {Boolean} + */ + + }, { + key: 'hasExtension', + value: function hasExtension(name) { + return !_types2.default.isEmpty(this.ExtRegistry[name]); + } + + /** + * Destroy all the extensions defined in the configuration object + */ + + }, { + key: 'destroyExtensions', + value: function destroyExtensions() { + var exts = this.extensions; + + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + var extInstance = this.ExtRegistry[ext.name]; + if (extInstance) { + extInstance.destroy(); + this.ExtRegistry[ext.name] = null; + } + } + } + }, { + key: 'loadThemes', + value: function loadThemes() { + this.EvtManager(this.Evt.name.loadthemes); + } + + /** + * Load themes defined in the configuration object + */ + + }, { + key: '_loadThemes', + value: function _loadThemes() { + var themes = this.themes; + //Default theme config + if (this.enableDefaultTheme) { + var defaultTheme = { name: 'default' }; + this.themes.push(defaultTheme); + } + if (_types2.default.isArray(themes)) { + for (var i = 0, len = themes.length; i < len; i++) { + var theme = themes[i]; + var name = theme.name; + var path = theme.path; + var styleId = this.prfxTf + name; + if (name && !path) { + path = this.themesPath + name + '/' + name + '.css'; + } else if (!name && theme.path) { + name = 'theme{0}'.replace('{0}', i); + } + + if (!this.isImported(path, 'link')) { + this.import(styleId, path, null, 'link'); + } + } + } + + //Some elements need to be overriden for default 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; + } + + /** + * Return stylesheet DOM element for a given theme name + * @return {DOMElement} stylesheet element + */ + + }, { + key: 'getStylesheet', + value: function getStylesheet() { + var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; + + return _dom2.default.id(this.prfxTf + name); + } + + /** + * Destroy filter grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + if (!this._hasGrid) { + return; + } + var rows = this.tbl.rows, + Mod = this.Mod; + + this._clearFilters(); + + if (this.isExternalFlt && !this.popupFilters) { + this.removeExternalFlts(); + } + if (this.infDiv) { + this.removeToolbar(); + } + if (this.highlightKeywords) { + Mod.highlightKeyword.unhighlightAll(); + } + if (this.markActiveColumns) { + this.clearActiveColumns(); + } + if (this.hasExtensions) { + this.destroyExtensions(); + } + + for (var j = this.refRow; j < this.nbRows; j++) { + // validate row + this.validateRow(j, true); + + //removes alternating colors + if (this.alternateRows) { + Mod.alternateRows.removeRowBg(j); + } + } //for j + + if (this.fltGrid && !this.gridLayout) { + this.fltGridEl = rows[this.filtersRowIndex]; + this.tbl.deleteRow(this.filtersRowIndex); + } + + // Destroy modules + Object.keys(Mod).forEach(function (key) { + var feature = Mod[key]; + if (feature && _types2.default.isFn(feature.destroy)) { + feature.destroy(); + } + }); + + // unsubscribe to events + if (this.hasVisibleRows) { + this.emitter.off('after-filtering', function () { + return _this4.enforceVisibility(); + }); + } + if (this.linkedFilters) { + this.emitter.off('after-filtering', function () { + return _this4.linkFilters(); + }); + } + + _dom2.default.removeClass(this.tbl, this.prfxTf); + this.nbHiddenRows = 0; + this.validRowsIndex = null; + this.activeFlt = null; + this._hasGrid = false; + this.tbl = null; + } + + /** + * Generate container element for paging, reset button, rows counter etc. + */ + + }, { + key: 'setToolbar', + value: function setToolbar() { + if (this.infDiv) { + return; + } + + /*** container div ***/ + var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); + infdiv.className = this.infDivCssClass; + + //custom container + if (this.toolBarTgtId) { + _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); + } + //grid-layout + else if (this.gridLayout) { + var gridLayout = this.Mod.gridLayout; + gridLayout.tblMainCont.appendChild(infdiv); + infdiv.className = gridLayout.gridInfDivCssClass; + } + //default location: just above the table + else { + var cont = _dom2.default.create('caption'); + cont.appendChild(infdiv); + this.tbl.insertBefore(cont, this.tbl.firstChild); + } + this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); + + /*** left div containing rows # displayer ***/ + var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); + ldiv.className = this.lDivCssClass; + infdiv.appendChild(ldiv); + this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); + + /*** right div containing reset button + + nb results per page select ***/ + var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); + rdiv.className = this.rDivCssClass; + infdiv.appendChild(rdiv); + this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); + + /*** mid div containing paging elements ***/ + var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); + mdiv.className = this.mDivCssClass; + infdiv.appendChild(mdiv); + this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); + + // Enable help instructions by default if topbar is generated and not + // explicitely set to false + if (_types2.default.isUndef(this.help)) { + if (!this.Mod.help) { + this.Mod.help = new _help.Help(this); + } + this.Mod.help.init(); + this.help = true; + } + } + + /** + * Remove toolbar container element + */ + + }, { + key: 'removeToolbar', + value: function removeToolbar() { + if (!this.infDiv) { + return; + } + _dom2.default.remove(this.infDiv); + this.infDiv = null; + + var tbl = this.tbl; + var captions = _dom2.default.tag(tbl, 'caption'); + if (captions.length > 0) { + [].forEach.call(captions, function (elm) { + tbl.removeChild(elm); + }); + } + } + + /** + * Remove all the external column filters + */ + + }, { + key: 'removeExternalFlts', + value: function removeExternalFlts() { + if (!this.isExternalFlt || !this.externalFltTgtIds) { + return; + } + var ids = this.externalFltTgtIds, + len = ids.length; + for (var ct = 0; ct < len; ct++) { + var externalFltTgtId = ids[ct], + externalFlt = _dom2.default.id(externalFltTgtId); + if (externalFlt) { + externalFlt.innerHTML = ''; + } + } + } + + /** + * Check if given column implements a filter with custom options + * @param {Number} colIndex Column's index + * @return {Boolean} + */ + + }, { + key: 'isCustomOptions', + value: function isCustomOptions(colIndex) { + return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; + } + + /** + * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the + * custom options values and texts + * @param {Number} colIndex Column's index + * @return {Array} + */ + + }, { + key: 'getCustomOptions', + value: function getCustomOptions(colIndex) { + if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { + return; + } + + var customOptions = this.customOptions; + var cols = customOptions.cols; + var optTxt = [], + optArray = []; + var index = cols.indexOf(colIndex); + var slcValues = customOptions.values[index]; + var slcTexts = customOptions.texts[index]; + var slcSort = customOptions.sorts[index]; + + for (var r = 0, len = slcValues.length; r < len; r++) { + optArray.push(slcValues[r]); + if (slcTexts[r]) { + optTxt.push(slcTexts[r]); + } else { + optTxt.push(slcValues[r]); + } + } + if (slcSort) { + optArray.sort(); + optTxt.sort(); + } + return [optArray, optTxt]; + } + }, { + key: 'resetValues', + value: function resetValues() { + this.EvtManager(this.Evt.name.resetvalues); + } + + /** + * Reset persisted filter values + */ + + }, { + key: '_resetValues', + value: function _resetValues() { + //only loadFltOnDemand + if (this.rememberGridValues && this.loadFltOnDemand) { + this._resetGridValues(this.fltsValuesCookie); + } + if (this.rememberPageLen && this.Mod.paging) { + this.Mod.paging.resetPageLength(this.pgLenCookie); + } + if (this.rememberPageNb && this.Mod.paging) { + this.Mod.paging.resetPage(this.pgNbCookie); + } + } + + /** + * Reset persisted filter values when load filters on demand feature is + * enabled + * @param {String} name cookie name storing filter values + */ + + }, { + key: '_resetGridValues', + value: function _resetGridValues(name) { + if (!this.loadFltOnDemand) { + return; + } + var fltsValues = this.Mod.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 = undefined, + opt = undefined; + var fltType = this.getFilterType(i); + // if loadFltOnDemand, drop-down needs to contain stored + // value(s) for filtering + if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { + var slc = _dom2.default.id(this.fltIds[i]); + slc.options[0].selected = false; + + //selects + if (slcFltsIndex.indexOf(i) != -1) { + opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + //multiple select + if (multiFltsIndex.indexOf(i) != -1) { + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + opt = _dom2.default.createOpt(s[j], s[j], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + } // if multiFltsIndex + } else if (fltType === this.fltTypeCheckList) { + var checkList = this.Mod.checkList; + var divChk = checkList.checkListDiv[i]; + divChk.title = divChk.innerHTML; + divChk.innerHTML = ''; + + var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); + ul.className = checkList.checkListCssClass; + + var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); + li0.className = checkList.checkListItemCssClass; + ul.appendChild(li0); + + divChk.appendChild(ul); + + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + var li = _dom2.default.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.Mod.paging.setPagingInfo(); + } + } //end if + } + }, { + key: 'filter', + value: function filter() { + this.EvtManager(this.Evt.name.filter); + } + + /** + * Filter the table by retrieving the data from each cell in every single + * row and comparing it to the search term for current column. A row is + * hidden when all the search terms are not found in inspected row. + * + * TODO: Reduce complexity of this massive method + */ + + }, { + key: '_filter', + value: function _filter() { + if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { + return; + } + //invoke onbefore callback + if (this.onBeforeFilter) { + this.onBeforeFilter.call(null, this); + } + this.emitter.emit('before-filtering', this); + + var row = this.tbl.rows, + Mod = this.Mod, + hiddenrows = 0; + + this.validRowsIndex = []; + + // removes keyword highlighting + // if(this.highlightKeywords){ + // Mod.highlightKeyword.unhighlightAll(); + // } + //removes popup filters active icons + // if(this.popupFilters){ + // Mod.popupFilter.buildIcons(); + // } + //removes active column header class + if (this.markActiveColumns) { + this.clearActiveColumns(); + } + // search args re-init + this.searchArgs = this.getFiltersValue(); + + var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); + + //keyword highlighting + function highlight(str, ok, cell) { + /*jshint validthis:true */ + if (this.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 = _dom2.default.getText(cell); + } + if (w !== '') { + Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); + } + } + } + + //looks for search argument in current row + function hasArg(sA, cellData, j) { + /*jshint validthis:true */ + var occurence = undefined, + removeNbFormat = _helpers2.default.removeNbFormat; + + //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); + var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); + var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); + var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); + var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); + var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); + + var dte1 = undefined, + dte2 = undefined; + //dates + if (_date2.default.isValid(cellData, dtType)) { + dte1 = _date2.default.format(cellData, dtType); + // lower date + if (isLDate) { + dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); + occurence = dte1 < dte2; + } + // lower equal date + else if (isLEDate) { + dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); + occurence = dte1 <= dte2; + } + // greater equal date + else if (isGEDate) { + dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); + occurence = dte1 >= dte2; + } + // greater date + else if (isGDate) { + dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); + occurence = dte1 > dte2; + } + // different date + else if (isDFDate) { + dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); + occurence = dte1.toString() != dte2.toString(); + } + // equal date + else if (isEQDate) { + dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } else if (_date2.default.isValid(sA, dtType)) { + dte2 = _date2.default.format(sA, dtType); + occurence = dte1.toString() === dte2.toString(); + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } else { + //first numbers need to be formated + if (this.hasColNbFormat && this.colNbFormat[j]) { + numCellData = removeNbFormat(cellData, this.colNbFormat[j]); + nbFormat = this.colNbFormat[j]; + } else { + if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { + numCellData = removeNbFormat(cellData, 'us'); + nbFormat = 'us'; + } else { + numCellData = removeNbFormat(cellData, 'eu'); + nbFormat = 'eu'; + } + } + + // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, + // rgx:) + // lower equal + if (hasLE) { + occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); + } + //greater equal + else if (hasGE) { + occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); + } + //lower + else if (hasLO) { + occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); + } + //greater + else if (hasGR) { + occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); + } + //different + else if (hasDF) { + occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; + } + //like + else if (hasLK) { + occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } + //equal + else if (hasEQ) { + occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); + } + //starts with + else if (hasST) { + occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; + } + //ends with + else if (hasEN) { + var searchArg = sA.replace(re_en, ''); + occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } + //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(cellData); + } catch (e) { + occurence = false; + } + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } //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 = true, + + //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]; + var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; + if (sA === '') { + continue; + } + + var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); + + //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 = undefined, + occur = false, + s = hasMultiOrSA ? sAOrSplit : sAAndSplit; + for (var w = 0, len = s.length; w < len; w++) { + cS = _string2.default.trim(s[w]); + occur = hasArg.call(this, cS, cellData, j); + highlight.call(this, cS, occur, cell[j]); + if (hasMultiOrSA && occur) { + break; + } + if (hasMultiAndSA && !occur) { + break; + } + } + occurence[j] = occur; + } + //single search parameter + else { + occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); + highlight.call(this, sA, occurence[j], cell[j]); + } //else single param + + if (!occurence[j]) { + isRowValid = false; + } + if (this.singleSearchFlt && occurence[j]) { + singleFltRowValid = true; + } + if (this.popupFilters) { + Mod.popupFilter.buildIcon(j, true); + } + if (this.markActiveColumns) { + if (k === this.refRow) { + if (this.onBeforeActiveColumn) { + this.onBeforeActiveColumn.call(null, this, j); + } + _dom2.default.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); + if (Mod.alternateRows) { + Mod.alternateRows.removeRowBg(k); + } + // always visible rows need to be counted as valid + if (this.hasVisibleRows && this.visibleRows.indexOf(k) !== -1) { + this.validRowsIndex.push(k); + } else { + hiddenrows++; + } + } else { + this.validateRow(k, true); + this.validRowsIndex.push(k); + if (this.alternateRows) { + Mod.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; + + //invokes onafterfilter callback + if (this.onAfterFilter) { + this.onAfterFilter.call(null, this); + } + + this.emitter.emit('after-filtering', this); + } + + /** + * Return the data of a specified colum + * @param {Number} colIndex Column index + * @param {Boolean} includeHeaders Optional: include headers row + * @param {Boolean} num Optional: return unformatted number + * @param {Array} exclude Optional: list of row indexes to be excluded + * @return {Array} Flat list of data for a column + */ + + }, { + key: 'getColValues', + value: function getColValues(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; + + if (!this.fltGrid) { + return; + } + var row = this.tbl.rows, + colValues = []; + + if (includeHeaders) { + colValues.push(this.getHeadersText()[colIndex]); + } + + for (var i = this.refRow; i < this.nbRows; i++) { + var isExludedRow = false; + // checks if current row index appears in exclude array + if (exclude.length > 0) { + isExludedRow = exclude.indexOf(i) != -1; + } + 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 !== '') { + continue; + } + var cellData = this.getCellData(cell[j]), + nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, + data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; + colValues.push(data); + } + } + } + return colValues; + } + + /** + * Return the filter's value of a specified column + * @param {Number} index Column index + * @return {String} Filter value + */ + + }, { + key: 'getFilterValue', + value: function getFilterValue(index) { + if (!this.fltGrid) { + return; + } + var fltValue = undefined, + flt = this.getFilterElement(index); + if (!flt) { + return ''; + } + + var fltColType = this.getFilterType(index); + if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { + fltValue = flt.value; + } + //mutiple select + else if (fltColType === this.fltTypeMulti) { + fltValue = ''; + for (var j = 0, len = flt.options.length; j < len; 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; + } + + /** + * Return the filters' values + * @return {Array} List of filters' values + */ + + }, { + key: 'getFiltersValue', + value: function getFiltersValue() { + if (!this.fltGrid) { + return; + } + var searchArgs = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); + } + return searchArgs; + } + + /** + * Return the ID of the filter of a specified column + * @param {Number} index Column's index + * @return {String} ID of the filter element + */ + + }, { + key: 'getFilterId', + value: function getFilterId(index) { + if (!this.fltGrid) { + return; + } + return this.fltIds[index]; + } + + /** + * Return the list of ids of filters matching a specified type. + * Note: hidden filters are also returned + * + * @param {String} type Filter type string ('input', 'select', 'multiple', + * 'checklist') + * @param {Boolean} bool If true returns columns indexes instead of IDs + * @return {[type]} List of element IDs or column indexes + */ + + }, { + key: 'getFiltersByType', + value: function getFiltersByType(type, bool) { + if (!this.fltGrid) { + return; + } + var arr = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + var fltType = this.getFilterType(i); + if (fltType === _string2.default.lower(type)) { + var a = bool ? i : this.fltIds[i]; + arr.push(a); + } + } + return arr; + } + + /** + * Return the filter's DOM element for a given column + * @param {Number} index Column's index + * @return {DOMElement} + */ + + }, { + key: 'getFilterElement', + value: function getFilterElement(index) { + var fltId = this.fltIds[index]; + return _dom2.default.id(fltId); + } + + /** + * Return the number of cells for a given row index + * @param {Number} rowIndex Index of the row + * @return {Number} Number of cells + */ + + }, { + key: 'getCellsNb', + value: function getCellsNb() { + var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; + + var tr = this.tbl.rows[rowIndex]; + return tr.cells.length; + } + + /** + * Return the number of filterable rows starting from reference row if + * defined + * @param {Boolean} includeHeaders Include the headers row + * @return {Number} Number of filterable rows + */ + + }, { + key: 'getRowsNb', + value: function getRowsNb(includeHeaders) { + var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, + ntrs = this.tbl.rows.length; + if (includeHeaders) { + s = 0; + } + return parseInt(ntrs - s, 10); + } + + /** + * Return the data of a given cell + * @param {DOMElement} cell Cell's DOM object + * @return {String} + */ + + }, { + key: 'getCellData', + value: function getCellData(cell) { + var idx = cell.cellIndex; + //Check for customCellData callback + if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { + return this.customCellData.call(null, this, cell, idx); + } else { + return _dom2.default.getText(cell); + } + } + + /** + * Return the table data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getTableData', + value: function getTableData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var rows = this.tbl.rows; + var tblData = []; + if (includeHeaders) { + tblData.push([this.getHeadersRowIndex(), this.getHeadersText()]); + } + for (var k = this.refRow; k < this.nbRows; k++) { + var rowData = [k, []]; + var cells = rows[k].cells; + for (var j = 0, len = cells.length; j < len; j++) { + var cellData = this.getCellData(cells[j]); + rowData[1].push(cellData); + } + tblData.push(rowData); + } + return tblData; + } + + /** + * Return the filtered data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredData', + value: function getFilteredData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + if (!this.validRowsIndex) { + return []; + } + var rows = this.tbl.rows, + filteredData = []; + if (includeHeaders) { + filteredData.push([this.getHeadersRowIndex(), this.getHeadersText()]); + } + + var validRows = this.getValidRows(true); + for (var i = 0; i < validRows.length; i++) { + var rData = [this.validRowsIndex[i], []], + cells = rows[this.validRowsIndex[i]].cells; + for (var k = 0; k < cells.length; k++) { + var cellData = this.getCellData(cells[k]); + rData[1].push(cellData); + } + filteredData.push(rData); + } + return filteredData; + } + + /** + * Return the filtered data for a given column index + * @param {Number} colIndex Colmun's index + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} Flat list of values ['val0','val1','val2'...] + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredDataCol', + value: function getFilteredDataCol(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + + if (_types2.default.isUndef(colIndex)) { + return []; + } + var data = this.getFilteredData(), + colData = []; + if (includeHeaders) { + colData.push(this.getHeadersText()[colIndex]); + } + for (var i = 0, len = data.length; i < len; 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; + } + + /** + * Get the display value of a row + * @param {RowElement} DOM element of the row + * @return {String} Usually 'none' or '' + */ + + }, { + key: 'getRowDisplay', + value: function getRowDisplay(row) { + if (!_types2.default.isObj(row)) { + return null; + } + return row.style.display; + } + + /** + * Validate/invalidate row by setting the 'validRow' attribute on the row + * @param {Number} rowIndex Index of the row + * @param {Boolean} isValid + */ + + }, { + key: 'validateRow', + value: function validateRow(rowIndex, isValid) { + var row = this.tbl.rows[rowIndex]; + if (!row || typeof isValid !== 'boolean') { + return; + } + + // always visible rows are valid + if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { + isValid = true; + } + + var displayFlag = isValid ? '' : 'none', + validFlag = isValid ? 'true' : 'false'; + row.style.display = displayFlag; + + if (this.paging) { + row.setAttribute('validRow', validFlag); + } + } + + /** + * Validate all filterable rows + */ + + }, { + key: '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); + } + } + + /** + * Set search value to a given filter + * @param {Number} index Column's index + * @param {String} searcharg Search term + */ + + }, { + key: 'setFilterValue', + value: function setFilterValue(index) { + var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; + + if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { + return; + } + var slc = this.getFilterElement(index), + fltColType = this.getFilterType(index); + + if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { + slc.value = searcharg; + } + //multiple selects + else if (fltColType === this.fltTypeMulti) { + var s = searcharg.split(' ' + this.orOperator + ' '); + // let ct = 0; //keywords counter + for (var j = 0, len = slc.options.length; j < len; j++) { + var option = slc.options[j]; + if (s === '' || s[0] === '') { + option.selected = false; + } + if (option.value === '') { + option.selected = false; + } + if (option.value !== '' && _array2.default.has(s, option.value, true)) { + option.selected = true; + } //if + } //for j + } + //checklist + else if (fltColType === this.fltTypeCheckList) { + searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); + var sarg = searcharg.split(' ' + this.orOperator + ' '); + var lisNb = _dom2.default.tag(slc, 'li').length; + + slc.setAttribute('value', ''); + slc.setAttribute('indexes', ''); + + for (var k = 0; k < lisNb; k++) { + var li = _dom2.default.tag(slc, 'li')[k], + lbl = _dom2.default.tag(li, 'label')[0], + chk = _dom2.default.tag(li, 'input')[0], + lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); + if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { + chk.checked = true; + this.Mod.checkList.setCheckListValues(chk); + } else { + chk.checked = false; + this.Mod.checkList.setCheckListValues(chk); + } + } + } + } + + /** + * Set them columns' widths as per configuration + * @param {Number} rowIndex Optional row index to apply the widths to + * @param {Element} tbl DOM element + */ + + }, { + key: 'setColWidths', + value: function setColWidths(rowIndex, tbl) { + if (!this.fltGrid || !this.hasColWidths) { + return; + } + tbl = tbl || this.tbl; + var rIndex = undefined; + if (rowIndex === undefined) { + rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; + } else { + rIndex = rowIndex; + } + + setWidths.call(this); + + function setWidths() { + /*jshint validthis:true */ + var nbCols = this.nbCells; + var colWidths = this.colWidths; + var colTags = _dom2.default.tag(tbl, 'col'); + var tblHasColTag = colTags.length > 0; + var frag = !tblHasColTag ? doc.createDocumentFragment() : null; + for (var k = 0; k < nbCols; k++) { + var col = undefined; + if (tblHasColTag) { + col = colTags[k]; + } else { + col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); + frag.appendChild(col); + } + col.style.width = colWidths[k]; + } + if (!tblHasColTag) { + tbl.insertBefore(frag, tbl.firstChild); + } + } + } + + /** + * Makes defined rows always visible + */ + + }, { + key: 'enforceVisibility', + value: function enforceVisibility() { + if (!this.hasVisibleRows) { + return; + } + for (var i = 0, len = this.visibleRows.length; i < len; i++) { + var row = this.visibleRows[i]; + //row index cannot be > nrows + if (row <= this.nbRows) { + this.validateRow(row, true); + } + } + } + }, { + key: 'clearFilters', + value: function clearFilters() { + this.EvtManager(this.Evt.name.clear); + } + + /** + * Clear all the filters' values + */ + + }, { + key: '_clearFilters', + value: function _clearFilters() { + if (!this.fltGrid) { + return; + } + if (this.onBeforeReset) { + this.onBeforeReset.call(null, this, this.getFiltersValue()); + } + for (var i = 0, len = this.fltIds.length; i < len; i++) { + this.setFilterValue(i, ''); + } + // if(this.linkedFilters){ + // this.linkFilters(); + // } + if (this.rememberPageLen) { + _cookie2.default.remove(this.pgLenCookie); + } + if (this.rememberPageNb) { + _cookie2.default.remove(this.pgNbCookie); + } + if (this.onAfterReset) { + this.onAfterReset.call(null, this); + } + + this.emitter.emit('cleared-filters', this); + } + + /** + * Clears filtered columns visual indicator (background color) + */ + + }, { + key: 'clearActiveColumns', + value: function clearActiveColumns() { + for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { + _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); + } + } + + /** + * Refresh the filters subject to linking ('select', 'multiple', + * 'checklist' type) + */ + + }, { + key: 'linkFilters', + value: function linkFilters() { + if (!this.linkedFilters || !this.activeFilterId) { + return; + } + 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); + + var activeFlt = this.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(this.prfxFlt)[1]; + var slcSelectedValue = undefined; + for (var i = 0, len = slcIndex.length; i < len; i++) { + var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); + slcSelectedValue = this.getFilterValue(slcIndex[i]); + + // Welcome to cyclomatic complexity hell :) + // TODO: simplify/refactor if statement + if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; + } else { + curSlc.innerHTML = ''; + } + + //1st option needs to be inserted + if (this.loadFltOnDemand) { + var opt0 = _dom2.default.createOpt(this.displayAllText, ''); + if (curSlc) { + curSlc.appendChild(opt0); + } + } + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList._build(slcIndex[i]); + } else { + this.Mod.dropdown._build(slcIndex[i], true); + } + + this.setFilterValue(slcIndex[i], slcSelectedValue); + } + } // for i + } + + /** + * Re-generate the filters grid bar when previously removed + */ + + }, { + key: '_resetGrid', + value: function _resetGrid() { + if (this.isFirstLoad) { + return; + } + + var Mod = this.Mod; + var tbl = this.tbl; + var rows = tbl.rows; + var filtersRowIndex = this.filtersRowIndex; + var filtersRow = rows[filtersRowIndex]; + + // grid was removed, grid row element is stored in fltGridEl property + if (!this.gridLayout) { + // If table has a thead ensure the filters row is appended in the + // thead element + if (tbl.tHead) { + var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); + tbl.tHead.replaceChild(this.fltGridEl, tempRow); + } else { + filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); + } + } + + // filters are appended in external placeholders elements + if (this.isExternalFlt) { + var externalFltTgtIds = this.externalFltTgtIds; + for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { + var extFlt = _dom2.default.id(externalFltTgtIds[ct]); + + if (!extFlt) { + continue; + } + + var externalFltEl = this.externalFltEls[ct]; + extFlt.appendChild(externalFltEl); + var colFltType = this.getFilterType(ct); + //IE special treatment for gridLayout, appended filters are + //empty + if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { + if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { + Mod.dropdown.build(ct); + } + if (colFltType === this.fltTypeCheckList) { + Mod.checkList.build(ct); + } + } + } + } + + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = rows.length; + + if (this.popupFilters) { + this.headersRow++; + Mod.popupFilter.reset(); + } + + if (!this.gridLayout) { + _dom2.default.addClass(this.tbl, this.prfxTf); + } + this._hasGrid = true; + } + + /** + * Determines if passed filter column implements exact query match + * @param {Number} colIndex [description] + * @return {Boolean} [description] + */ + + }, { + key: 'isExactMatch', + value: function isExactMatch(colIndex) { + var fltType = this.getFilterType(colIndex); + return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; + } + + /** + * Check if passed script or stylesheet is already imported + * @param {String} filePath Ressource path + * @param {String} type Possible values: 'script' or 'link' + * @return {Boolean} + */ + + }, { + key: 'isImported', + value: function isImported(filePath, type) { + var imported = false, + importType = !type ? 'script' : type, + attr = importType == 'script' ? 'src' : 'href', + files = _dom2.default.tag(doc, importType); + for (var i = 0, len = files.length; i < len; i++) { + if (files[i][attr] === undefined) { + continue; + } + if (files[i][attr].match(filePath)) { + imported = true; + break; + } + } + return imported; + } + + /** + * Import script or stylesheet + * @param {String} fileId Ressource ID + * @param {String} filePath Ressource path + * @param {Function} callback Callback + * @param {String} type Possible values: 'script' or 'link' + */ + + }, { + key: 'import', + value: function _import(fileId, filePath, callback, type) { + var ftype = !type ? 'script' : type, + imported = this.isImported(filePath, ftype); + if (imported) { + return; + } + var o = this, + isLoaded = false, + file = undefined, + head = _dom2.default.tag(doc, 'head')[0]; + + if (_string2.default.lower(ftype) === 'link') { + file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); + } else { + file = _dom2.default.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: ' + filePath); + }; + head.appendChild(file); + } + + /** + * Check if table has filters grid + * @return {Boolean} + */ + + }, { + key: 'hasGrid', + value: function hasGrid() { + return this._hasGrid; + } + + /** + * Get list of filter IDs + * @return {[type]} [description] + */ + + }, { + key: 'getFiltersId', + value: function getFiltersId() { + return this.fltIds || []; + } + + /** + * Get filtered (valid) rows indexes + * @param {Boolean} reCalc Force calculation of filtered rows list + * @return {Array} List of row indexes + */ + + }, { + key: 'getValidRows', + value: function getValidRows(reCalc) { + 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; + } + + /** + * Get the index of the row containing the filters + * @return {Number} + */ + + }, { + key: 'getFiltersRowIndex', + value: function getFiltersRowIndex() { + return this.filtersRowIndex; + } + + /** + * Get the index of the headers row + * @return {Number} + */ + + }, { + key: 'getHeadersRowIndex', + value: function getHeadersRowIndex() { + return this.headersRow; + } + + /** + * Get the row index from where the filtering process start (1st filterable + * row) + * @return {Number} + */ + + }, { + key: 'getStartRowIndex', + value: function getStartRowIndex() { + return this.refRow; + } + + /** + * Get the index of the last row + * @return {Number} + */ + + }, { + key: 'getLastRowIndex', + value: function getLastRowIndex() { + if (!this._hasGrid) { + return; + } + return this.nbRows - 1; + } + + /** + * Get the header DOM element for a given column index + * @param {Number} colIndex Column index + * @return {Object} + */ + + }, { + key: 'getHeaderElement', + value: function getHeaderElement(colIndex) { + var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; + var tHead = _dom2.default.tag(table, 'thead'); + var headersRow = this.headersRow; + var header = undefined; + for (var i = 0; i < this.nbCells; i++) { + if (i !== colIndex) { + continue; + } + if (tHead.length === 0) { + header = table.rows[headersRow].cells[i]; + } + if (tHead.length === 1) { + header = tHead[0].rows[headersRow].cells[i]; + } + break; + } + return header; + } + + /** + * Return the list of headers' text + * @return {Array} list of headers' text + */ + + }, { + key: 'getHeadersText', + value: function getHeadersText() { + var headers = []; + for (var j = 0; j < this.nbCells; j++) { + var header = this.getHeaderElement(j); + var headerText = _dom2.default.getText(header); + headers.push(headerText); + } + return headers; + } + + /** + * Return the filter type for a specified column + * @param {Number} colIndex Column's index + * @return {String} + */ + + }, { + key: 'getFilterType', + value: function getFilterType(colIndex) { + var colType = this.cfg['col_' + colIndex]; + return !colType ? this.fltTypeInp : _string2.default.lower(colType); + } + + /** + * Get the total number of filterable rows + * @return {Number} + */ + + }, { + key: 'getFilterableRowsNb', + value: function getFilterableRowsNb() { + return this.getRowsNb(false); + } + + /** + * Get the configuration object (literal object) + * @return {Object} + */ + + }, { + key: 'config', + value: function config() { + return this.cfg; + } + }]); + + return TableFilter; + })(); + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * DOM event utilities + */ + + exports.default = { + 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; + } + }, + target: function target(evt) { + return evt && evt.target || window.event && window.event.srcElement; + }, + keyCode: function keyCode(evt) { + return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; + } + }; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * DOM utilities + */ + + exports.default = { + + /** + * Returns text + text of children of given node + * @param {NodeElement} node + * @return {String} + */ + + getText: function getText(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 + */ + create: function create(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]); + } + } + } + return el; + }, + + /** + * Removes passed node from DOM + * @param {DOMElement} node + * @return {DOMElement} old node reference + */ + remove: function remove(node) { + return node.parentNode.removeChild(node); + }, + + /** + * Returns a text node with given text + * @param {String} txt + * @return {Object} + */ + text: function text(txt) { + return document.createTextNode(txt); + }, + hasClass: function hasClass(ele, cls) { + if (!ele) { + return false; + } + + if (supportsClassList()) { + return ele.classList.contains(cls); + } + return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); + }, + addClass: function addClass(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; + } + }, + removeClass: function removeClass(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 + */ + createOpt: function createOpt(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 + */ + createCheckItem: function createCheckItem(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; + }, + id: function id(key) { + return document.getElementById(key); + }, + tag: function tag(o, tagname) { + return o.getElementsByTagName(tagname); + } + }; + + // HTML5 classList API + + function supportsClassList() { + return document.documentElement.classList; + } + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * String utilities + */ + + exports.default = { + lower: function lower(text) { + return text.toLowerCase(); + }, + upper: function upper(text) { + return text.toUpperCase(); + }, + trim: function trim(text) { + if (text.trim) { + return text.trim(); + } + return text.replace(/^\s*|\s*$/g, ''); + }, + isEmpty: function isEmpty(text) { + return this.trim(text) === ''; + }, + rgxEsc: function rgxEsc(text) { + var chars = /[-\/\\^$*+?.()|[\]{}]/g; + var escMatch = '\\$&'; + return String(text).replace(chars, escMatch); + }, + matchCase: function matchCase(text, caseSensitive) { + if (!caseSensitive) { + return this.lower(text); + } + return text; + }, + + /** + * Checks if passed data contains the searched term + * @param {String} term Searched term + * @param {String} data Data string + * @param {Boolean} exactMatch Exact match + * @param {Boolean} caseSensitive Case sensitive + * @return {Boolean} + */ + contains: function contains(term, data) { + var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; + + // Improved by Cedric Wartel (cwl) automatic exact match for selects and + // special characters are now filtered + var regexp = undefined, + modifier = caseSensitive ? 'g' : 'gi'; + if (exactMatch) { + regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); + } else { + regexp = new RegExp(this.rgxEsc(term), modifier); + } + return regexp.test(data); + } + }; + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Cookie utilities + */ + + exports.default = { + write: function write(name, value, hours) { + var expire = ''; + if (hours) { + expire = new Date(new Date().getTime() + hours * 3600000); + expire = '; expires=' + expire.toGMTString(); + } + document.cookie = name + '=' + escape(value) + expire; + }, + read: function read(name) { + var cookieValue = '', + search = name + '='; + if (document.cookie.length > 0) { + var cookie = document.cookie, + offset = cookie.indexOf(search); + if (offset !== -1) { + offset += search.length; + var end = cookie.indexOf(';', offset); + if (end === -1) { + end = cookie.length; + } + cookieValue = unescape(cookie.substring(offset, end)); + } + } + return cookieValue; + }, + remove: function remove(name) { + this.write(name, '', -1); + }, + valueToArray: function valueToArray(name, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.read(name); + //creates an array with filters' values + var arr = val.split(separator); + return arr; + }, + getValueByIndex: function getValueByIndex(name, index, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.valueToArray(name, separator); + return val[index]; + } + }; + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * Types utilities + */ + + var UNDEFINED = void 0; + + exports.default = { + /** + * Check if argument is an object or a global object + * @param {String or Object} v + * @return {Boolean} + */ + + isObj: function isObj(v) { + var isO = false; + if (typeof v === 'string') { + if (window[v] && _typeof(window[v]) === 'object') { + isO = true; + } + } else { + if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { + isO = true; + } + } + return isO; + }, + + /** + * Check if argument is a function + * @param {Function} fn + * @return {Boolean} + */ + isFn: function isFn(fn) { + return fn && fn.constructor == Function; + }, + + /** + * Check if argument is an array + * @param {Array} obj + * @return {Boolean} + */ + isArray: function isArray(obj) { + return obj && obj.constructor == Array; + }, + + /** + * Determine if argument is undefined + * @param {Any} o + * @return {Boolean} + */ + isUndef: function isUndef(o) { + return o === UNDEFINED; + }, + + /** + * Determine if argument is null + * @param {Any} o + * @return {Boolean} + */ + isNull: function isNull(o) { + return o === null; + }, + + /** + * Determine if argument is empty (undefined, null or empty string) + * @param {Any} o + * @return {Boolean} + */ + isEmpty: function isEmpty(o) { + return this.isUndef(o) || this.isNull(o) || o.length === 0; + } + }; + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + has: function has(arr, val, caseSensitive) { + var sCase = caseSensitive === undefined ? false : caseSensitive; + for (var i = 0; i < arr.length; i++) { + if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { + return true; + } + } + return false; + } + }; /** + * Array utilities + */ + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Date utilities + */ + + exports.default = { + 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 = undefined, + reg2 = undefined; + // 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 = undefined, + dd = undefined, + yy = undefined; + // 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(dateStr, formatStr) { + if (!formatStr) { + formatStr = 'DMY'; + } + if (!dateStr || dateStr === '') { + return new Date(1001, 0, 1); + } + var oDate = undefined; + var parts = undefined; + + switch (formatStr.toUpperCase()) { + case 'DDMMMYYYY': + parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); + oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); + break; + case 'DMY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'MDY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'YMD': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + default: + //in case format is not correct + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + } + return oDate; + } + }; + + function y2kDate(yr) { + if (yr === undefined) { + return 0; + } + if (yr.length > 2) { + return yr; + } + var y = undefined; + //>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; + } + + function mmm2mm(mmm) { + if (mmm === undefined) { + return 0; + } + var mondigit = undefined; + 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; + } + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + removeNbFormat: function removeNbFormat(data, format) { + if (!data) { + return; + } + if (!format) { + format = 'us'; + } + var n = data; + if (_string2.default.lower(format) === 'us') { + n = +n.replace(/[^\d\.-]/g, ''); + } else { + n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); + } + return n; + } + }; /** + * Misc helpers + */ + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + "use strict"; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Event emitter class + */ + + var Emitter = exports.Emitter = (function () { + function Emitter() { + _classCallCheck(this, Emitter); + + /** + * Events object + * @type {Object} + */ + this.events = {}; + } + + /** + * Subscribe to an event + * @param {String} evt Event name + * @param {Function} fn Function invoked when event is emitted + */ + + _createClass(Emitter, [{ + key: "on", + value: function on(evt, fn) { + this.events[evt] = this.events[evt] || []; + this.events[evt].push(fn); + } + + /** + * Unsubscribe to an event + * @param {String} evt Event name + * @param {Function} fn Function invoked when event is emitted + */ + + }, { + key: "off", + value: function off(evt, fn) { + if (evt in this.events) { + this.events[evt].splice(this.events[evt].indexOf(fn), 1); + } + } + + /** + * Emit an event + * @param {String} evt Event name followed by any other argument passed to + * the invoked function + */ + + }, { + key: "emit", + value: function emit(evt /*, args...*/) { + if (evt in this.events === false) { + return; + } + for (var i = 0; i < this.events[evt].length; i++) { + this.events[evt][i].apply(this, [].slice.call(arguments, 1)); + } + } + }]); + + return Emitter; + })(); + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Store = undefined; + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Store = exports.Store = (function () { + + /** + * Store, persistence manager + * @param {Object} tf TableFilter instance + * + * TODO: use localStorage and fallback to cookie persistence + */ + + function Store(tf) { + _classCallCheck(this, Store); + + var f = tf.config(); + + this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(Store, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on('after-filtering', function () { + return _this.saveFilterValues(_this.tf.fltsValuesCookie); + }); + } + + /** + * Store filters' values in cookie + * @param {String} cookie name + */ + + }, { + key: 'saveFilterValues', + value: function saveFilterValues(name) { + var tf = this.tf; + var fltValues = []; + //store filters' values + for (var i = 0; i < tf.fltIds.length; i++) { + var value = tf.getFilterValue(i); + if (value === '') { + value = ' '; + } + fltValues.push(value); + } + //adds array size + fltValues.push(tf.fltIds.length); + + //writes cookie + _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); + } + + /** + * Retrieve filters' values from cookie + * @param {String} cookie name + * @return {Array} + */ + + }, { + key: 'getFilterValues', + value: function getFilterValues(name) { + var flts = _cookie2.default.read(name); + var rgx = new RegExp(this.tf.separator, 'g'); + // filters' values array + return flts.split(rgx); + } + + /** + * Store page number in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageNb', + value: function savePageNb(name) { + _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); + } + + /** + * Retrieve page number from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageNb', + value: function getPageNb(name) { + return _cookie2.default.read(name); + } + + /** + * Store page length in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageLength', + value: function savePageLength(name) { + _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); + } + + /** + * Retrieve page length from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageLength', + value: function getPageLength(name) { + return _cookie2.default.read(name); + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off('after-filtering', function () { + return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); + }); + } + }]); + + return Store; + })(); + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.GridLayout = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var GridLayout = exports.GridLayout = (function (_Feature) { + _inherits(GridLayout, _Feature); + + /** + * Grid layout, table with fixed headers + * @param {Object} tf TableFilter instance + */ + + function GridLayout(tf) { + _classCallCheck(this, GridLayout); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); + + var f = _this.config; + + //defines grid width + _this.gridWidth = f.grid_width || null; + //defines grid height + _this.gridHeight = f.grid_height || null; + //defines css class for main container + _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; + //defines css class for div containing table + _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; + //defines css class for div containing headers' table + _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; + //defines css class for div containing rows counter, paging etc. + _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; + //defines which row contains column headers + _this.gridHeadRowIndex = f.grid_headers_row_index || 0; + //array of headers row indexes to be placed in header table + _this.gridHeadRows = f.grid_headers_rows || [0]; + //generate filters in table headers + _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; + //default col width + _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; + + _this.gridColElms = []; + + //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_'; + + _this.sourceTblHtml = tf.tbl.outerHTML; + return _this; + } + + /** + * Generates a grid with fixed headers + */ + + _createClass(GridLayout, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + var f = this.config; + var tbl = tf.tbl; + + if (this.initialized) { + return; + } + + tf.isExternalFlt = true; + + // default width of 100px if column widths not set + if (!tf.hasColWidths) { + tf.colWidths = []; + for (var k = 0; k < tf.nbCells; k++) { + var colW, + cell = tbl.rows[this.gridHeadRowIndex].cells[k]; + if (cell.width !== '') { + colW = cell.width; + } else if (cell.style.width !== '') { + colW = parseInt(cell.style.width, 10); + } else { + colW = this.gridDefaultColWidth; + } + tf.colWidths[k] = colW; + } + tf.hasColWidths = true; + } + tf.setColWidths(this.gridHeadRowIndex); + + var tblW; //initial table width + if (tbl.width !== '') { + tblW = tbl.width; + } else if (tbl.style.width !== '') { + tblW = parseInt(tbl.style.width, 10); + } else { + tblW = tbl.clientWidth; + } + + //Main container: it will contain all the elements + this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); + this.tblMainCont.className = this.gridMainContCssClass; + if (this.gridWidth) { + this.tblMainCont.style.width = this.gridWidth; + } + tbl.parentNode.insertBefore(this.tblMainCont, tbl); + + //Table container: div wrapping content table + this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); + this.tblCont.className = this.gridContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.tblCont.style.width = '100%'; + } else { + this.tblCont.style.width = this.gridWidth; + } + } + if (this.gridHeight) { + this.tblCont.style.height = this.gridHeight; + } + tbl.parentNode.insertBefore(this.tblCont, tbl); + var t = _dom2.default.remove(tbl); + this.tblCont.appendChild(t); + + //In case table width is expressed in % + if (tbl.style.width === '') { + tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; + } + + var d = _dom2.default.remove(this.tblCont); + this.tblMainCont.appendChild(d); + + //Headers table container: div wrapping headers table + this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); + this.headTblCont.className = this.gridHeadContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.headTblCont.style.width = '100%'; + } else { + this.headTblCont.style.width = this.gridWidth; + } + } + + //Headers table + this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); + var tH = _dom2.default.create('tHead'); + + //1st row should be headers row, ids are added if not set + //Those ids are used by the sort feature + var hRow = tbl.rows[this.gridHeadRowIndex]; + var sortTriggers = []; + for (var n = 0; n < tf.nbCells; n++) { + var c = hRow.cells[n]; + var thId = c.getAttribute('id'); + if (!thId || thId === '') { + thId = this.prfxGridTh + n + '_' + tf.id; + c.setAttribute('id', thId); + } + sortTriggers.push(thId); + } + + //Filters row is created + var filtersRow = _dom2.default.create('tr'); + if (this.gridEnableFilters && tf.fltGrid) { + tf.externalFltTgtIds = []; + for (var j = 0; j < tf.nbCells; j++) { + var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; + var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); + filtersRow.appendChild(cl); + tf.externalFltTgtIds[j] = fltTdId; + } + } + //Headers row are moved from content table to headers table + for (var i = 0; i < this.gridHeadRows.length; i++) { + var headRow = tbl.rows[this.gridHeadRows[0]]; + tH.appendChild(headRow); + } + this.headTbl.appendChild(tH); + if (tf.filtersRowIndex === 0) { + tH.insertBefore(filtersRow, hRow); + } else { + tH.appendChild(filtersRow); + } + + this.headTblCont.appendChild(this.headTbl); + this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); + + //THead needs to be removed in content table for sort feature + var thead = _dom2.default.tag(tbl, 'thead'); + if (thead.length > 0) { + tbl.removeChild(thead[0]); + } + + //Headers table style + this.headTbl.style.tableLayout = 'fixed'; + tbl.style.tableLayout = 'fixed'; + this.headTbl.cellPadding = tbl.cellPadding; + this.headTbl.cellSpacing = tbl.cellSpacing; + // this.headTbl.style.width = tbl.style.width; + + //content table without headers needs col widths to be reset + tf.setColWidths(0, this.headTbl); + + //Headers container width + // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; + + tbl.style.width = ''; + // + this.headTbl.style.width = tbl.clientWidth + 'px'; + // + + //scroll synchronisation + _event2.default.add(this.tblCont, 'scroll', function (evt) { + var elm = _event2.default.target(evt); + var scrollLeft = elm.scrollLeft; + _this2.headTblCont.scrollLeft = scrollLeft; + //New pointerX calc taking into account scrollLeft + // if(!o.isPointerXOverwritten){ + // try{ + // o.Evt.pointerX = function(evt){ + // var e = evt || global.event; + // var bdScrollLeft = tf_StandardBody().scrollLeft + + // scrollLeft; + // return (e.pageX + scrollLeft) || + // (e.clientX + bdScrollLeft); + // }; + // o.isPointerXOverwritten = true; + // } catch(err) { + // o.isPointerXOverwritten = false; + // } + // } + }); + + //Configure sort extension if any + var sort = (f.extensions || []).filter(function (itm) { + return itm.name === 'sort'; + }); + if (sort.length === 1) { + sort[0].async_sort = true; + sort[0].trigger_ids = sortTriggers; + } + + //Cols generation for all browsers excepted IE<=7 + this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; + + //Col elements are enough to keep column widths after sorting and + //filtering + var createColTags = function createColTags() { + for (var k = tf.nbCells - 1; k >= 0; k--) { + var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); + tbl.insertBefore(col, tbl.firstChild); + col.style.width = tf.colWidths[k]; + this.gridColElms[k] = col; + } + this.tblHasColTag = true; + }; + + if (!this.tblHasColTag) { + createColTags.call(this); + } else { + var cols = _dom2.default.tag(tbl, 'col'); + for (var ii = 0; ii < tf.nbCells; ii++) { + cols[ii].setAttribute('id', tf.id + '_col_' + ii); + cols[ii].style.width = tf.colWidths[ii]; + this.gridColElms.push(cols[ii]); + } + } + + var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; + f.on_after_col_resized = function (o, colIndex) { + if (!colIndex) { + return; + } + var w = o.crWColsRow.cells[colIndex].style.width; + var col = o.gridColElms[colIndex]; + col.style.width = w; + + var thCW = o.crWColsRow.cells[colIndex].clientWidth; + var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; + + if (thCW != tdCW) { + o.headTbl.style.width = tbl.clientWidth + 'px'; + } + + if (afterColResizedFn) { + afterColResizedFn.call(null, o, colIndex); + } + }; + + if (tf.popupFilters) { + filtersRow.style.display = 'none'; + } + + if (tbl.clientWidth !== this.headTbl.clientWidth) { + tbl.style.width = this.headTbl.clientWidth + 'px'; + } + + this.initialized = true; + } + + /** + * Removes the grid layout + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + var tbl = tf.tbl; + + if (!this.initialized) { + return; + } + var t = _dom2.default.remove(tbl); + this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); + _dom2.default.remove(this.tblMainCont); + + this.tblMainCont = null; + this.headTblCont = null; + this.headTbl = null; + this.tblCont = null; + + tbl.outerHTML = this.sourceTblHtml; + //needed to keep reference of table element for future usage + this.tf.tbl = t; + + this.initialized = false; + } + }]); + + return GridLayout; + })(_feature.Feature); + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var NOTIMPLEMENTED = 'Not implemented.'; + + var Feature = exports.Feature = (function () { + function Feature(tf, feature) { + _classCallCheck(this, Feature); + + this.tf = tf; + this.feature = feature; + this.enabled = tf[feature]; + this.config = tf.config(); + this.emitter = tf.emitter; + this.initialized = false; + } + + _createClass(Feature, [{ + key: 'init', + value: function init() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + } + }, { + key: 'destroy', + value: function destroy() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'enable', + value: function enable() { + this.enabled = true; + } + }, { + key: 'disable', + value: function disable() { + this.enabled = false; + } + }, { + key: 'isEnabled', + value: function isEnabled() { + return this.enabled; + } + }]); + + return Feature; + })(); + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Loader = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var Loader = exports.Loader = (function (_Feature) { + _inherits(Loader, _Feature); + + /** + * Loading message/spinner + * @param {Object} tf TableFilter instance + */ + + function Loader(tf) { + _classCallCheck(this, Loader); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); + + var f = _this.config; + + //id of container element + _this.loaderTgtId = f.loader_target_id || null; + //div containing loader + _this.loaderDiv = null; + //defines loader text + _this.loaderText = f.loader_text || 'Loading...'; + //defines loader innerHtml + _this.loaderHtml = f.loader_html || null; + //defines css class for loader div + _this.loaderCssClass = f.loader_css_class || 'loader'; + //delay for hiding loader + _this.loaderCloseDelay = 200; + //callback function before loader is displayed + _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; + //callback function after loader is closed + _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; + //loader div + _this.prfxLoader = 'load_'; + return _this; + } + + _createClass(Loader, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + var tf = this.tf; + + var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); + containerDiv.className = this.loaderCssClass; + + var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); + if (!this.loaderTgtId) { + targetEl.insertBefore(containerDiv, tf.tbl); + } else { + targetEl.appendChild(containerDiv); + } + this.loaderDiv = containerDiv; + if (!this.loaderHtml) { + this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); + } else { + this.loaderDiv.innerHTML = this.loaderHtml; + } + + this.show('none'); + this.initialized = true; + } + }, { + key: 'show', + value: function show(p) { + var _this2 = this; + + if (!this.isEnabled() || this.loaderDiv.style.display === p) { + return; + } + + var displayLoader = function displayLoader() { + if (!_this2.loaderDiv) { + return; + } + if (_this2.onShowLoader && p !== 'none') { + _this2.onShowLoader.call(null, _this2); + } + _this2.loaderDiv.style.display = p; + if (_this2.onHideLoader && p === 'none') { + _this2.onHideLoader.call(null, _this2); + } + }; + + var t = p === 'none' ? this.loaderCloseDelay : 1; + global.setTimeout(displayLoader, t); + } + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + + _dom2.default.remove(this.loaderDiv); + this.loaderDiv = null; + this.initialized = false; + } + }]); + + return Loader; + })(_feature.Feature); + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.HighlightKeyword = undefined; + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var HighlightKeyword = exports.HighlightKeyword = (function () { + + /** + * HighlightKeyword, highlight matched keyword + * @param {Object} tf TableFilter instance + */ + + function HighlightKeyword(tf) { + _classCallCheck(this, HighlightKeyword); + + var f = tf.config(); + //defines css class for highlighting + this.highlightCssClass = f.highlight_css_class || 'keyword'; + this.highlightedNodes = []; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(HighlightKeyword, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on('before-filtering', function () { + return _this.unhighlightAll(); + }); + } + + /** + * highlight occurences of searched term in passed node + * @param {Node} node + * @param {String} word Searched term + * @param {String} cssClass Css class name + */ + + }, { + key: 'highlight', + value: function highlight(node, word, cssClass) { + // Iterate into this nodes childNodes + if (node.hasChildNodes) { + var children = node.childNodes; + for (var i = 0; i < children.length; i++) { + this.highlight(children[i], word, cssClass); + } + } + + if (node.nodeType === 3) { + var tempNodeVal = _string2.default.lower(node.nodeValue); + var tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) != -1) { + var pn = node.parentNode; + if (pn && pn.className != cssClass) { + // word not highlighted yet + var nv = node.nodeValue, + ni = tempNodeVal.indexOf(tempWordVal), + + // Create a load of replacement nodes + before = _dom2.default.text(nv.substr(0, ni)), + docWordVal = nv.substr(ni, word.length), + after = _dom2.default.text(nv.substr(ni + word.length)), + hiwordtext = _dom2.default.text(docWordVal), + hiword = _dom2.default.create('span'); + hiword.className = cssClass; + hiword.appendChild(hiwordtext); + pn.insertBefore(before, node); + pn.insertBefore(hiword, node); + pn.insertBefore(after, node); + pn.removeChild(node); + this.highlightedNodes.push(hiword.firstChild); + } + } + } + } + + /** + * Removes highlight to nodes matching passed string + * @param {String} word + * @param {String} cssClass Css class to remove + */ + + }, { + key: 'unhighlight', + value: function unhighlight(word, cssClass) { + var arrRemove = []; + var highlightedNodes = this.highlightedNodes; + for (var i = 0; i < highlightedNodes.length; i++) { + var n = highlightedNodes[i]; + if (!n) { + continue; + } + var tempNodeVal = _string2.default.lower(n.nodeValue), + tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) !== -1) { + var pn = n.parentNode; + if (pn && pn.className === cssClass) { + var prevSib = pn.previousSibling, + nextSib = pn.nextSibling; + if (!prevSib || !nextSib) { + continue; + } + nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; + prevSib.nodeValue = ''; + n.nodeValue = ''; + arrRemove.push(i); + } + } + } + for (var k = 0; k < arrRemove.length; k++) { + highlightedNodes.splice(arrRemove[k], 1); + } + } + + /** + * Clear all occurrences of highlighted nodes + */ + + }, { + key: 'unhighlightAll', + value: function unhighlightAll() { + if (!this.tf.highlightKeywords || !this.tf.searchArgs) { + return; + } + for (var y = 0; y < this.tf.searchArgs.length; y++) { + this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); + } + this.highlightedNodes = []; + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off('before-filtering', function () { + return _this2.unhighlightAll(); + }); + } + }]); + + return HighlightKeyword; + })(); + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.PopupFilter = undefined; + + var _feature = __webpack_require__(12); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var PopupFilter = exports.PopupFilter = (function (_Feature) { + _inherits(PopupFilter, _Feature); + + /** + * Pop-up filter component + * @param {Object} tf TableFilter instance + */ + + function PopupFilter(tf) { + _classCallCheck(this, PopupFilter); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); + + var f = _this.config; + + // Enable external filters behaviour + tf.isExternalFlt = true; + tf.externalFltTgtIds = []; + + //filter icon path + _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; + //active filter icon path + _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; + _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; + //defines css class for popup div containing filter + _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; + //callback function before popup filtes is opened + _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; + //callback function after popup filtes is opened + _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; + //callback function before popup filtes is closed + _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; + //callback function after popup filtes is closed + _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; + + //stores filters spans + _this.popUpFltSpans = []; + //stores filters icons + _this.popUpFltImgs = []; + //stores filters containers + _this.popUpFltElms = _this.popUpFltElmCache || []; + _this.popUpFltAdjustToContainer = true; + + //id prefix for pop-up filter span + _this.prfxPopUpSpan = 'popUpSpan_'; + //id prefix for pop-up div containing filter + _this.prfxPopUpDiv = 'popUpDiv_'; + return _this; + } + + _createClass(PopupFilter, [{ + key: 'onClick', + value: function onClick(e) { + var evt = e || global.event, + elm = evt.target.parentNode, + colIndex = parseInt(elm.getAttribute('ci'), 10); + + this.closeAll(colIndex); + this.toggle(colIndex); + + if (this.popUpFltAdjustToContainer) { + var popUpDiv = this.popUpFltElms[colIndex], + header = this.tf.getHeaderElement(colIndex), + headerWidth = header.clientWidth * 0.95; + popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; + } + _event2.default.cancel(evt); + _event2.default.stop(evt); + } + + /** + * Initialize DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + for (var i = 0; i < tf.nbCells; i++) { + if (tf.getFilterType(i) === tf.fltTypeNone) { + continue; + } + var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); + popUpSpan.innerHTML = this.popUpImgFltHtml; + var header = tf.getHeaderElement(i); + header.appendChild(popUpSpan); + _event2.default.add(popUpSpan, 'click', function (evt) { + _this2.onClick(evt); + }); + this.popUpFltSpans[i] = popUpSpan; + this.popUpFltImgs[i] = popUpSpan.firstChild; + } + + // subscribe to events + this.emitter.on('before-filtering', function () { + return _this2.buildIcons(); + }); + this.emitter.on('after-filtering', function () { + return _this2.closeAll(); + }); + + this.initialized = true; + } + + /** + * Reset previously destroyed feature + */ + + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + this.buildAll(); + } + + /** + * Build all pop-up filters elements + */ + + }, { + key: 'buildAll', + value: function buildAll() { + for (var i = 0; i < this.popUpFltElmCache.length; i++) { + this.build(i, this.popUpFltElmCache[i]); + } + } + + /** + * Build a specified pop-up filter elements + * @param {Number} colIndex Column index + * @param {Object} div Optional container DOM element + */ + + }, { + key: 'build', + value: function build(colIndex, div) { + var tf = this.tf; + var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; + popUpDiv.className = this.popUpDivCssClass; + tf.externalFltTgtIds.push(popUpDiv.id); + var header = tf.getHeaderElement(colIndex); + header.insertBefore(popUpDiv, header.firstChild); + _event2.default.add(popUpDiv, 'click', function (evt) { + _event2.default.stop(evt); + }); + this.popUpFltElms[colIndex] = popUpDiv; + } + + /** + * Toogle visibility of specified filter + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggle', + value: function toggle(colIndex) { + var tf = this.tf, + popUpFltElm = this.popUpFltElms[colIndex]; + + if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { + if (this.onBeforePopUpOpen) { + this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'block'; + if (tf.getFilterType(colIndex) === tf.fltTypeInp) { + var flt = tf.getFilterElement(colIndex); + if (flt) { + flt.focus(); + } + } + if (this.onAfterPopUpOpen) { + this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } else { + if (this.onBeforePopUpClose) { + this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'none'; + if (this.onAfterPopUpClose) { + this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } + } + + /** + * Close all filters excepted for the specified one if any + * @param {Number} exceptIdx Column index of the filter to not close + */ + + }, { + key: 'closeAll', + value: function closeAll(exceptIdx) { + for (var i = 0; i < this.popUpFltElms.length; i++) { + if (i === exceptIdx) { + continue; + } + var popUpFltElm = this.popUpFltElms[i]; + if (popUpFltElm) { + popUpFltElm.style.display = 'none'; + } + } + } + + /** + * Build all the icons representing the pop-up filters + */ + + }, { + key: 'buildIcons', + value: function buildIcons() { + for (var i = 0; i < this.popUpFltImgs.length; i++) { + this.buildIcon(i, false); + } + } + + /** + * Build specified icon + * @param {Number} colIndex Column index + * @param {Boolean} active Apply active state + */ + + }, { + key: 'buildIcon', + value: function buildIcon(colIndex, active) { + if (this.popUpFltImgs[colIndex]) { + this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; + } + } + + /** + * Remove pop-up filters + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + this.popUpFltElmCache = []; + for (var i = 0; i < this.popUpFltElms.length; i++) { + var popUpFltElm = this.popUpFltElms[i], + popUpFltSpan = this.popUpFltSpans[i], + popUpFltImg = this.popUpFltImgs[i]; + if (popUpFltElm) { + _dom2.default.remove(popUpFltElm); + this.popUpFltElmCache[i] = popUpFltElm; + } + popUpFltElm = null; + if (popUpFltSpan) { + _dom2.default.remove(popUpFltSpan); + } + popUpFltSpan = null; + if (popUpFltImg) { + _dom2.default.remove(popUpFltImg); + } + popUpFltImg = null; + } + this.popUpFltElms = []; + this.popUpFltSpans = []; + this.popUpFltImgs = []; + + // unsubscribe to events + this.emitter.off('before-filtering', function () { + return _this3.buildIcons(); + }); + this.emitter.off('after-filtering', function () { + return _this3.closeAll(); + }); + + this.initialized = false; + } + }]); + + return PopupFilter; + })(_feature.Feature); + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Dropdown = undefined; + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Dropdown = exports.Dropdown = (function () { + + /** + * Dropdown UI component + * @param {Object} tf TableFilter instance + */ + + function Dropdown(tf) { + _classCallCheck(this, Dropdown); + + // Configuration object + var f = tf.config(); + + this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; + //defines empty option text + this.nonEmptyText = f.non_empty_text || '(Non empty)'; + //sets select filling method: 'innerHTML' or 'createElement' + this.slcFillingMethod = f.slc_filling_method || 'createElement'; + //IE only, tooltip text appearing on select before it is populated + this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; + //tooltip text appearing on multiple select + this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; + + this.isCustom = null; + this.opts = null; + this.optsTxt = null; + this.slcInnerHtml = null; + + this.tf = tf; + } + + /** + * Build drop-down filter UI asynchronously + * @param {Number} colIndex Column index + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Boolean} isExternal Render in external container + * @param {String} extSlcId External container id + */ + + _createClass(Dropdown, [{ + key: 'build', + value: function build(colIndex, isLinked, isExternal, extSlcId) { + var tf = this.tf; + tf.EvtManager(tf.Evt.name.dropdown, { + slcIndex: colIndex, + slcRefreshed: isLinked, + slcExternal: isExternal, + slcId: extSlcId + }); + } + + /** + * Build drop-down filter UI + * @param {Number} colIndex Column index + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Boolean} isExternal Render in external container + * @param {String} extSlcId External container id + */ + + }, { + key: '_build', + value: function _build(colIndex) { + var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.opts = []; + this.optsTxt = []; + this.slcInnerHtml = ''; + + var slcId = tf.fltIds[colIndex]; + if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { + return; + } + var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), + rows = tf.tbl.rows, + matchCase = tf.matchCase; + + //custom select test + this.isCustom = tf.isCustomOptions(colIndex); + + //custom selects text + var activeFlt; + if (isLinked && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + /*** remember grid values ***/ + var fltsValues = [], + fltArr = []; + if (tf.rememberGridValues) { + fltsValues = tf.feature('store').getFilterValues(tf.fltsValuesCookie); + if (fltsValues && !_string2.default.isEmpty(fltsValues.toString())) { + if (this.isCustom) { + fltArr.push(fltsValues[colIndex]); + } else { + fltArr = fltsValues[colIndex].split(' ' + tf.orOperator + ' '); + } + } + } + + var excludedOpts = null, + filteredDataCol = null; + if (isLinked && tf.disableExcludedOptions) { + excludedOpts = []; + filteredDataCol = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cell = rows[k].cells, + nchilds = cell.length; + + // checks if row has exact cell # + if (nchilds !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < nchilds; j++) { + // WTF: cyclomatic complexity hell + if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cell[j]), + + //Vary Peter's patch + cell_string = _string2.default.matchCase(cell_data, matchCase); + + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, matchCase)) { + this.opts.push(cell_data); + } + + if (isLinked && tf.disableExcludedOptions) { + var filteredCol = filteredDataCol[j]; + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { + excludedOpts.push(cell_data); + } + } + } //if colIndex==j + } //for j + } //for k + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (excludedOpts) { + excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + } + } + + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (excludedOpts) { + excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (excludedOpts) { + excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + //populates drop-down + this.addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr); + } + + /** + * Add drop-down options + * @param {Number} colIndex Column index + * @param {Object} slc Select Dom element + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Array} excludedOpts Array of excluded options + * @param {Array} fltsValues Collection of persisted filter values + * @param {Array} fltArr Collection of persisted filter values + */ + + }, { + key: 'addOptions', + value: function addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod), + slcValue = slc.value; + + slc.innerHTML = ''; + slc = this.addFirstOption(slc); + + for (var y = 0; y < this.opts.length; y++) { + if (this.opts[y] === '') { + continue; + } + var val = this.opts[y]; //option value + var lbl = this.isCustom ? this.optsTxt[y] : val; //option text + var isDisabled = false; + if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + isDisabled = true; + } + + if (fillMethod === 'innerhtml') { + var slcAttr = ''; + if (tf.loadFltOnDemand && slcValue === this.opts[y]) { + slcAttr = 'selected="selected"'; + } + this.slcInnerHtml += ''; + } else { + var opt; + //fill select on demand + if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { + opt = _dom2.default.createOpt(lbl, val, true); + } else { + if (tf.getFilterType(colIndex) !== tf.fltTypeMulti) { + opt = _dom2.default.createOpt(lbl, val, fltsValues[colIndex] !== ' ' && val === fltsValues[colIndex] ? true : false); + } else { + opt = _dom2.default.createOpt(lbl, val, _array2.default.has(fltArr, _string2.default.matchCase(this.opts[y], tf.matchCase), tf.matchCase) || fltArr.toString().indexOf(val) !== -1 ? true : false); + } + } + if (isDisabled) { + opt.disabled = true; + } + slc.appendChild(opt); + } + } // for y + + if (fillMethod === 'innerhtml') { + slc.innerHTML += this.slcInnerHtml; + } + slc.setAttribute('filled', '1'); + } + + /** + * Add drop-down header option + * @param {Object} slc Select DOM element + */ + + }, { + key: 'addFirstOption', + value: function addFirstOption(slc) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod); + + if (fillMethod === 'innerhtml') { + this.slcInnerHtml += ''; + } else { + var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); + if (!this.enableSlcResetFilter) { + opt0.style.display = 'none'; + } + slc.appendChild(opt0); + if (tf.enableEmptyOption) { + var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); + slc.appendChild(opt1); + } + if (tf.enableNonEmptyOption) { + var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); + slc.appendChild(opt2); + } + } + return slc; + } + }]); + + return Dropdown; + })(); + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + ignoreCase: function ignoreCase(a, b) { + var x = _string2.default.lower(a); + var y = _string2.default.lower(b); + return x < y ? -1 : x > y ? 1 : 0; + } + }; + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.CheckList = undefined; + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var CheckList = exports.CheckList = (function () { + + /** + * Checklist UI component + * @param {Object} tf TableFilter instance + */ + + function CheckList(tf) { + _classCallCheck(this, CheckList); + + // Configuration object + var f = tf.config(); + + this.checkListDiv = []; //checklist container div + //defines css class for div containing checklist filter + this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; + //defines css class for checklist filters + this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; + //defines css class for checklist item (li) + this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; + //defines css class for selected checklist item (li) + this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; + //Load on demand text + this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; + //defines css class for checklist filters + this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; + this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; + //checklist filter container div + this.prfxCheckListDiv = 'chkdiv_'; + + this.isCustom = null; + this.opts = null; + this.optsTxt = null; + this.excludedOpts = null; + + this.tf = tf; + } + + // TODO: move event here + + _createClass(CheckList, [{ + key: 'onChange', + value: function onChange(evt) { + var elm = evt.target; + this.tf.activeFilterId = elm.getAttribute('id'); + this.tf.activeFlt = _dom2.default.id(this.tf.activeFilterId); + this.tf.Evt.onSlcChange.call(this.tf, evt); + } + }, { + key: 'optionClick', + value: function optionClick(evt) { + this.setCheckListValues(evt.target); + this.onChange(evt); + } + + /** + * Build checklist UI asynchronously + * @param {Number} colIndex Column index + * @param {Boolean} isExternal Render in external container + * @param {String} extFltId External container id + */ + + }, { + key: 'build', + value: function build(colIndex, isExternal, extFltId) { + var tf = this.tf; + tf.EvtManager(tf.Evt.name.checklist, { slcIndex: colIndex, slcExternal: isExternal, slcId: extFltId }); + } + + /** + * Build checklist UI + * @param {Number} colIndex Column index + * @param {Boolean} isExternal Render in external container + * @param {String} extFltId External container id + */ + + }, { + key: '_build', + value: function _build(colIndex) { + var _this = this; + + var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.opts = []; + this.optsTxt = []; + + var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; + if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { + return; + } + + var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); + var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); + ul.className = this.checkListCssClass; + _event2.default.add(ul, 'change', function (evt) { + _this.onChange(evt); + }); + + var rows = tf.tbl.rows; + this.isCustom = tf.isCustomOptions(colIndex); + + var activeFlt; + if (tf.linkedFilters && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + var filteredDataCol = []; + if (tf.linkedFilters && tf.disableExcludedOptions) { + this.excludedOpts = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cells = rows[k].cells; + var ncells = cells.length; + + // checks if row has exact cell # + if (ncells !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < ncells; j++) { + // WTF: cyclomatic complexity hell :) + if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cells[j]); + //Vary Peter's patch + var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { + this.opts.push(cell_data); + } + var filteredCol = filteredDataCol[j]; + if (tf.linkedFilters && tf.disableExcludedOptions) { + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { + this.excludedOpts.push(cell_data); + } + } + } + } + } + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!tf.matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (this.excludedOpts) { + this.excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + } + } + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + this.addChecks(colIndex, ul, tf.separator); + + if (tf.loadFltOnDemand) { + flt.innerHTML = ''; + } + flt.appendChild(ul); + flt.setAttribute('filled', '1'); + } + + /** + * Add checklist options + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addChecks', + value: function addChecks(colIndex, ul) { + var _this2 = this; + + var tf = this.tf; + var chkCt = this.addTChecks(colIndex, ul); + var fltArr = []; //remember grid values + var store = tf.feature('store'); + var tmpVal = store ? store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null; + if (tmpVal && _string2.default.trim(tmpVal).length > 0) { + if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1) { + fltArr.push(tmpVal); + } else { + fltArr = tmpVal.split(' ' + tf.orOperator + ' '); + } + } + + for (var y = 0; y < this.opts.length; y++) { + var val = this.opts[y]; //item value + var lbl = this.isCustom ? this.optsTxt[y] : val; //item text + var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); + li.className = this.checkListItemCssClass; + if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + _dom2.default.addClass(li, this.checkListItemDisabledCssClass); + li.check.disabled = true; + li.disabled = true; + } else { + _event2.default.add(li.check, 'click', function (evt) { + _this2.optionClick(evt); + }); + } + ul.appendChild(li); + + if (val === '') { + //item is hidden + li.style.display = 'none'; + } + + /*** remember grid values ***/ + if (tf.rememberGridValues) { + if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1 && fltArr.toString().indexOf(val) != -1 || _array2.default.has(fltArr, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + li.check.checked = true; + this.setCheckListValues(li.check); + } + } + } + } + + /** + * Add checklist header option + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addTChecks', + value: function addTChecks(colIndex, ul) { + var _this3 = this; + + var tf = this.tf; + var chkCt = 1; + var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); + li0.className = this.checkListItemCssClass; + ul.appendChild(li0); + + _event2.default.add(li0.check, 'click', function (evt) { + _this3.optionClick(evt); + }); + + if (!this.enableCheckListResetFilter) { + li0.style.display = 'none'; + } + + if (tf.enableEmptyOption) { + var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); + li1.className = this.checkListItemCssClass; + ul.appendChild(li1); + _event2.default.add(li1.check, 'click', function (evt) { + _this3.optionClick(evt); + }); + chkCt++; + } + + if (tf.enableNonEmptyOption) { + var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); + li2.className = this.checkListItemCssClass; + ul.appendChild(li2); + _event2.default.add(li2.check, 'click', function (evt) { + _this3.optionClick(evt); + }); + chkCt++; + } + return chkCt; + } + + /** + * Store checked options in DOM element attribute + * @param {Object} o checklist option DOM element + */ + + }, { + key: 'setCheckListValues', + value: function setCheckListValues(o) { + if (!o) { + return; + } + var tf = this.tf; + var chkValue = o.value; //checked item value + var chkIndex = parseInt(o.id.split('_')[2], 10); + var filterTag = 'ul', + itemTag = 'li'; + var n = o; + + //ul tag search + while (_string2.default.lower(n.nodeName) !== filterTag) { + n = n.parentNode; + } + + var li = n.childNodes[chkIndex]; + var colIndex = n.getAttribute('colIndex'); + var fltValue = n.getAttribute('value'); //filter value (ul tag) + var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) + + if (o.checked) { + //show all item + if (chkValue === '') { + if (fltIndexes && fltIndexes !== '') { + //items indexes + var indSplit = fltIndexes.split(tf.separator); + //checked items loop + for (var u = 0; u < indSplit.length; u++) { + //checked item + var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); + if (cChk) { + cChk.checked = false; + _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); + } + } + } + n.setAttribute('value', ''); + n.setAttribute('indexes', ''); + } else { + fltValue = fltValue ? fltValue : ''; + chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); + chkIndex = fltIndexes + chkIndex + tf.separator; + n.setAttribute('value', chkValue); + n.setAttribute('indexes', chkIndex); + //1st option unchecked + if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { + _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; + } + } + + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); + _dom2.default.addClass(li, this.checkListSlcItemCssClass); + } + } else { + //removes values and indexes + if (chkValue !== '') { + var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); + fltValue = fltValue.replace(replaceValue, ''); + n.setAttribute('value', _string2.default.trim(fltValue)); + + var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); + fltIndexes = fltIndexes.replace(replaceIndex, ''); + n.setAttribute('indexes', fltIndexes); + } + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(li, this.checkListSlcItemCssClass); + } + } + } + }]); + + return CheckList; + })(); + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.RowsCounter = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var RowsCounter = exports.RowsCounter = (function (_Feature) { + _inherits(RowsCounter, _Feature); + + /** + * Rows counter + * @param {Object} tf TableFilter instance + */ + + function RowsCounter(tf) { + _classCallCheck(this, RowsCounter); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); + + var f = _this.config; + + //id of custom container element + _this.rowsCounterTgtId = f.rows_counter_target_id || null; + //element containing tot nb rows + _this.rowsCounterDiv = null; + //element containing tot nb rows label + _this.rowsCounterSpan = null; + //defines rows counter text + _this.rowsCounterText = f.rows_counter_text || 'Rows: '; + _this.fromToTextSeparator = f.from_to_text_separator || '-'; + _this.overText = f.over_text || ' / '; + //defines css class rows counter + _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; + //rows counter div + _this.prfxCounter = 'counter_'; + //nb displayed rows label + _this.prfxTotRows = 'totrows_span_'; + //label preceding nb rows label + _this.prfxTotRowsTxt = 'totRowsTextSpan_'; + //callback raised before counter is refreshed + _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; + //callback raised after counter is refreshed + _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; + return _this; + } + + _createClass(RowsCounter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + //rows counter container + var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); + countDiv.className = this.totRowsCssClass; + //rows counter label + var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); + var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); + countText.appendChild(_dom2.default.text(this.rowsCounterText)); + + // counter is added to defined element + if (!this.rowsCounterTgtId) { + tf.setToolbar(); + } + var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); + + //default container: 'lDiv' + if (!this.rowsCounterTgtId) { + countDiv.appendChild(countText); + countDiv.appendChild(countSpan); + targetEl.appendChild(countDiv); + } else { + //custom container, no need to append statusDiv + targetEl.appendChild(countText); + targetEl.appendChild(countSpan); + } + this.rowsCounterDiv = countDiv; + this.rowsCounterSpan = countSpan; + + // subscribe to after-filtering event + this.emitter.on('after-filtering', function () { + return _this2.refresh(tf.nbVisibleRows); + }); + // subscribe to grouped-by-page event + this.emitter.on('grouped-by-page', function () { + return _this2.refresh(tf.nbVisibleRows); + }); + // subscribe to rows-changed event + this.emitter.on('rows-changed', function () { + return _this2.refresh(); + }); + + this.initialized = true; + this.refresh(); + } + }, { + key: 'refresh', + value: function refresh(p) { + if (!this.initialized || !this.isEnabled()) { + return; + } + + var tf = this.tf; + + if (this.onBeforeRefreshCounter) { + this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); + } + + var totTxt; + if (!tf.paging) { + if (p && p !== '') { + totTxt = p; + } else { + totTxt = tf.nbFilterableRows - tf.nbHiddenRows; + } + } else { + var paging = tf.feature('paging'); + if (paging) { + //paging start row + var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); + var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; + totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; + } + } + + this.rowsCounterSpan.innerHTML = totTxt; + if (this.onAfterRefreshCounter) { + this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + if (!this.rowsCounterTgtId && this.rowsCounterDiv) { + _dom2.default.remove(this.rowsCounterDiv); + } else { + _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; + } + this.rowsCounterSpan = null; + this.rowsCounterDiv = null; + + // unsubscribe to events + this.emitter.off('after-filtering', function () { + return _this3.refresh(tf.nbVisibleRows); + }); + this.emitter.off('grouped-by-page', function () { + return _this3.refresh(tf.nbVisibleRows); + }); + this.emitter.off('rows-changed', function () { + return _this3.refresh(); + }); + + this.initialized = false; + } + }]); + + return RowsCounter; + })(_feature.Feature); + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.StatusBar = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var StatusBar = exports.StatusBar = (function (_Feature) { + _inherits(StatusBar, _Feature); + + /** + * Status bar UI component + * @param {Object} tf TableFilter instance + */ + + function StatusBar(tf) { + _classCallCheck(this, StatusBar); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); + + var f = _this.config; + + //id of custom container element + _this.statusBarTgtId = f.status_bar_target_id || null; + //element containing status bar label + _this.statusBarDiv = null; + //status bar + _this.statusBarSpan = null; + //status bar label + _this.statusBarSpanText = null; + //defines status bar text + _this.statusBarText = f.status_bar_text || ''; + //defines css class status bar + _this.statusBarCssClass = f.status_bar_css_class || 'status'; + //delay for status bar clearing + _this.statusBarCloseDelay = 250; + + //calls function before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //calls function after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + + // status bar div + _this.prfxStatus = 'status_'; + // status bar label + _this.prfxStatusSpan = 'statusSpan_'; + // text preceding status bar label + _this.prfxStatusTxt = 'statusText_'; + return _this; + } + + _createClass(StatusBar, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + var tf = this.tf; + + //status bar container + var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); + statusDiv.className = this.statusBarCssClass; + + //status bar label + var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); + //preceding text + var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); + statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); + + // target element container + if (!this.statusBarTgtId) { + tf.setToolbar(); + } + var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); + + //default container: 'lDiv' + if (!this.statusBarTgtId) { + statusDiv.appendChild(statusSpanText); + statusDiv.appendChild(statusSpan); + targetEl.appendChild(statusDiv); + } else { + // custom container, no need to append statusDiv + targetEl.appendChild(statusSpanText); + targetEl.appendChild(statusSpan); + } + + this.statusBarDiv = statusDiv; + this.statusBarSpan = statusSpan; + this.statusBarSpanText = statusSpanText; + + this.initialized = true; + } + }, { + key: 'message', + value: function message() { + var _this2 = this; + + var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; + + if (!this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, t); + } + + var d = t === '' ? this.statusBarCloseDelay : 1; + global.setTimeout(function () { + _this2.statusBarSpan.innerHTML = t; + if (_this2.onAfterShowMsg) { + _this2.onAfterShowMsg.call(null, _this2.tf, t); + } + }, d); + } + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + + this.statusBarDiv.innerHTML = ''; + _dom2.default.remove(this.statusBarDiv); + this.statusBarSpan = null; + this.statusBarSpanText = null; + this.statusBarDiv = null; + this.initialized = false; + } + }]); + + return StatusBar; + })(_feature.Feature); + +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Paging = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Paging = exports.Paging = (function (_Feature) { + _inherits(Paging, _Feature); + + /** + * Pagination component + * @param {Object} tf TableFilter instance + */ + + function Paging(tf) { + _classCallCheck(this, Paging); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); + + var f = _this.config; + + //css class for paging buttons (previous,next,etc.) + _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; + //stores paging select element + _this.pagingSlc = null; + //results per page select element + _this.resultsPerPageSlc = null; + //id of container element + _this.pagingTgtId = f.paging_target_id || null; + //defines table paging length + _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; + //id of container element + _this.resultsPerPageTgtId = f.results_per_page_target_id || null; + //css class for paging select element + _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; + //css class for paging input element + _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; + //stores results per page text and values + _this.resultsPerPage = f.results_per_page || null; + //enables/disables results per page drop-down + _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); + //defines css class for results per page select + _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; + //css class for label preceding results per page select + _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; + //1st row index of current page + _this.startPagingRow = 0; + //total nb of pages + _this.nbPages = 0; + //current page nb + _this.currentPageNb = 1; + //defines next page button text + _this.btnNextPageText = f.btn_next_page_text || '>'; + //defines previous page button text + _this.btnPrevPageText = f.btn_prev_page_text || '<'; + //defines last page button text + _this.btnLastPageText = f.btn_last_page_text || '>|'; + //defines first page button text + _this.btnFirstPageText = f.btn_first_page_text || '|<'; + //defines next page button html + _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); + //defines last page button html + _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); + //defines text preceeding page selector drop-down + _this.pageText = f.page_text || ' Page '; + //defines text after page selector drop-down + _this.ofText = f.of_text || ' of '; + //css class for span containing tot nb of pages + _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; + //enables/disables paging buttons + _this.hasPagingBtns = f.paging_btns === false ? false : true; + //defines previous page button html + _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; + //calls function before page is changed + _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; + //calls function before page is changed + _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; + + //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_'; + + var start_row = _this.refRow; + var nrows = _this.nbRows; + //calculates page nb + _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); + + //Paging elements events + var o = _this; + // Paging DOM events + _this.evt = { + slcIndex: function slcIndex() { + return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; + }, + nbOpts: function nbOpts() { + return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; + }, + next: function next() { + var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; + o.changePage(nextIndex); + }, + prev: function prev() { + var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); + o.changePage(prevIndex); + }, + last: function last() { + o.changePage(o.evt.nbOpts()); + }, + first: function first() { + o.changePage(0); + }, + _detectKey: function _detectKey(e) { + var key = _event2.default.keyCode(e); + if (key === 13) { + if (tf.sorted) { + tf.filter(); + o.changePage(o.evt.slcIndex()); + } else { + o.changePage(); + } + this.blur(); + } + }, + + slcPagesChange: null, + nextEvt: null, + prevEvt: null, + lastEvt: null, + firstEvt: null + }; + return _this; + } + + /** + * Initialize DOM elements + */ + + _createClass(Paging, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var slcPages; + var tf = this.tf; + var evt = this.evt; + + if (this.initialized) { + return; + } + + // Check resultsPerPage is in expected format and initialise the + // results per page component + if (this.hasResultsPerPage) { + if (this.resultsPerPage.length < 2) { + this.hasResultsPerPage = false; + } else { + this.pagingLength = this.resultsPerPage[1][0]; + this.setResultsPerPage(); + } + } + + evt.slcPagesChange = function (event) { + var slc = event.target; + _this2.changePage(slc.selectedIndex); + }; + + // Paging drop-down list selector + if (this.pageSelectorType === tf.fltTypeSlc) { + slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); + slcPages.className = this.pgSlcCssClass; + _event2.default.add(slcPages, 'change', evt.slcPagesChange); + } + + // Paging input selector + if (this.pageSelectorType === tf.fltTypeInp) { + slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); + slcPages.className = this.pgInpCssClass; + _event2.default.add(slcPages, 'keypress', evt._detectKey); + } + + // btns containers + var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); + var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); + var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); + var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); + + if (this.hasPagingBtns) { + // Next button + if (!this.btnNextPageHtml) { + var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); + btn_next.className = this.btnPageCssClass; + _event2.default.add(btn_next, 'click', evt.next); + btnNextSpan.appendChild(btn_next); + } else { + btnNextSpan.innerHTML = this.btnNextPageHtml; + _event2.default.add(btnNextSpan, 'click', evt.next); + } + // Previous button + if (!this.btnPrevPageHtml) { + var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); + btn_prev.className = this.btnPageCssClass; + _event2.default.add(btn_prev, 'click', evt.prev); + btnPrevSpan.appendChild(btn_prev); + } else { + btnPrevSpan.innerHTML = this.btnPrevPageHtml; + _event2.default.add(btnPrevSpan, 'click', evt.prev); + } + // Last button + if (!this.btnLastPageHtml) { + var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); + btn_last.className = this.btnPageCssClass; + _event2.default.add(btn_last, 'click', evt.last); + btnLastSpan.appendChild(btn_last); + } else { + btnLastSpan.innerHTML = this.btnLastPageHtml; + _event2.default.add(btnLastSpan, 'click', evt.last); + } + // First button + if (!this.btnFirstPageHtml) { + var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); + btn_first.className = this.btnPageCssClass; + _event2.default.add(btn_first, 'click', evt.first); + btnFirstSpan.appendChild(btn_first); + } else { + btnFirstSpan.innerHTML = this.btnFirstPageHtml; + _event2.default.add(btnFirstSpan, 'click', evt.first); + } + } + + // paging elements (buttons+drop-down list) are added to defined element + if (!this.pagingTgtId) { + tf.setToolbar(); + } + var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + targetEl.appendChild(btnFirstSpan); + targetEl.appendChild(btnPrevSpan); + + var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); + pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); + pgBeforeSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgBeforeSpan); + targetEl.appendChild(slcPages); + var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); + pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); + pgAfterSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgAfterSpan); + var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); + pgspan.className = this.nbPgSpanCssClass; + pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); + targetEl.appendChild(pgspan); + targetEl.appendChild(btnNextSpan); + targetEl.appendChild(btnLastSpan); + this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); + + if (!tf.rememberGridValues) { + this.setPagingInfo(); + } + if (!tf.fltGrid) { + tf.validateAllRows(); + this.setPagingInfo(tf.validRowsIndex); + } + + this.emitter.on('after-filtering', function () { + return _this2.resetPagingInfo(); + }); + + this.initialized = true; + } + + /** + * Reset paging when filters are already instantiated + * @param {Boolean} filterTable Execute filtering once paging instanciated + */ + + }, { + key: 'reset', + value: function reset() { + var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var tf = this.tf; + if (!tf.hasGrid() || this.isEnabled()) { + return; + } + this.enable(); + this.init(); + tf.resetValues(); + if (filterTable) { + tf.filter(); + } + } + + /** + * Reset paging info from scratch after a filtering process + */ + + }, { + key: 'resetPagingInfo', + value: function resetPagingInfo() { + this.startPagingRow = 0; + this.currentPageNb = 1; + this.setPagingInfo(this.tf.validRowsIndex); + } + + /** + * Calculate number of pages based on valid rows + * Refresh paging select according to number of pages + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'setPagingInfo', + value: function setPagingInfo() { + var validRows = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0]; + + var tf = this.tf; + var rows = tf.tbl.rows; + var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + //store valid rows indexes + tf.validRowsIndex = validRows; + + if (validRows.length === 0) { + //counts rows to be grouped + for (var j = tf.refRow; j < tf.nbRows; j++) { + var row = rows[j]; + if (!row) { + continue; + } + + var isRowValid = row.getAttribute('validRow'); + if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { + tf.validRowsIndex.push(j); + } + } + } + + //calculate nb of pages + this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); + //refresh page nb span + pgspan.innerHTML = this.nbPages; + //select clearing shortcut + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.innerHTML = ''; + } + + if (this.nbPages > 0) { + mdiv.style.visibility = 'visible'; + if (this.pageSelectorType === tf.fltTypeSlc) { + for (var z = 0; z < this.nbPages; z++) { + var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); + this.pagingSlc.options[z] = opt; + } + } else { + //input type + this.pagingSlc.value = this.currentPageNb; + } + } else { + /*** if no results paging select and buttons are hidden ***/ + mdiv.style.visibility = 'hidden'; + } + this.groupByPage(tf.validRowsIndex); + } + + /** + * Group table rows by page and display valid rows + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'groupByPage', + value: function groupByPage(validRows) { + var tf = this.tf; + var alternateRows = tf.feature('alternateRows'); + var rows = tf.tbl.rows; + var startPagingRow = parseInt(this.startPagingRow, 10); + var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); + + //store valid rows indexes + if (validRows) { + tf.validRowsIndex = validRows; + } + + //this loop shows valid rows of current page + for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { + var validRowIdx = tf.validRowsIndex[h]; + var r = rows[validRowIdx]; + var isRowValid = r.getAttribute('validRow'); + + if (h >= startPagingRow && h < endPagingRow) { + if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { + r.style.display = ''; + } + if (tf.alternateRows && alternateRows) { + alternateRows.setRowBg(validRowIdx, h); + } + } else { + r.style.display = 'none'; + if (tf.alternateRows && alternateRows) { + alternateRows.removeRowBg(validRowIdx); + } + } + } + + tf.nbVisibleRows = tf.validRowsIndex.length; + + // broadcast grouping by page + this.emitter.emit('grouped-by-page', tf, this); + } + + /** + * Return the current page number + * @return {Number} Page number + */ + + }, { + key: 'getPage', + value: function getPage() { + return this.currentPageNb; + } + + /** + * Show page based on passed param value (string or number): + * @param {String} or {Number} cmd possible string values: 'next', + * 'previous', 'last', 'first' or page number as per param + */ + + }, { + key: 'setPage', + value: function setPage(cmd) { + var tf = this.tf; + if (!tf.hasGrid() || !this.isEnabled()) { + return; + } + var btnEvt = this.evt, + cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); + if (cmdtype === 'string') { + switch (_string2.default.lower(cmd)) { + case 'next': + btnEvt.next(); + break; + case 'previous': + btnEvt.prev(); + break; + case 'last': + btnEvt.last(); + break; + case 'first': + btnEvt.first(); + break; + default: + btnEvt.next(); + break; + } + } else if (cmdtype === 'number') { + this.changePage(cmd - 1); + } + } + + /** + * Generates UI elements for the number of results per page drop-down + */ + + }, { + key: 'setResultsPerPage', + value: function setResultsPerPage() { + var _this3 = this; + + var tf = this.tf; + var evt = this.evt; + + if (!tf.hasGrid() && !tf.isFirstLoad) { + return; + } + if (this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + + evt.slcResultsChange = function (ev) { + _this3.changeResultsPerPage(); + ev.target.blur(); + }; + + var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); + slcR.className = this.resultsSlcCssClass; + var slcRText = this.resultsPerPage[0], + slcROpts = this.resultsPerPage[1]; + var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); + slcRSpan.className = this.resultsSpanCssClass; + + // results per page select is added to external element + if (!this.resultsPerPageTgtId) { + tf.setToolbar(); + } + var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); + slcRSpan.appendChild(_dom2.default.text(slcRText)); + + var help = tf.feature('help'); + if (help && help.btn) { + help.btn.parentNode.insertBefore(slcRSpan, help.btn); + help.btn.parentNode.insertBefore(slcR, help.btn); + } else { + targetEl.appendChild(slcRSpan); + targetEl.appendChild(slcR); + } + + for (var r = 0; r < slcROpts.length; r++) { + var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); + slcR.options[r] = currOpt; + } + _event2.default.add(slcR, 'change', evt.slcResultsChange); + this.resultsPerPageSlc = slcR; + } + + /** + * Remove number of results per page UI elements + */ + + }, { + key: 'removeResultsPerPage', + value: function removeResultsPerPage() { + var tf = this.tf; + if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + var slcR = this.resultsPerPageSlc, + slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); + if (slcR) { + _dom2.default.remove(slcR); + } + if (slcRSpan) { + _dom2.default.remove(slcRSpan); + } + this.resultsPerPageSlc = null; + } + + /** + * Change the page asynchronously according to passed index + * @param {Number} index Index of the page (0-n) + */ + + }, { + key: 'changePage', + value: function changePage(index) { + var tf = this.tf; + var evt = tf.Evt; + tf.EvtManager(evt.name.changepage, { pgIndex: index }); + } + + /** + * Change rows asynchronously according to page results + */ + + }, { + key: 'changeResultsPerPage', + value: function changeResultsPerPage() { + var tf = this.tf; + var evt = tf.Evt; + tf.EvtManager(evt.name.changeresultsperpage); + } + + /** + * Re-set asynchronously page nb at page re-load + */ + + }, { + key: 'resetPage', + value: function resetPage() { + var tf = this.tf; + var evt = tf.Evt; + tf.EvtManager(evt.name.resetpage); + } + + /** + * Re-set asynchronously page length at page re-load + */ + + }, { + key: 'resetPageLength', + value: function resetPageLength() { + var tf = this.tf; + var evt = tf.Evt; + tf.EvtManager(evt.name.resetpagelength); + } + + /** + * Change the page according to passed index + * @param {Number} index Index of the page (0-n) + */ + + }, { + key: '_changePage', + value: function _changePage(index) { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + if (index === null) { + index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; + } + if (index >= 0 && index <= this.nbPages - 1) { + if (this.onBeforeChangePage) { + this.onBeforeChangePage.call(null, this, index); + } + this.currentPageNb = parseInt(index, 10) + 1; + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.options[index].selected = true; + } else { + this.pagingSlc.value = this.currentPageNb; + } + + if (tf.rememberPageNb) { + tf.feature('store').savePageNb(tf.pgNbCookie); + } + this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; + + this.groupByPage(); + + if (this.onAfterChangePage) { + this.onAfterChangePage.call(null, this, index); + } + } + } + + /** + * Change rows according to page results drop-down + * TODO: accept a parameter setting the results per page length + */ + + }, { + key: '_changeResultsPerPage', + value: function _changeResultsPerPage() { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + var slcR = this.resultsPerPageSlc; + var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); + this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); + this.startPagingRow = this.pagingLength * slcPagesSelIndex; + + if (!isNaN(this.pagingLength)) { + if (this.startPagingRow >= tf.nbFilterableRows) { + this.startPagingRow = tf.nbFilterableRows - this.pagingLength; + } + this.setPagingInfo(); + + if (this.pageSelectorType === tf.fltTypeSlc) { + var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; + this.pagingSlc.options[slcIndex].selected = true; + } + if (tf.rememberPageLen) { + tf.feature('store').savePageLength(tf.pgLenCookie); + } + } + } + + /** + * Re-set page nb at page re-load + */ + + }, { + key: '_resetPage', + value: function _resetPage(name) { + var tf = this.tf; + var pgnb = tf.feature('store').getPageNb(name); + if (pgnb !== '') { + this.changePage(pgnb - 1); + } + } + + /** + * Re-set page length value at page re-load + */ + + }, { + key: '_resetPageLength', + value: function _resetPageLength(name) { + var tf = this.tf; + if (!this.isEnabled()) { + return; + } + var pglenIndex = tf.feature('store').getPageLength(name); + + if (pglenIndex !== '') { + this.resultsPerPageSlc.options[pglenIndex].selected = true; + this.changeResultsPerPage(); + } + } + + /** + * Remove paging feature + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + var tf = this.tf; + + if (!this.initialized) { + return; + } + // btns containers + var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); + var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); + var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); + var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); + //span containing 'Page' text + var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); + //span containing 'of' text + var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); + //span containing nb of pages + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + var evt = this.evt; + + if (this.pagingSlc) { + if (this.pageSelectorType === tf.fltTypeSlc) { + _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); + } else if (this.pageSelectorType === tf.fltTypeInp) { + _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); + } + _dom2.default.remove(this.pagingSlc); + } + + if (btnNextSpan) { + _event2.default.remove(btnNextSpan, 'click', evt.next); + _dom2.default.remove(btnNextSpan); + } + + if (btnPrevSpan) { + _event2.default.remove(btnPrevSpan, 'click', evt.prev); + _dom2.default.remove(btnPrevSpan); + } + + if (btnLastSpan) { + _event2.default.remove(btnLastSpan, 'click', evt.last); + _dom2.default.remove(btnLastSpan); + } + + if (btnFirstSpan) { + _event2.default.remove(btnFirstSpan, 'click', evt.first); + _dom2.default.remove(btnFirstSpan); + } + + if (pgBeforeSpan) { + _dom2.default.remove(pgBeforeSpan); + } + + if (pgAfterSpan) { + _dom2.default.remove(pgAfterSpan); + } + + if (pgspan) { + _dom2.default.remove(pgspan); + } + + if (this.hasResultsPerPage) { + this.removeResultsPerPage(); + } + + this.emitter.off('after-filtering', function () { + return _this4.resetPagingInfo(); + }); + + this.pagingSlc = null; + this.nbPages = 0; + this.disable(); + this.initialized = false; + } + }]); + + return Paging; + })(_feature.Feature); + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.ClearButton = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var ClearButton = exports.ClearButton = (function (_Feature) { + _inherits(ClearButton, _Feature); + + /** + * Clear button component + * @param {Object} tf TableFilter instance + */ + + function ClearButton(tf) { + _classCallCheck(this, ClearButton); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); + + var f = _this.config; + + //id of container element + _this.btnResetTgtId = f.btn_reset_target_id || null; + //reset button element + _this.btnResetEl = null; + //defines reset text + _this.btnResetText = f.btn_reset_text || 'Reset'; + //defines reset button tooltip + _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; + //defines reset button innerHtml + _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); + //span containing reset button + _this.prfxResetSpan = 'resetspan_'; + return _this; + } + + _createClass(ClearButton, [{ + key: 'onClick', + value: function onClick() { + if (!this.isEnabled()) { + return; + } + this.tf.clearFilters(); + } + + /** + * Build DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + + if (this.initialized) { + return; + } + + var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); + + // reset button is added to defined element + if (!this.btnResetTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); + targetEl.appendChild(resetspan); + + if (!this.btnResetHtml) { + var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); + fltreset.className = tf.btnResetCssClass; + fltreset.appendChild(_dom2.default.text(this.btnResetText)); + resetspan.appendChild(fltreset); + _event2.default.add(fltreset, 'click', function () { + _this2.onClick(); + }); + } else { + resetspan.innerHTML = this.btnResetHtml; + var resetEl = resetspan.firstChild; + _event2.default.add(resetEl, 'click', function () { + _this2.onClick(); + }); + } + this.btnResetEl = resetspan.firstChild; + + this.initialized = true; + } + + /** + * Remove clear button UI + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + + if (!this.initialized) { + return; + } + + var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); + if (resetspan) { + _dom2.default.remove(resetspan); + } + this.btnResetEl = null; + this.initialized = false; + } + }]); + + return ClearButton; + })(_feature.Feature); + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Help = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; + var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; + + var Help = exports.Help = (function (_Feature) { + _inherits(Help, _Feature); + + /** + * Help UI component + * @param {Object} tf TableFilter instance + */ + + function Help(tf) { + _classCallCheck(this, Help); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); + + var f = _this.config; + + //id of custom container element for instructions + _this.tgtId = f.help_instructions_target_id || null; + //id of custom container element for instructions + _this.contTgtId = f.help_instructions_container_target_id || null; + //defines help text + _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; + //defines help innerHtml + _this.instrHtml = f.help_instructions_html || null; + //defines reset button text + _this.btnText = f.help_instructions_btn_text || '?'; + //defines reset button innerHtml + _this.btnHtml = f.help_instructions_btn_html || null; + //defines css class for help button + _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; + //defines css class for help container + _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; + //help button element + _this.btn = null; + //help content div + _this.cont = null; + _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; + + //id prefix for help elements + _this.prfxHelpSpan = 'helpSpan_'; + //id prefix for help elements + _this.prfxHelpDiv = 'helpDiv_'; + return _this; + } + + _createClass(Help, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); + var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); + + //help button is added to defined element + if (!this.tgtId) { + tf.setToolbar(); + } + var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); + targetEl.appendChild(helpspan); + + var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); + + if (!this.btnHtml) { + divContainer.appendChild(helpdiv); + var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); + helplink.className = this.btnCssClass; + helplink.appendChild(_dom2.default.text(this.btnText)); + helpspan.appendChild(helplink); + _event2.default.add(helplink, 'click', function () { + _this2.toggle(); + }); + } else { + helpspan.innerHTML = this.btnHtml; + var helpEl = helpspan.firstChild; + _event2.default.add(helpEl, 'click', function () { + _this2.toggle(); + }); + divContainer.appendChild(helpdiv); + } + + if (!this.instrHtml) { + helpdiv.innerHTML = this.instrText; + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } else { + if (this.contTgtId) { + divContainer.appendChild(helpdiv); + } + helpdiv.innerHTML = this.instrHtml; + if (!this.contTgtId) { + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } + } + helpdiv.innerHTML += this.defaultHtml; + _event2.default.add(helpdiv, 'click', function () { + _this2.toggle(); + }); + + this.cont = helpdiv; + this.btn = helpspan; + this.initialized = true; + } + + /** + * Toggle help pop-up + */ + + }, { + key: 'toggle', + value: function toggle() { + // check only if explicitily set to false as in this case undefined + // signifies the help feature is enabled by default + if (this.enabled === false) { + return; + } + var divDisplay = this.cont.style.display; + if (divDisplay === '' || divDisplay === 'none') { + this.cont.style.display = 'inline'; + } else { + this.cont.style.display = 'none'; + } + } + + /** + * Remove help UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + _dom2.default.remove(this.btn); + this.btn = null; + if (!this.cont) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + this.initialized = false; + } + }]); + + return Help; + })(_feature.Feature); + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.AlternateRows = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var AlternateRows = exports.AlternateRows = (function (_Feature) { + _inherits(AlternateRows, _Feature); + + /** + * Alternating rows color + * @param {Object} tf TableFilter instance + */ + + function AlternateRows(tf) { + _classCallCheck(this, AlternateRows); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); + + var config = _this.config; + //defines css class for even rows + _this.evenCss = config.even_row_css_class || 'even'; + //defines css class for odd rows + _this.oddCss = config.odd_row_css_class || 'odd'; + return _this; + } + + /** + * Sets alternating rows color + */ + + _createClass(AlternateRows, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + var tf = this.tf; + var validRowsIndex = tf.validRowsIndex; + var noValidRowsIndex = validRowsIndex === null; + //1st index + var beginIndex = noValidRowsIndex ? tf.refRow : 0; + // nb indexes + var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; + var idx = 0; + + //alternates bg color + for (var j = beginIndex; j < indexLen; j++) { + var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; + this.setRowBg(rowIdx, idx); + idx++; + } + this.initialized = true; + } + + /** + * Sets row background color + * @param {Number} rowIdx Row index + * @param {Number} idx Valid rows collection index needed to calculate bg + * color + */ + + }, { + key: 'setRowBg', + value: function setRowBg(rowIdx, idx) { + if (!this.isEnabled() || isNaN(rowIdx)) { + return; + } + var rows = this.tf.tbl.rows; + var i = isNaN(idx) ? rowIdx : idx; + this.removeRowBg(rowIdx); + + _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); + } + + /** + * Removes row background color + * @param {Number} idx Row index + */ + + }, { + key: 'removeRowBg', + value: function removeRowBg(idx) { + if (isNaN(idx)) { + return; + } + var rows = this.tf.tbl.rows; + _dom2.default.removeClass(rows[idx], this.oddCss); + _dom2.default.removeClass(rows[idx], this.evenCss); + } + + /** + * Removes all alternating backgrounds + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { + this.removeRowBg(i); + } + this.initialized = false; + } + }]); + + return AlternateRows; + })(_feature.Feature); + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.NoResults = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var NoResults = exports.NoResults = (function (_Feature) { + _inherits(NoResults, _Feature); + + /** + * No results message UI component + * @param {Object} tf TableFilter instance + */ + + function NoResults(tf) { + _classCallCheck(this, NoResults); + + //configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); + + var f = _this.config.no_results_message; + + _this.content = f.content || 'No results'; + _this.customContainer = f.custom_container || null; + _this.customContainerId = f.custom_container_id || null; + _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); + _this.cssClass = f.css_class || 'no-results'; + + _this.cont = null; + + //callback before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //callback after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + //callback before message is hidden + _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; + //callback after message is hidden + _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; + + _this.prfxNoResults = 'nores_'; + return _this; + } + + _createClass(NoResults, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + var tf = this.tf; + var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; + + //container + var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); + cont.className = this.cssClass; + cont.innerHTML = this.content; + + if (this.isExternal) { + target.appendChild(cont); + } else { + target.parentNode.insertBefore(cont, target.nextSibling); + } + + this.cont = cont; + + // subscribe to after-filtering event + this.emitter.on('after-filtering', function () { + return _this2.toggle(); + }); + + this.initialized = true; + this.hide(); + } + }, { + key: 'toggle', + value: function toggle() { + if (this.tf.nbVisibleRows > 0) { + this.hide(); + } else { + this.show(); + } + } + }, { + key: 'show', + value: function show() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, this); + } + + this.setWidth(); + this.cont.style.display = 'block'; + + if (this.onAfterShowMsg) { + this.onAfterShowMsg.call(null, this.tf, this); + } + } + }, { + key: 'hide', + value: function hide() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + + this.cont.style.display = 'none'; + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + } + }, { + key: 'setWidth', + value: function setWidth() { + if (!this.initialized || this.isExternal || !this.isEnabled()) { + return; + } + if (this.tf.gridLayout) { + var gridLayout = this.tf.feature('gridLayout'); + this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; + } else { + this.cont.style.width = this.tf.tbl.clientWidth + 'px'; + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + // unsubscribe to after-filtering event + this.emitter.off('after-filtering', function () { + return _this3.toggle(); + }); + this.initialized = false; + } + }]); + + return NoResults; + })(_feature.Feature); + +/***/ } +/******/ ]) +}); +; +//# sourceMappingURL=tablefilter.js.map \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index f7cdac07..58cc1966 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,8 +1,2218 @@ -/** - * tablefilter v0.1.0 by Max Guglielmi - * build date: 2015-12-28T06:48:43.385Z - * MIT License - */ +webpackJsonp([1],{ -webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),g=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+g?d[l+g]:[u-1]:l-g<=d[0]?d[0]:d[l-g],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var m=l+g;o=m>u-1?d[u-1]:d[m]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-g];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var g=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),g&&g.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(m){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off("after-filtering",function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file +/***/ 26: +/***/ function(module, exports, __webpack_require__) { + + var map = { + "./array": 6, + "./array.js": 6, + "./cookie": 4, + "./cookie.js": 4, + "./date": 7, + "./date.js": 7, + "./dom": 2, + "./dom.js": 2, + "./emitter": 9, + "./emitter.js": 9, + "./event": 1, + "./event.js": 1, + "./extensions/advancedGrid/adapterEzEditTable": 27, + "./extensions/advancedGrid/adapterEzEditTable.js": 27, + "./extensions/advancedGrid/advancedGrid": 28, + "./extensions/advancedGrid/advancedGrid.js": 28, + "./extensions/colOps/colOps": 29, + "./extensions/colOps/colOps.js": 29, + "./extensions/colsVisibility/colsVisibility": 30, + "./extensions/colsVisibility/colsVisibility.js": 30, + "./extensions/filtersVisibility/filtersVisibility": 31, + "./extensions/filtersVisibility/filtersVisibility.js": 31, + "./extensions/sort/adapterSortabletable": 32, + "./extensions/sort/adapterSortabletable.js": 32, + "./extensions/sort/sort": 33, + "./extensions/sort/sort.js": 33, + "./helpers": 8, + "./helpers.js": 8, + "./modules/alternateRows": 24, + "./modules/alternateRows.js": 24, + "./modules/checkList": 18, + "./modules/checkList.js": 18, + "./modules/clearButton": 22, + "./modules/clearButton.js": 22, + "./modules/dropdown": 16, + "./modules/dropdown.js": 16, + "./modules/feature": 12, + "./modules/feature.js": 12, + "./modules/gridLayout": 11, + "./modules/gridLayout.js": 11, + "./modules/help": 23, + "./modules/help.js": 23, + "./modules/highlightKeywords": 14, + "./modules/highlightKeywords.js": 14, + "./modules/loader": 13, + "./modules/loader.js": 13, + "./modules/noResults": 25, + "./modules/noResults.js": 25, + "./modules/paging": 21, + "./modules/paging.js": 21, + "./modules/popupFilter": 15, + "./modules/popupFilter.js": 15, + "./modules/rowsCounter": 19, + "./modules/rowsCounter.js": 19, + "./modules/statusBar": 20, + "./modules/statusBar.js": 20, + "./modules/store": 10, + "./modules/store.js": 10, + "./sort": 17, + "./sort.js": 17, + "./string": 3, + "./string.js": 3, + "./types": 5, + "./types.js": 5 + }; + function webpackContext(req) { + return __webpack_require__(webpackContextResolve(req)); + }; + function webpackContextResolve(req) { + return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); + }; + webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); + }; + webpackContext.resolve = webpackContextResolve; + module.exports = webpackContext; + webpackContext.id = 26; + + +/***/ }, + +/***/ 27: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterEzEditTable = (function () { + /** + * Adapter module for ezEditTable, an external library providing advanced + * grid features (selection and edition): + * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus + * + * @param {Object} tf TableFilter instance + */ + + function AdapterEzEditTable(tf, cfg) { + _classCallCheck(this, AdapterEzEditTable); + + // ezEditTable config + this.initialized = false; + this.desc = cfg.description || 'ezEditTable adapter'; + this.filename = cfg.filename || 'ezEditTable.js'; + this.vendorPath = cfg.vendor_path; + this.loadStylesheet = Boolean(cfg.load_stylesheet); + this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; + this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; + this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; + // Enable the ezEditTable's scroll into view behaviour if grid layout on + cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; + + this._ezEditTable = null; + this.cfg = cfg; + this.tf = tf; + } + + /** + * Conditionally load ezEditTable library and set advanced grid + * @return {[type]} [description] + */ + + _createClass(AdapterEzEditTable, [{ + key: 'init', + value: function init() { + var _this = this; + + var tf = this.tf; + if (window.EditTable) { + this._setAdvancedGrid(); + } else { + var path = this.vendorPath + this.filename; + tf.import(this.filename, path, function () { + _this._setAdvancedGrid(); + }); + } + if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { + tf.import(this.stylesheetName, this.stylesheet, null, 'link'); + } + } + + /** + * Instantiate ezEditTable component for advanced grid features + */ + + }, { + key: '_setAdvancedGrid', + value: function _setAdvancedGrid() { + var tf = this.tf; + + //start row for EditTable constructor needs to be calculated + var startRow, + cfg = this.cfg, + thead = _dom2.default.tag(tf.tbl, 'thead'); + + //if thead exists and startRow not specified, startRow is calculated + //automatically by EditTable + if (thead.length > 0 && !cfg.startRow) { + startRow = undefined; + } + //otherwise startRow config property if any or TableFilter refRow + else { + startRow = cfg.startRow || tf.refRow; + } + + cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; + var editable = cfg.editable; + var selectable = cfg.selection; + + if (selectable) { + cfg.default_selection = cfg.default_selection || 'row'; + } + //CSS Styles + cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; + + var _lastValidRowIndex = 0; + var _lastRowIndex = 0; + + if (selectable) { + //Row navigation needs to be calculated according to TableFilter's + //validRowsIndex array + var onAfterSelection = function onAfterSelection(et, selectedElm, e) { + var slc = et.Selection; + //Next valid filtered row needs to be selected + var doSelect = function doSelect(nextRowIndex) { + if (et.defaultSelection === 'row') { + slc.SelectRowByIndex(nextRowIndex); + } else { + et.ClearSelections(); + var cellIndex = selectedElm.cellIndex, + row = tf.tbl.rows[nextRowIndex]; + if (et.defaultSelection === 'both') { + slc.SelectRowByIndex(nextRowIndex); + } + if (row) { + slc.SelectCell(row.cells[cellIndex]); + } + } + //Table is filtered + if (tf.validRowsIndex.length !== tf.getRowsNb()) { + var r = tf.tbl.rows[nextRowIndex]; + if (r) { + r.scrollIntoView(false); + } + if (cell) { + if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { + tf.tblCont.scrollLeft = 100000000; + } else if (cell.cellIndex === 0 && tf.gridLayout) { + tf.tblCont.scrollLeft = 0; + } else { + cell.scrollIntoView(false); + } + } + } + }; + + //table is not filtered + if (!tf.validRowsIndex) { + return; + } + var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, + nextRowIndex, + paging = tf.feature('paging'), + + //pgup/pgdown keys + d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { + //last row + if (row.rowIndex >= validIndexes[validIdxLen - 1]) { + nextRowIndex = validIndexes[validIdxLen - 1]; + } else { + var calcRowIndex = _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[_lastValidRowIndex - d]; + nextRowIndex = v ? v : validIndexes[0]; + } + } + _lastRowIndex = row.rowIndex; + doSelect(nextRowIndex); + } else { + //If filtered row is valid, special calculation for + //pgup/pgdown keys + if (keyCode !== 34 && keyCode !== 33) { + _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); + _lastRowIndex = row.rowIndex; + } else { + if (keyCode === 34) { + //pgdown + //last row + if (_lastValidRowIndex + d <= validIdxLen - 1) { + nextRowIndex = validIndexes[_lastValidRowIndex + d]; + } else { + nextRowIndex = [validIdxLen - 1]; + } + } else { + //pgup + //first row + if (_lastValidRowIndex - d <= validIndexes[0]) { + nextRowIndex = validIndexes[0]; + } else { + nextRowIndex = validIndexes[_lastValidRowIndex - d]; + } + } + _lastRowIndex = nextRowIndex; + _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); + doSelect(nextRowIndex); + } + } + }; + + //Page navigation has to be enforced whenever selected row is out of + //the current page range + var onBeforeSelection = function onBeforeSelection(et, selectedElm) { + var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; + if (tf.paging) { + if (tf.feature('paging').nbPages > 1) { + var paging = tf.feature('paging'); + //page length is re-assigned in case it has changed + et.nbRowsPerPage = paging.pagingLength; + var validIndexes = tf.validRowsIndex, + validIdxLen = validIndexes.length, + pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); + var rowIndex = row.rowIndex; + + if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { + paging.setPage('last'); + } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { + paging.setPage('first'); + } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { + paging.setPage('next'); + } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { + paging.setPage('previous'); + } + } + } + }; + + //Selected row needs to be visible when paging is activated + if (tf.paging) { + tf.feature('paging').onAfterChangePage = function (paging) { + var advGrid = paging.tf.extension('advancedGrid'); + var et = advGrid._ezEditTable; + var slc = et.Selection; + var row = slc.GetActiveRow(); + if (row) { + row.scrollIntoView(false); + } + var cell = slc.GetActiveCell(); + if (cell) { + cell.scrollIntoView(false); + } + }; + } + + //Rows navigation when rows are filtered is performed with the + //EditTable row selection callback events + if (cfg.default_selection === 'row') { + var fnB = cfg.on_before_selected_row; + cfg.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 = cfg.on_after_selected_row; + cfg.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 = cfg.on_before_selected_cell; + cfg.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 = cfg.on_after_selected_cell; + cfg.on_after_selected_cell = function () { + onAfterSelection(arguments[0], arguments[1], arguments[2]); + if (fnC) { + fnC.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + } + } + if (editable) { + //Added or removed rows, TF rows number needs to be re-calculated + var fnE = cfg.on_added_dom_row; + cfg.on_added_dom_row = function () { + tf.nbFilterableRows++; + if (!tf.paging) { + tf.emitter.emit('rows-changed', tf, this); + //tf.feature('rowsCounter').refresh(); + } else { + tf.nbRows++; + tf.nbVisibleRows++; + tf.nbFilterableRows++; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnE) { + fnE.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + if (cfg.actions && cfg.actions['delete']) { + var fnF = cfg.actions['delete'].on_after_submit; + cfg.actions['delete'].on_after_submit = function () { + tf.nbFilterableRows--; + if (!tf.paging) { + // tf.feature('rowsCounter').refresh(); + tf.emitter.emit('rows-changed', tf, this); + } else { + tf.nbRows--; + tf.nbVisibleRows--; + tf.nbFilterableRows--; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(false); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnF) { + fnF.call(null, arguments[0], arguments[1]); + } + }; + } + } + + try { + this._ezEditTable = new EditTable(tf.id, cfg, startRow); + this._ezEditTable.Init(); + } catch (e) { + throw new Error(this.err); + } + + this.initialized = true; + } + + /** + * Reset advanced grid when previously removed + */ + + }, { + key: 'reset', + value: function reset() { + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.Set(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Set(); + } + } + } + + /** + * Remove advanced grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.ClearSelections(); + ezEditTable.Selection.Remove(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Remove(); + } + } + this.initialized = false; + } + }]); + + return AdapterEzEditTable; + })(); + + exports.default = AdapterEzEditTable; + +/***/ }, + +/***/ 28: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterEzEditTable = __webpack_require__(27); + + var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = _adapterEzEditTable2.default; + +/***/ }, + +/***/ 29: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColOps = (function () { + + /** + * Column calculations + * @param {Object} tf TableFilter instance + */ + + function ColOps(tf, opts) { + _classCallCheck(this, ColOps); + + //calls function before col operation + this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; + //calls function after col operation + this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; + + this.opts = opts; + this.tf = tf; + } + + _createClass(ColOps, [{ + key: 'init', + value: function init() { + var _this = this; + + // subscribe to events + this.tf.emitter.on('after-filtering', function () { + return _this.calc(); + }); + + this.calc(); + } + + /** + * Calculates columns' values + * Configuration options are stored in 'opts' property + * - 'id' contains ids of elements showing result (array) + * - 'col' contains the columns' indexes (array) + * - 'operation' contains operation type (array, values: 'sum', 'mean', + * 'min', 'max', 'median', 'q1', 'q3') + * - 'write_method' array defines which method to use for displaying the + * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' + * - 'tot_row_index' defines in which row results are displayed + * (integers array) + * + * - changes made by Nuovella: + * (1) optimized the routine (now it will only process each column once), + * (2) added calculations for the median, lower and upper quartile. + */ + + }, { + key: 'calc', + value: function calc() { + var tf = this.tf; + if (!tf.isFirstLoad && !tf.hasGrid()) { + return; + } + + if (this.onBeforeOperation) { + this.onBeforeOperation.call(null, tf); + } + + var opts = this.opts, + labelId = opts.id, + colIndex = opts.col, + operation = opts.operation, + outputType = opts.write_method, + totRowIndex = opts.tot_row_index, + excludeRow = opts.exclude_row, + decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; + + //nuovella: determine unique list of columns to operate on + var ucolIndex = [], + ucolMax = 0; + ucolIndex[ucolMax] = colIndex[0]; + + for (var ii = 1; ii < colIndex.length; ii++) { + var saved = 0; + //see if colIndex[ii] is already in the list of unique indexes + for (var jj = 0; jj <= ucolMax; jj++) { + if (ucolIndex[jj] === colIndex[ii]) { + saved = 1; + } + } + //if not saved then, save the index; + if (saved === 0) { + ucolMax++; + ucolIndex[ucolMax] = colIndex[ii]; + } + } + + if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { + var rows = tf.tbl.rows, + colvalues = []; + + for (var ucol = 0; ucol <= ucolMax; ucol++) { + //this retrieves col values + //use ucolIndex because we only want to pass through this loop + //once for each column get the values in this unique column + colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); + + //next: calculate all operations for this column + 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; + + for (var k = 0; k < colIndex.length; k++) { + if (colIndex[k] === ucolIndex[ucol]) { + mThisCol++; + opsThisCol[mThisCol] = _string2.default.lower(operation[k]); + decThisCol[mThisCol] = decimalPrecision[k]; + labThisCol[mThisCol] = labelId[k]; + oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; + + switch (opsThisCol[mThisCol]) { + case 'mean': + meanFlag = 1; + break; + case 'sum': + sumFlag = 1; + break; + case 'min': + minFlag = 1; + break; + case 'max': + maxFlag = 1; + break; + case 'median': + medFlag = 1; + break; + case 'q1': + q1Flag = 1; + break; + case 'q3': + q3Flag = 1; + break; + } + } + } + + for (var j = 0; j < colvalues[ucol].length; j++) { + //sort the list for calculation of median and quartiles + if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { + if (j < colvalues[ucol].length - 1) { + for (k = j + 1; k < colvalues[ucol].length; k++) { + if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { + temp = colvalues[ucol][j]; + colvalues[ucol][j] = colvalues[ucol][k]; + colvalues[ucol][k] = temp; + } + } + } + } + var cvalue = parseFloat(colvalues[ucol][j]); + theList[j] = parseFloat(cvalue); + + if (!isNaN(cvalue)) { + nbvalues++; + if (sumFlag === 1 || meanFlag === 1) { + sumValue += parseFloat(cvalue); + } + if (minFlag === 1) { + if (minValue === null) { + minValue = parseFloat(cvalue); + } else { + minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; + } + } + if (maxFlag === 1) { + if (maxValue === null) { + maxValue = parseFloat(cvalue); + } else { + maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; + } + } + } + } //for j + if (meanFlag === 1) { + meanValue = sumValue / nbvalues; + } + if (medFlag === 1) { + var aux = 0; + if (nbvalues % 2 === 1) { + aux = Math.floor(nbvalues / 2); + medValue = theList[aux]; + } else { + medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; + } + } + var posa; + if (q1Flag === 1) { + posa = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa == nbvalues) { + q1Value = (theList[posa - 1] + theList[posa]) / 2; + } else { + q1Value = theList[posa]; + } + } + if (q3Flag === 1) { + posa = 0.0; + var posb = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa === nbvalues) { + posb = 3 * posa; + q3Value = (theList[posb] + theList[posb - 1]) / 2; + } else { + q3Value = theList[nbvalues - posa - 1]; + } + } + + for (var i = 0; i <= mThisCol; i++) { + switch (opsThisCol[i]) { + case 'mean': + result = meanValue; + break; + case 'sum': + result = sumValue; + break; + case 'min': + result = minValue; + break; + case 'max': + result = maxValue; + break; + case 'median': + result = medValue; + break; + case 'q1': + result = q1Value; + break; + case 'q3': + result = q3Value; + break; + } + + var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; + + //if outputType is defined + if (oTypeThisCol && result) { + result = result.toFixed(precision); + + if (_dom2.default.id(labThisCol[i])) { + switch (_string2.default.lower(oTypeThisCol)) { + case 'innerhtml': + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result; + } + break; + case 'setvalue': + _dom2.default.id(labThisCol[i]).value = result; + break; + case 'createtextnode': + var oldnode = _dom2.default.id(labThisCol[i]).firstChild; + var txtnode = _dom2.default.text(result); + _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); + break; + } //switch + } + } else { + try { + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); + } + } catch (e) {} //catch + } //else + } //for i + + // row(s) with result are always visible + var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; + if (totRow) { + totRow.style.display = ''; + } + } //for ucol + } //if typeof + + if (this.onAfterOperation) { + this.onAfterOperation.call(null, tf); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + // unsubscribe to events + this.tf.emitter.off('after-filtering', function () { + return _this2.calc(); + }); + } + }]); + + return ColOps; + })(); + + exports.default = ColOps; + +/***/ }, + +/***/ 30: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColsVisibility = (function () { + + /** + * Columns Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function ColsVisibility(tf, f) { + _classCallCheck(this, ColsVisibility); + + // Configuration object + var cfg = tf.config(); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Columns visibility manager'; + + //show/hide cols span element + this.spanEl = null; + //show/hide cols button element + this.btnEl = null; + //show/hide cols container div element + this.contEl = null; + + //tick to hide or show column + this.tickToHide = f.tick_to_hide === false ? false : true; + //enables/disables cols manager generation + this.manager = f.manager === false ? false : true; + //only if external headers + this.headersTbl = f.headers_table || false; + //only if external headers + this.headersIndex = f.headers_index || 1; + //id of container element + this.contElTgtId = f.container_target_id || null; + //alternative headers text + this.headersText = f.headers_text || null; + //id of button container element + this.btnTgtId = f.btn_target_id || null; + //defines show/hide cols text + this.btnText = f.btn_text || 'Columns▼'; + //defines show/hide cols button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for show/hide cols button + this.btnCssClass = f.btn_css_class || 'colVis'; + //defines close link text + this.btnCloseText = f.btn_close_text || 'Close'; + //defines close button innerHtml + this.btnCloseHtml = f.btn_close_html || null; + //defines css class for close button + this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; + this.stylesheet = f.stylesheet || 'colsVisibility.css'; + //span containing show/hide cols button + this.prfx = 'colVis_'; + //defines css class span containing show/hide cols + this.spanCssClass = f.span_css_class || 'colVisSpan'; + this.prfxCont = this.prfx + 'Cont_'; + //defines css class div containing show/hide cols + this.contCssClass = f.cont_css_class || 'colVisCont'; + //defines css class for cols list (ul) + this.listCssClass = cfg.list_css_class || 'cols_checklist'; + //defines css class for list item (li) + this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; + //defines css class for selected list item (li) + this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; + //text preceding columns list + this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); + this.atStart = f.at_start || null; + this.enableHover = Boolean(f.enable_hover); + //enables select all option + this.enableTickAll = Boolean(f.enable_tick_all); + //text preceding columns list + this.tickAllText = f.tick_all_text || 'Select all:'; + + //array containing hidden columns indexes + this.hiddenCols = []; + this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; + + //callback invoked just after cols manager is loaded + this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; + //calls function before cols manager is opened + this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; + //calls function after cols manager is opened + this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; + //calls function before cols manager is closed + this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; + //calls function after cols manager is closed + this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; + + //callback before col is hidden + this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; + //callback after col is hidden + this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; + //callback before col is displayed + this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; + //callback after col is displayed + this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; + + //Grid layout compatibility + if (tf.gridLayout) { + this.headersTbl = tf.feature('gridLayout').headTbl; //headers table + this.headersIndex = 0; //headers index + this.onAfterColDisplayed = function () {}; + this.onAfterColHidden = function () {}; + } + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + _createClass(ColsVisibility, [{ + key: 'toggle', + value: function toggle() { + var contDisplay = this.contEl.style.display; + var onBeforeOpen = this.onBeforeOpen; + var onBeforeClose = this.onBeforeClose; + var onAfterOpen = this.onAfterOpen; + var onAfterClose = this.onAfterClose; + + if (onBeforeOpen && contDisplay !== 'inline') { + onBeforeOpen.call(null, this); + } + if (onBeforeClose && contDisplay === 'inline') { + onBeforeClose.call(null, this); + } + + this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; + + if (onAfterOpen && contDisplay !== 'inline') { + onAfterOpen.call(null, this); + } + if (onAfterClose && contDisplay === 'inline') { + onAfterClose.call(null, this); + } + } + }, { + key: 'checkItem', + value: function checkItem(lbl) { + var li = lbl.parentNode; + if (!li || !lbl) { + return; + } + var isChecked = lbl.firstChild.checked; + var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; + colIndex = parseInt(colIndex, 10); + if (isChecked) { + _dom2.default.addClass(li, this.listSlcItemCssClass); + } else { + _dom2.default.removeClass(li, this.listSlcItemCssClass); + } + + var hide = false; + if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { + hide = true; + } + this.setHidden(colIndex, hide); + } + }, { + key: 'init', + value: function init() { + if (!this.manager) { + return; + } + this.buildBtn(); + this.buildManager(); + + this.initialized = true; + } + + /** + * Build main button UI + */ + + }, { + key: 'buildBtn', + value: function buildBtn() { + var _this = this; + + if (this.btnEl) { + return; + } + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.spanCssClass; + + //Container element (rdiv or custom element) + if (!this.btnTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); + + if (!this.btnTgtId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + if (!this.btnHtml) { + var btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCssClass; + btn.title = this.desc; + + btn.innerHTML = this.btnText; + span.appendChild(btn); + if (!this.enableHover) { + _event2.default.add(btn, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(btn, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } else { + //Custom html + span.innerHTML = this.btnHtml; + var colVisEl = span.firstChild; + if (!this.enableHover) { + _event2.default.add(colVisEl, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(colVisEl, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } + + this.spanEl = span; + this.btnEl = this.spanEl.firstChild; + + if (this.onLoaded) { + this.onLoaded.call(null, this); + } + } + + /** + * Build columns manager UI + */ + + }, { + key: 'buildManager', + value: function buildManager() { + var _this2 = this; + + var tf = this.tf; + + var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); + container.className = this.contCssClass; + + //Extension description + var extNameLabel = _dom2.default.create('p'); + extNameLabel.innerHTML = this.text; + container.appendChild(extNameLabel); + + //Headers list + var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); + ul.className = this.listCssClass; + + var tbl = this.headersTbl ? this.headersTbl : tf.tbl; + var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); + var headerRow = tbl.rows[headerIndex]; + + //Tick all option + if (this.enableTickAll) { + var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); + _dom2.default.addClass(li, this.listItemCssClass); + ul.appendChild(li); + li.check.checked = !this.tickToHide; + + _event2.default.add(li.check, 'click', function () { + for (var h = 0; h < headerRow.cells.length; h++) { + var itm = _dom2.default.id('col_' + h + '_' + tf.id); + if (itm && li.check.checked !== itm.checked) { + itm.click(); + itm.checked = li.check.checked; + } + } + }); + } + + for (var i = 0; i < headerRow.cells.length; i++) { + var cell = headerRow.cells[i]; + var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); + var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); + _dom2.default.addClass(liElm, this.listItemCssClass); + if (!this.tickToHide) { + _dom2.default.addClass(liElm, this.listSlcItemCssClass); + } + ul.appendChild(liElm); + if (!this.tickToHide) { + liElm.check.checked = true; + } + + _event2.default.add(liElm.check, 'click', function (evt) { + var elm = _event2.default.target(evt); + var lbl = elm.parentNode; + _this2.checkItem(lbl); + }); + } + + //separator + var p = _dom2.default.create('p', ['align', 'center']); + var btn; + //Close link + if (!this.btnCloseHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCloseCssClass; + btn.innerHTML = this.btnCloseText; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + p.appendChild(btn); + } else { + p.innerHTML = this.btnCloseHtml; + btn = p.firstChild; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + } + + container.appendChild(ul); + container.appendChild(p); + + this.btnEl.parentNode.insertBefore(container, this.btnEl); + this.contEl = container; + + if (this.atStart) { + var a = this.atStart; + for (var k = 0; k < a.length; k++) { + var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); + if (itm) { + itm.click(); + } + } + } + } + + /** + * Hide or show specified columns + * @param {Numner} colIndex Column index + * @param {Boolean} hide hide column if true or show if false + */ + + }, { + key: 'setHidden', + value: function setHidden(colIndex, hide) { + var tf = this.tf; + var tbl = tf.tbl; + + if (this.onBeforeColHidden && hide) { + this.onBeforeColHidden.call(null, this, colIndex); + } + if (this.onBeforeColDisplayed && !hide) { + this.onBeforeColDisplayed.call(null, this, colIndex); + } + + this._hideCells(tbl, colIndex, hide); + if (this.headersTbl) { + this._hideCells(this.headersTbl, colIndex, hide); + } + + var hiddenCols = this.hiddenCols; + var itemIndex = hiddenCols.indexOf(colIndex); + if (hide) { + if (itemIndex === -1) { + this.hiddenCols.push(colIndex); + } + } else { + if (itemIndex !== -1) { + this.hiddenCols.splice(itemIndex, 1); + } + } + + var gridLayout; + var headTbl; + var gridColElms; + if (this.onAfterColHidden && hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); + + var headTblW = parseInt(headTbl.style.width, 10); + headTbl.style.width = headTblW - hiddenWidth + 'px'; + tbl.style.width = headTbl.style.width; + } + this.onAfterColHidden.call(null, this, colIndex); + } + + if (this.onAfterColDisplayed && !hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var width = parseInt(gridColElms[colIndex].style.width, 10); + headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; + tf.tbl.style.width = headTbl.style.width; + } + this.onAfterColDisplayed.call(null, this, colIndex); + } + } + + /** + * Show specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'showCol', + value: function showCol(colIndex) { + if (colIndex === undefined || !this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, false); + } + } + + /** + * Hide specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'hideCol', + value: function hideCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, true); + } + } + + /** + * Determine if specified column is hidden + * @param {Number} colIndex Column index + */ + + }, { + key: 'isColHidden', + value: function isColHidden(colIndex) { + if (this.hiddenCols.indexOf(colIndex) !== -1) { + return true; + } + return false; + } + + /** + * Toggle visibility of specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggleCol', + value: function toggleCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + this.showCol(colIndex); + } else { + this.hideCol(colIndex); + } + } + + /** + * Returns the indexes of the columns currently hidden + * @return {Array} column indexes + */ + + }, { + key: 'getHiddenCols', + value: function getHiddenCols() { + return this.hiddenCols; + } + + /** + * Remove the columns manager + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + if (_dom2.default.id(this.contElTgtId)) { + _dom2.default.id(this.contElTgtId).innerHTML = ''; + } else { + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + } + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + this.initialized = false; + } + }, { + key: '_getHeaderText', + value: function _getHeaderText(cell) { + if (!cell.hasChildNodes) { + return ''; + } + + for (var i = 0; i < cell.childNodes.length; i++) { + var n = cell.childNodes[i]; + if (n.nodeType === 3) { + return n.nodeValue; + } else if (n.nodeType === 1) { + if (n.id && n.id.indexOf('popUp') !== -1) { + continue; + } else { + return _dom2.default.getText(n); + } + } + continue; + } + return ''; + } + }, { + key: '_hideCells', + value: function _hideCells(tbl, colIndex, hide) { + for (var i = 0; i < tbl.rows.length; i++) { + var row = tbl.rows[i]; + var cell = row.cells[colIndex]; + if (cell) { + cell.style.display = hide ? 'none' : ''; + } + } + } + }]); + + return ColsVisibility; + })(); + + exports.default = ColsVisibility; + +/***/ }, + +/***/ 31: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var FiltersVisibility = (function () { + + /** + * Filters Row Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function FiltersVisibility(tf, f) { + _classCallCheck(this, FiltersVisibility); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Filters row visibility manager'; + + // Path and image filenames + this.stylesheet = f.stylesheet || 'filtersVisibility.css'; + this.icnExpand = f.expand_icon_name || 'icn_exp.png'; + this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; + + //expand/collapse filters span element + this.contEl = null; + //expand/collapse filters btn element + this.btnEl = null; + + this.icnExpandHtml = 'Expand filters'; + this.icnCollapseHtml = 'Collapse filters'; + this.defaultText = 'Toggle filters'; + + //id of container element + this.targetId = f.target_id || null; + //enables/disables expand/collapse icon + this.enableIcon = f.enable_icon === false ? false : true; + this.btnText = f.btn_text || ''; + + //defines expand/collapse filters text + this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; + this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; + + //defines expand/collapse filters button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for expand/collapse filters button + this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; + //defines css class span containing expand/collapse filters + this.contCssClass = f.cont_css_class || 'expClpFlt'; + this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); + + this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; + + // Prefix + this.prfx = 'fltsVis_'; + + //callback before filters row is shown + this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; + //callback after filters row is shown + this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; + //callback before filters row is hidden + this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; + //callback after filters row is hidden + this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + /** + * Initialise extension + */ + + _createClass(FiltersVisibility, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + this.buildUI(); + this.initialized = true; + } + + /** + * Build UI elements + */ + + }, { + key: 'buildUI', + value: function buildUI() { + var _this = this; + + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.contCssClass; + + //Container element (rdiv or custom element) + if (!this.targetId) { + tf.setToolbar(); + } + var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); + + if (!this.targetId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + var btn = undefined; + if (!this.btnHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); + btn.className = this.btnCssClass; + btn.title = this.btnText || this.defaultText; + btn.innerHTML = this.collapseBtnHtml; + span.appendChild(btn); + } else { + //Custom html + span.innerHTML = this.btnHtml; + btn = span.firstChild; + } + + _event2.default.add(btn, 'click', function () { + return _this.toggle(); + }); + + this.contEl = span; + this.btnEl = btn; + + if (!this.visibleAtStart) { + this.toggle(); + } + } + + /** + * Toggle filters visibility + */ + + }, { + key: 'toggle', + value: function toggle() { + var tf = this.tf; + var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; + var fltRow = tbl.rows[this.filtersRowIndex]; + var fltRowDisplay = fltRow.style.display; + + if (this.onBeforeShow && fltRowDisplay !== '') { + this.onBeforeShow.call(this, this); + } + if (this.onBeforeHide && fltRowDisplay === '') { + this.onBeforeHide.call(null, this); + } + + fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; + if (this.enableIcon && !this.btnHtml) { + this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; + } + + if (this.onAfterShow && fltRowDisplay !== '') { + this.onAfterShow.call(null, this); + } + if (this.onAfterHide && fltRowDisplay === '') { + this.onAfterHide.call(null, this); + } + } + + /** + * Destroy the UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + this.initialized = false; + } + }]); + + return FiltersVisibility; + })(); + + exports.default = FiltersVisibility; + +/***/ }, + +/***/ 32: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterSortableTable = (function () { + + /** + * SortableTable Adapter module + * @param {Object} tf TableFilter instance + */ + + function AdapterSortableTable(tf, opts) { + _classCallCheck(this, AdapterSortableTable); + + this.initialized = false; + this.name = opts.name; + this.desc = opts.description || 'Sortable table'; + + //indicates if tables was sorted + this.sorted = false; + + this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; + this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; + this.asyncSort = Boolean(opts.async_sort); + this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; + + // edit .sort-arrow.descending / .sort-arrow.ascending in + // tablefilter.css to reflect any path change + this.imgPath = opts.images_path || tf.themesPath; + this.imgBlank = opts.image_blank || 'blank.png'; + this.imgClassName = opts.image_class_name || 'sort-arrow'; + this.imgAscClassName = opts.image_asc_class_name || 'ascending'; + this.imgDescClassName = opts.image_desc_class_name || 'descending'; + //cell attribute storing custom key + this.customKey = opts.custom_key || 'data-tf-sortKey'; + + // callback invoked after sort is loaded and instanciated + this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; + // callback invoked before table is sorted + this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; + // callback invoked after table is sorted + this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; + + this.tf = tf; + } + + _createClass(AdapterSortableTable, [{ + key: 'init', + value: function init() { + var tf = this.tf; + var adpt = this; + + // SortableTable class sanity check (sortabletable.js) + if (_types2.default.isUndef(SortableTable)) { + throw new Error('SortableTable class not found.'); + } + + this.overrideSortableTable(); + this.setSortTypes(); + + //Column sort at start + var sortColAtStart = adpt.sortColAtStart; + if (sortColAtStart) { + this.stt.sort(sortColAtStart[0], sortColAtStart[1]); + } + + if (this.onSortLoaded) { + this.onSortLoaded.call(null, tf, this); + } + + /*** SortableTable callbacks ***/ + this.stt.onbeforesort = function () { + if (adpt.onBeforeSort) { + adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); + } + + /*** sort behaviour for paging ***/ + if (tf.paging) { + tf.feature('paging').disable(); + } + }; + + this.stt.onsort = function () { + adpt.sorted = true; + + //rows alternating bg issue + // TODO: move into AlternateRows component + if (tf.alternateRows) { + var rows = tf.tbl.rows, + c = 0; + + var setClass = function setClass(row, i, removeOnly) { + if (_types2.default.isUndef(removeOnly)) { + removeOnly = false; + } + var altRows = tf.feature('alternateRows'), + oddCls = altRows.oddCss, + evenCls = altRows.evenCss; + _dom2.default.removeClass(row, oddCls); + _dom2.default.removeClass(row, evenCls); + + if (!removeOnly) { + _dom2.default.addClass(row, i % 2 ? oddCls : evenCls); + } + }; + + for (var i = tf.refRow; i < tf.nbRows; i++) { + var isRowValid = rows[i].getAttribute('validRow'); + if (tf.paging && rows[i].style.display === '') { + setClass(rows[i], c); + c++; + } else { + if ((isRowValid === 'true' || isRowValid === null) && rows[i].style.display === '') { + setClass(rows[i], c); + c++; + } else { + setClass(rows[i], c, true); + } + } + } + } + //sort behaviour for paging + if (tf.paging) { + var paginator = tf.feature('paging'); + // recalculate valid rows index as sorting may have change it + tf.getValidRows(true); + paginator.enable(); + paginator.setPage(paginator.getPage()); + } + + if (adpt.onAfterSort) { + adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); + } + }; + + this.initialized = true; + } + + /** + * Sort specified column + * @param {Number} colIdx Column index + * @param {Boolean} desc Optional: descending manner + */ + + }, { + key: 'sortByColumnIndex', + value: function sortByColumnIndex(colIdx, desc) { + this.stt.sort(colIdx, desc); + } + }, { + key: 'overrideSortableTable', + value: function overrideSortableTable() { + var adpt = this, + tf = this.tf; + + /** + * Overrides headerOnclick method in order to handle th event + * @param {Object} e [description] + */ + SortableTable.prototype.headerOnclick = function (evt) { + if (!adpt.initialized) { + return; + } + + // find Header element + var el = evt.target || evt.srcElement; + + while (el.tagName !== 'TD' && el.tagName !== 'TH') { + el = el.parentNode; + } + + this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); + }; + + /** + * Overrides getCellIndex IE returns wrong cellIndex when columns are + * hidden + * @param {Object} oTd TD element + * @return {Number} Cell index + */ + SortableTable.getCellIndex = function (oTd) { + var cells = oTd.parentNode.cells, + l = cells.length, + i = undefined; + for (i = 0; cells[i] != oTd && i < l; i++) {} + return i; + }; + + /** + * Overrides initHeader in order to handle filters row position + * @param {Array} oSortTypes + */ + SortableTable.prototype.initHeader = function (oSortTypes) { + var stt = this; + if (!stt.tHead) { + if (tf.gridLayout) { + stt.tHead = tf.feature('gridLayout').headTbl.tHead; + } else { + return; + } + } + + stt.headersRow = tf.headersRow; + var cells = stt.tHead.rows[stt.headersRow].cells; + stt.sortTypes = oSortTypes || []; + var l = cells.length; + var img = undefined, + c = undefined; + + for (var i = 0; i < l; i++) { + c = cells[i]; + if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { + c.style.cursor = 'pointer'; + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + c.appendChild(img); + if (stt.sortTypes[i] !== null) { + c.setAttribute('_sortType', stt.sortTypes[i]); + } + _event2.default.add(c, 'click', stt._headerOnclick); + } else { + c.setAttribute('_sortType', oSortTypes[i]); + c._sortType = 'None'; + } + } + stt.updateHeaderArrows(); + }; + + /** + * Overrides updateHeaderArrows in order to handle arrows indicators + */ + SortableTable.prototype.updateHeaderArrows = function () { + var stt = this; + var cells = undefined, + l = undefined, + img = undefined; + + // external headers + if (adpt.asyncSort && adpt.triggerIds.length > 0) { + var triggers = adpt.triggerIds; + cells = []; + l = triggers.length; + for (var j = 0; j < triggers.length; j++) { + cells.push(_dom2.default.id(triggers[j])); + } + } else { + if (!this.tHead) { + return; + } + cells = stt.tHead.rows[stt.headersRow].cells; + l = cells.length; + } + for (var i = 0; i < l; i++) { + var cellAttr = cells[i].getAttribute('_sortType'); + if (cellAttr !== null && cellAttr !== 'None') { + img = cells[i].lastChild || cells[i]; + if (img.nodeName.toLowerCase() !== 'img') { + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + cells[i].appendChild(img); + } + if (i === stt.sortColumn) { + img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); + } else { + img.className = adpt.imgClassName; + } + } + } + }; + + /** + * Overrides getRowValue for custom key value feature + * @param {Object} oRow Row element + * @param {String} sType + * @param {Number} nColumn + * @return {String} + */ + SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { + var stt = this; + // if we have defined a custom getRowValue use that + var sortTypeInfo = stt._sortTypeInfo[sType]; + if (sortTypeInfo && sortTypeInfo.getRowValue) { + return sortTypeInfo.getRowValue(oRow, nColumn); + } + var c = oRow.cells[nColumn]; + var s = SortableTable.getInnerText(c); + return stt.getValueFromString(s, sType); + }; + + /** + * Overrides getInnerText in order to avoid Firefox unexpected sorting + * behaviour with untrimmed text elements + * @param {Object} oNode DOM element + * @return {String} DOM element inner text + */ + SortableTable.getInnerText = function (oNode) { + if (!oNode) { + return; + } + if (oNode.getAttribute(adpt.customKey)) { + return oNode.getAttribute(adpt.customKey); + } else { + return _dom2.default.getText(oNode); + } + }; + } + }, { + key: 'addSortType', + value: function addSortType() { + var args = arguments; + SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); + } + }, { + key: 'setSortTypes', + value: function setSortTypes() { + var _this = this; + + var tf = this.tf, + sortTypes = this.sortTypes, + _sortTypes = []; + + for (var i = 0; i < tf.nbCells; i++) { + var colType = undefined; + + if (sortTypes[i]) { + colType = sortTypes[i].toLowerCase(); + if (colType === 'none') { + colType = 'None'; + } + } else { + // resolve column types + if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { + colType = tf.colNbFormat[i].toLowerCase(); + } else if (tf.hasColDateType && tf.colDateType[i] !== null) { + colType = tf.colDateType[i].toLowerCase() + 'date'; + } else { + colType = 'String'; + } + } + _sortTypes.push(colType); + } + + //Public TF method to add sort type + + //Custom sort types + this.addSortType('number', Number); + this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); + this.addSortType('date', SortableTable.toDate); + this.addSortType('string'); + this.addSortType('us', usNumberConverter); + this.addSortType('eu', euNumberConverter); + this.addSortType('dmydate', dmyDateConverter); + this.addSortType('ymddate', ymdDateConverter); + this.addSortType('mdydate', mdyDateConverter); + this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); + this.addSortType('ipaddress', ipAddress, sortIP); + + this.stt = new SortableTable(tf.tbl, _sortTypes); + + /*** external table headers adapter ***/ + if (this.asyncSort && this.triggerIds.length > 0) { + (function () { + var triggers = _this.triggerIds; + for (var j = 0; j < triggers.length; j++) { + if (triggers[j] === null) { + continue; + } + var trigger = _dom2.default.id(triggers[j]); + if (trigger) { + trigger.style.cursor = 'pointer'; + + _event2.default.add(trigger, 'click', function (evt) { + var elm = evt.target; + if (!_this.tf.sort) { + return; + } + _this.stt.asyncSort(triggers.indexOf(elm.id)); + }); + trigger.setAttribute('_sortType', _sortTypes[j]); + } + } + })(); + } + } + + /** + * Destroy sort + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + this.sorted = false; + this.initialized = false; + this.stt.destroy(); + + var ids = tf.getFiltersId(); + for (var idx = 0; idx < ids.length; idx++) { + var header = tf.getHeaderElement(idx); + var img = _dom2.default.tag(header, 'img'); + + if (img.length === 1) { + header.removeChild(img[0]); + } + } + } + }]); + + return AdapterSortableTable; + })(); + + //Converters + + exports.default = AdapterSortableTable; + function usNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'us'); + } + function euNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'eu'); + } + function dateConverter(s, format) { + return _date2.default.format(s, format); + } + function dmyDateConverter(s) { + return dateConverter(s, 'DMY'); + } + function mdyDateConverter(s) { + return dateConverter(s, 'MDY'); + } + function ymdDateConverter(s) { + return dateConverter(s, 'YMD'); + } + function ddmmmyyyyDateConverter(s) { + return dateConverter(s, 'DDMMMYYYY'); + } + + function ipAddress(value) { + var vals = value.split('.'); + for (var x in vals) { + var val = vals[x]; + while (3 > val.length) { + val = '0' + val; + } + vals[x] = val; + } + return vals.join('.'); + } + + function sortIP(a, b) { + var aa = ipAddress(a.value.toLowerCase()); + var bb = ipAddress(b.value.toLowerCase()); + if (aa == bb) { + return 0; + } else if (aa < bb) { + return -1; + } else { + return 1; + } + } + +/***/ }, + +/***/ 33: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterSortabletable = __webpack_require__(32); + + var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + if (!window.SortableTable) { + __webpack_require__(34); + } // import 'script!sortabletable'; + + exports.default = _adapterSortabletable2.default; + +/***/ }, + +/***/ 34: +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") + +/***/ }, + +/***/ 35: +/***/ function(module, exports) { + + /* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra + */ + module.exports = function(src) { + if (typeof execScript === "function") + execScript(src); + else + eval.call(null, src); + } + +/***/ }, + +/***/ 36: +/***/ function(module, exports) { + + module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" + +/***/ } + +}); +//# sourceMappingURL=tf-1.js.map \ No newline at end of file diff --git a/src/modules/highlightKeywords.js b/src/modules/highlightKeywords.js index ff4417c8..67170570 100644 --- a/src/modules/highlightKeywords.js +++ b/src/modules/highlightKeywords.js @@ -14,6 +14,11 @@ export class HighlightKeyword{ this.highlightedNodes = []; this.tf = tf; + this.emitter = tf.emitter; + } + + init(){ + this.emitter.on('before-filtering', ()=> this.unhighlightAll()); } /** @@ -105,4 +110,8 @@ export class HighlightKeyword{ } this.highlightedNodes = []; } + + destroy(){ + this.emitter.off('before-filtering', ()=> this.unhighlightAll()); + } } \ No newline at end of file diff --git a/src/tablefilter.js b/src/tablefilter.js index 4ec7e99a..195d6e1e 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -652,6 +652,7 @@ export class TableFilter { if(this.highlightKeywords){ Mod.highlightKeyword = new HighlightKeyword(this); + Mod.highlightKeyword.init(); } if(this.popupFilters){ @@ -1523,9 +1524,9 @@ export class TableFilter { this.validRowsIndex = []; // removes keyword highlighting - if(this.highlightKeywords){ - Mod.highlightKeyword.unhighlightAll(); - } + // if(this.highlightKeywords){ + // Mod.highlightKeyword.unhighlightAll(); + // } //removes popup filters active icons // if(this.popupFilters){ // Mod.popupFilter.buildIcons(); From f96e9b97b88d4e913d04c74cc2147a166f2454e3 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Wed, 30 Dec 2015 16:56:44 +1100 Subject: [PATCH 07/41] Hooked up into the before-filtering event --- README.md | 6 +- dist/starter.html | 4 +- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 7673 +---------------- dist/tablefilter/tf-1.js | 2224 +---- src/tablefilter.js | 22 +- 11 files changed, 36 insertions(+), 9905 deletions(-) diff --git a/README.md b/README.md index 771effb8..2de55005 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,12 @@ git clone --bare https://github.com/koalyptus/TableFilter.git * Alternatively, install TableFilter files in your npm enabled project using: ```shell -npm install tablefilter --save +npm install tablefilter ``` +* or get the future features from the ``next`` release channel: +```shell +npm install tablefilter@next +``` ## Setup Copy the ``tablefilter`` directory under ``dist`` and place it at desired location in your project. Then include the main js file in your page: diff --git a/dist/starter.html b/dist/starter.html index d1fbf106..e81b7543 100644 --- a/dist/starter.html +++ b/dist/starter.html @@ -1,10 +1,10 @@ - tablefilter v0.1.0 - Starter + tablefilter v0.1.1 - Starter -

tablefilter v0.1.0

+

tablefilter v0.1.1

diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 2265d0c6..a6e27bac 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-29T06:10:22.693Z + * build date: 2015-12-30T05:48:52.503Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 9c286a3b..b62df92a 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-29T06:10:22.693Z + * build date: 2015-12-30T05:48:52.503Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index c7f4a680..4508f4a0 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-29T06:10:22.693Z + * build date: 2015-12-30T05:48:52.503Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index b6adbdee..a000bda2 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-29T06:10:22.693Z + * build date: 2015-12-30T05:48:52.503Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index f8aaa87d..1e715fba 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-29T06:10:22.693Z + * build date: 2015-12-30T05:48:52.503Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 93717009..f1567c4d 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-29T06:10:22.693Z + * build date: 2015-12-30T05:48:52.503Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index c9ddad7b..294063f3 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,7665 +1,10 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else { - var a = factory(); - for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; - } -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // install a JSONP callback for chunk loading -/******/ var parentJsonpFunction = window["webpackJsonp"]; -/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, callbacks = []; -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(installedChunks[chunkId]) -/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); -/******/ while(callbacks.length) -/******/ callbacks.shift().call(null, __webpack_require__); -/******/ -/******/ }; -/******/ -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // object to store loaded and loading chunks -/******/ // "0" means "already loaded" -/******/ // Array means "loading", array contains callbacks -/******/ var installedChunks = { -/******/ 0:0 -/******/ }; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ // This file contains only the entry chunk. -/******/ // The chunk loading function for additional chunks -/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { -/******/ // "0" is the signal for "already loaded" -/******/ if(installedChunks[chunkId] === 0) -/******/ return callback.call(null, __webpack_require__); -/******/ -/******/ // an array means "currently loading". -/******/ if(installedChunks[chunkId] !== undefined) { -/******/ installedChunks[chunkId].push(callback); -/******/ } else { -/******/ // start chunk loading -/******/ installedChunks[chunkId] = [callback]; -/******/ var head = document.getElementsByTagName('head')[0]; -/******/ var script = document.createElement('script'); -/******/ script.type = 'text/javascript'; -/******/ script.charset = 'utf-8'; -/******/ script.async = true; -/******/ -/******/ script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js"; -/******/ head.appendChild(script); -/******/ } -/******/ }; -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { +/** + * tablefilter v0.1.1 by Max Guglielmi + * build date: 2015-12-30T05:48:52.421Z + * MIT License + */ - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - // Features - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.TableFilter = undefined; - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _cookie = __webpack_require__(4); - - var _cookie2 = _interopRequireDefault(_cookie); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _date = __webpack_require__(7); - - var _date2 = _interopRequireDefault(_date); - - var _helpers = __webpack_require__(8); - - var _helpers2 = _interopRequireDefault(_helpers); - - var _emitter = __webpack_require__(9); - - var _store = __webpack_require__(10); - - var _gridLayout = __webpack_require__(11); - - var _loader = __webpack_require__(13); - - var _highlightKeywords = __webpack_require__(14); - - var _popupFilter = __webpack_require__(15); - - var _dropdown = __webpack_require__(16); - - var _checkList = __webpack_require__(18); - - var _rowsCounter = __webpack_require__(19); - - var _statusBar = __webpack_require__(20); - - var _paging = __webpack_require__(21); - - var _clearButton = __webpack_require__(22); - - var _help = __webpack_require__(23); - - var _alternateRows = __webpack_require__(24); - - var _noResults = __webpack_require__(25); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var global = window, - doc = global.document; - - var TableFilter = exports.TableFilter = (function () { - - /** - * TableFilter object constructor - * requires `table` or `id` arguments, `row` and `configuration` optional - * @param {DOMElement} table Table DOM element - * @param {String} id Table id - * @param {Number} row index indicating the 1st row - * @param {Object} configuration object - */ - - function TableFilter() { - var _this = this; - - _classCallCheck(this, TableFilter); - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - if (args.length === 0) { - return; - } - - this.id = null; - this.version = '0.1.1'; - this.year = new Date().getFullYear(); - this.tbl = null; - this.startRow = null; - this.refRow = null; - this.headersRow = null; - this.cfg = {}; - this.nbFilterableRows = null; - this.nbRows = null; - this.nbCells = null; - this._hasGrid = false; - - // TODO: use for-of with babel plug-in - args.forEach(function (arg) { - // for (let arg of args) { - var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); - if (argtype === 'object' && arg && arg.nodeName === 'TABLE') { - _this.tbl = arg; - _this.id = arg.id || 'tf_' + new Date().getTime() + '_'; - } else if (argtype === 'string') { - _this.id = arg; - _this.tbl = _dom2.default.id(arg); - } else if (argtype === 'number') { - _this.startRow = arg; - } else if (argtype === 'object') { - _this.cfg = arg; - } - // } - }); - - if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) { - throw new Error('Could not instantiate TableFilter: HTML table not found.'); - } - - // configuration object - var f = this.cfg; - - this.emitter = new _emitter.Emitter(); - - //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 || 'tablefilter/'; - - /*** filter types ***/ - this.fltTypeInp = 'input'; - this.fltTypeSlc = 'select'; - this.fltTypeMulti = 'multiple'; - this.fltTypeCheckList = 'checklist'; - this.fltTypeNone = 'none'; - - /*** filters' grid properties ***/ - - //enables/disables filter grid - this.fltGrid = f.grid === false ? false : true; - - //enables/disables grid layout (fixed headers) - this.gridLayout = Boolean(f.grid_layout); - - this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index; - this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index; - - 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 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; - - //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.stylePath = f.style_path || this.basePath + 'style/'; - this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows); - //defines widths of columns - this.hasColWidths = _types2.default.isArray(f.col_widths); - this.colWidths = this.hasColWidths ? f.col_widths : null; - //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'; - - /*** filters' grid behaviours ***/ - //enables/disables enter key - this.enterKey = f.enter_key === false ? false : true; - //calls function before filtering starts - this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null; - //calls function after filtering - this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null; - //enables/disables case sensitivity - this.caseSensitive = Boolean(f.case_sensitive); - //has exact match per column - this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match); - this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : []; - //enables/disbles exact match for search - this.exactMatch = Boolean(f.exact_match); - //refreshes drop-down lists upon validation - this.linkedFilters = Boolean(f.linked_filters); - //wheter excluded options are disabled - this.disableExcludedOptions = Boolean(f.disable_excluded_options); - //stores active filter element - this.activeFlt = null; - //id of active filter - this.activeFilterId = null; - //enables always visible rows - this.hasVisibleRows = Boolean(f.rows_always_visible); - //array containing always visible rows - this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; - //enables/disables external filters generation - this.isExternalFlt = Boolean(f.external_flt_grid); - //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null; - //enables/disables single filter search - this.singleSearchFlt = Boolean(f.single_filter); - //calls function after row is validated - this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null; - //input watermark text array - this.watermark = f.watermark || ''; - this.isWatermarkArray = _types2.default.isArray(this.watermark); - //id of toolbar container element - this.toolBarTgtId = f.toolbar_target_id || null; - //enables/disables help div - this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions); - //popup filters - this.popupFilters = Boolean(f.popup_filters); - //active columns color - this.markActiveColumns = Boolean(f.mark_active_columns); - //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null; - //calls function after active column header is marked - this.onAfterActiveColumn = _types2.default.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 || 'Clear'; - //enables/disables empty option in combo-box filters - this.enableEmptyOption = Boolean(f.enable_empty_option); - //defines empty option text - this.emptyText = f.empty_text || '(Empty)'; - //enables/disables non empty option in combo-box filters - this.enableNonEmptyOption = Boolean(f.enable_non_empty_option); - //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 = Boolean(f.sort_num_asc); - this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null; - //enables/disables descending numeric options sorting - this.isSortNumDesc = Boolean(f.sort_num_desc); - this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null; - //Select filters are populated on demand - this.loadFltOnDemand = Boolean(f.load_filters_on_demand); - this.hasCustomOptions = _types2.default.isObj(f.custom_options); - this.customOptions = f.custom_options; - - /*** 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 || '^[¥£€$]'; - this.separator = f.separator || ','; - - /*** rows counter ***/ - //show/hides rows counter - this.rowsCounter = Boolean(f.rows_counter); - - /*** status bar ***/ - //show/hides status bar - this.statusBar = Boolean(f.status_bar); - - /*** loader ***/ - //enables/disables loader/spinner indicator - this.loader = Boolean(f.loader); - - /*** validation - reset buttons/links ***/ - //show/hides filter's validation button - this.displayBtn = Boolean(f.btn); - //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 = Boolean(f.btn_reset); - //defines css class for reset button - this.btnResetCssClass = f.btn_reset_css_class || 'reset'; - //callback function before filters are cleared - this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null; - //callback function after filters are cleared - this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null; - - /*** paging ***/ - //enables/disables table paging - this.paging = Boolean(f.paging); - this.nbVisibleRows = 0; //nb visible rows - this.nbHiddenRows = 0; //nb hidden rows - - /*** autofilter on typing ***/ - //enables/disables auto filtering, table is filtered when user stops - //typing - this.autoFilter = Boolean(f.auto_filter); - //onkeyup delay timer (msecs) - this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900; - //typing indicator - this.isUserTyping = null; - this.autoFilterTimer = null; - - /*** keyword highlighting ***/ - //enables/disables keyword highlighting - this.highlightKeywords = Boolean(f.highlight_keywords); - - /*** No results feature ***/ - this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message); - - /*** 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 = _types2.default.isArray(f.col_number_format); - //array containing columns nb formats - this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null; - //enables date type per column - this.hasColDateType = _types2.default.isArray(f.col_date_type); - //array containing columns date type - this.colDateType = 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_'; - //filter values cookie - this.prfxCookieFltsValues = 'tf_flts_'; - //page nb cookie - this.prfxCookiePageNb = 'tf_pgnb_'; - //page length cookie - this.prfxCookiePageLen = 'tf_pglen_'; - - /*** cookies ***/ - this.hasStoredValues = false; - //remembers filters values on page load - this.rememberGridValues = Boolean(f.remember_grid_values); - //cookie storing filter values - this.fltsValuesCookie = this.prfxCookieFltsValues + this.id; - //remembers page nb on page load - this.rememberPageNb = this.paging && f.remember_page_number; - //cookie storing page nb - this.pgNbCookie = this.prfxCookiePageNb + this.id; - //remembers page length on page load - this.rememberPageLen = this.paging && f.remember_page_length; - //cookie storing page length - this.pgLenCookie = this.prfxCookiePageLen + this.id; - - /*** extensions ***/ - //imports external script - this.extensions = f.extensions; - this.hasExtensions = _types2.default.isArray(this.extensions); - - /*** themes ***/ - this.enableDefaultTheme = Boolean(f.enable_default_theme); - //imports themes - this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes); - this.themes = f.themes || []; - //themes path - this.themesPath = f.themes_path || this.stylePath + 'themes/'; - - // Features registry - this.Mod = {}; - - // Extensions registry - this.ExtRegistry = {}; - - /*** TF events ***/ - this.Evt = { - name: { - filter: 'Filter', - dropdown: 'DropDown', - checklist: 'CheckList', - changepage: 'ChangePage', - clear: 'Clear', - changeresultsperpage: 'ChangeResults', - resetvalues: 'ResetValues', - resetpage: 'ResetPage', - resetpagelength: 'ResetPageLength', - loadextensions: 'LoadExtensions', - loadthemes: 'LoadThemes' - }, - - // Detect key - detectKey: function detectKey(e) { - if (!this.enterKey) { - return; - } - var _ev = e || global.event; - if (_ev) { - var key = _event2.default.keyCode(_ev); - if (key === 13) { - this.filter(); - _event2.default.cancel(_ev); - _event2.default.stop(_ev); - } else { - this.isUserTyping = true; - global.clearInterval(this.autoFilterTimer); - this.autoFilterTimer = null; - } - } - }, - - // if auto-filter on, detect user is typing and filter columns - onKeyUp: function onKeyUp(e) { - if (!this.autoFilter) { - return; - } - var _ev = e || global.event; - var key = _event2.default.keyCode(_ev); - this.isUserTyping = false; - - function filter() { - /*jshint validthis:true */ - global.clearInterval(this.autoFilterTimer); - this.autoFilterTimer = null; - if (!this.isUserTyping) { - this.filter(); - this.isUserTyping = null; - } - } - - if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) { - if (this.autoFilterTimer === null) { - this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay); - } - } else { - global.clearInterval(this.autoFilterTimer); - this.autoFilterTimer = null; - } - }, - - // if auto-filter on, detect user is typing - onKeyDown: function onKeyDown() { - if (!this.autoFilter) { - return; - } - this.isUserTyping = true; - }, - - // if auto-filter on, clear interval on filter blur - onInpBlur: function onInpBlur() { - if (this.autoFilter) { - this.isUserTyping = false; - global.clearInterval(this.autoFilterTimer); - } - // TODO: hack to prevent ezEditTable enter key event hijaking. - // Needs to be fixed in the vendor's library - if (this.hasExtension('advancedGrid')) { - var advGrid = this.extension('advancedGrid'); - var ezEditTable = advGrid._ezEditTable; - if (advGrid.cfg.editable) { - ezEditTable.Editable.Set(); - } - if (advGrid.cfg.selection) { - ezEditTable.Selection.Set(); - } - } - }, - - // set focused text-box filter as active - onInpFocus: function onInpFocus(e) { - var _ev = e || global.event; - var elm = _event2.default.target(_ev); - this.activeFilterId = elm.getAttribute('id'); - this.activeFlt = _dom2.default.id(this.activeFilterId); - if (this.popupFilters) { - _event2.default.cancel(_ev); - _event2.default.stop(_ev); - } - // TODO: hack to prevent ezEditTable enter key event hijaking. - // Needs to be fixed in the vendor's library - if (this.hasExtension('advancedGrid')) { - var advGrid = this.extension('advancedGrid'); - var ezEditTable = advGrid._ezEditTable; - if (advGrid.cfg.editable) { - ezEditTable.Editable.Remove(); - } - if (advGrid.cfg.selection) { - ezEditTable.Selection.Remove(); - } - } - }, - - // set focused drop-down filter as active - onSlcFocus: function onSlcFocus(e) { - var _ev = e || global.event; - var elm = _event2.default.target(_ev); - this.activeFilterId = elm.getAttribute('id'); - this.activeFlt = _dom2.default.id(this.activeFilterId); - // select is populated when element has focus - if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - this.Mod.dropdown._build(ct); - } - if (this.popupFilters) { - _event2.default.cancel(_ev); - _event2.default.stop(_ev); - } - }, - - // filter columns on drop-down filter change - onSlcChange: function onSlcChange(e) { - if (!this.activeFlt) { - return; - } - var _ev = e || global.event; - if (this.popupFilters) { - _event2.default.stop(_ev); - } - if (this.onSlcChange) { - this.filter(); - } - }, - - // fill checklist filter on click if required - onCheckListClick: function onCheckListClick(e) { - var _ev = e || global.event; - var elm = _event2.default.target(_ev); - if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - this.Mod.checkList._build(ct); - this.Mod.checkList.checkListDiv[ct].onclick = null; - this.Mod.checkList.checkListDiv[ct].title = ''; - } - } - }; - } - - /** - * Initialise filtering grid bar behaviours and layout - * - * TODO: decompose in smaller methods - */ - - _createClass(TableFilter, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this._hasGrid) { - return; - } - if (!this.tbl) { - this.tbl = _dom2.default.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 Mod = this.Mod; - var n = this.singleSearchFlt ? 1 : this.nbCells, - inpclass = undefined; - - //loads stylesheet if not imported - this.import(this.stylesheetId, this.stylesheet, null, 'link'); - - //loads theme - if (this.hasThemes) { - this._loadThemes(); - } - - if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { - Mod.store = new _store.Store(this); - Mod.store.init(); - } - - if (this.gridLayout) { - Mod.gridLayout = new _gridLayout.GridLayout(this); - Mod.gridLayout.init(); - } - - if (this.loader) { - if (!Mod.loader) { - Mod.loader = new _loader.Loader(this); - } - Mod.loader.init(); - } - - if (this.highlightKeywords) { - Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this); - Mod.highlightKeyword.init(); - } - - if (this.popupFilters) { - if (!Mod.popupFilter) { - Mod.popupFilter = new _popupFilter.PopupFilter(this); - } - Mod.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 = undefined; - if (!this.gridLayout) { - var thead = _dom2.default.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.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) { - Mod.popupFilter.build(i); - } - - var fltcell = _dom2.default.create(this.fltCellTag), - col = this.getFilterType(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; - - //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 (!Mod.dropdown) { - Mod.dropdown = new _dropdown.Dropdown(this); - } - var dropdown = Mod.dropdown; - - var slc = _dom2.default.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 = _string2.default.lower(col) === this.fltTypeSlc ? inpclass : this.fltMultiCssClass; - - //filter is appended in desired external element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(slc); - this.externalFltEls.push(slc); - } else { - fltcell.appendChild(slc); - } - - this.fltIds.push(this.prfxFlt + i + '_' + this.id); - - if (!this.loadFltOnDemand) { - dropdown._build(i); - } - - _event2.default.add(slc, 'keypress', this.Evt.detectKey.bind(this)); - _event2.default.add(slc, 'change', this.Evt.onSlcChange.bind(this)); - _event2.default.add(slc, 'focus', this.Evt.onSlcFocus.bind(this)); - - //1st option is created here since dropdown.build isn't - //invoked - if (this.loadFltOnDemand) { - var opt0 = _dom2.default.createOpt(this.displayAllText, ''); - slc.appendChild(opt0); - } - } - // checklist - else if (col === this.fltTypeCheckList) { - var checkList = undefined; - Mod.checkList = new _checkList.CheckList(this); - checkList = Mod.checkList; - - var divCont = _dom2.default.create('div', ['id', checkList.prfxCheckListDiv + i + '_' + this.id], ['ct', i], ['filled', '0']); - divCont.className = checkList.checkListDivCssClass; - - //filter is appended in desired element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(divCont); - this.externalFltEls.push(divCont); - } else { - fltcell.appendChild(divCont); - } - - checkList.checkListDiv[i] = divCont; - this.fltIds.push(this.prfxFlt + i + '_' + this.id); - if (!this.loadFltOnDemand) { - checkList._build(i); - } - - if (this.loadFltOnDemand) { - _event2.default.add(divCont, 'click', this.Evt.onCheckListClick.bind(this)); - divCont.appendChild(_dom2.default.text(checkList.activateCheckListTxt)); - } - } else { - //show/hide input - var inptype = col === this.fltTypeInp ? 'text' : 'hidden'; - var inp = _dom2.default.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; - _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this)); - - //filter is appended in desired element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(inp); - this.externalFltEls.push(inp); - } else { - fltcell.appendChild(inp); - } - - this.fltIds.push(this.prfxFlt + i + '_' + this.id); - - _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this)); - _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this)); - _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this)); - _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this)); - - if (this.rememberGridValues) { - var flts_values = this.Mod.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 = _dom2.default.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) { - _dom2.default.id(externalFltTgtId).appendChild(btn); - } else { - fltcell.appendChild(btn); - } - - _event2.default.add(btn, 'click', function () { - return _this2.filter(); - }); - } //if - } // for i - } else { - this._resetGrid(); - } //if isFirstLoad - } //if this.fltGrid - - /* Features */ - if (this.hasVisibleRows) { - this.emitter.on('after-filtering', function () { - return _this2.enforceVisibility(); - }); - this.enforceVisibility(); - } - if (this.rowsCounter) { - Mod.rowsCounter = new _rowsCounter.RowsCounter(this); - Mod.rowsCounter.init(); - } - if (this.statusBar) { - Mod.statusBar = new _statusBar.StatusBar(this); - Mod.statusBar.init(); - } - if (this.paging || Mod.paging) { - if (!Mod.paging) { - Mod.paging = new _paging.Paging(this); - Mod.paging.init(); - } - Mod.paging.reset(); - } - if (this.btnReset) { - Mod.clearButton = new _clearButton.ClearButton(this); - Mod.clearButton.init(); - } - if (this.help) { - if (!Mod.help) { - Mod.help = new _help.Help(this); - } - Mod.help.init(); - } - if (this.hasColWidths && !this.gridLayout) { - this.setColWidths(); - } - if (this.alternateRows) { - Mod.alternateRows = new _alternateRows.AlternateRows(this); - Mod.alternateRows.init(); - } - if (this.noResults) { - if (!Mod.noResults) { - Mod.noResults = new _noResults.NoResults(this); - } - Mod.noResults.init(); - } - - 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) { - _dom2.default.addClass(this.tbl, this.prfxTf); - } - - if (this.loader) { - Mod.loader.show('none'); - } - - /* Loads extensions */ - if (this.hasExtensions) { - this.initExtensions(); - } - - // Subscribe to event - if (this.linkedFilters) { - this.emitter.on('after-filtering', function () { - return _this2.linkFilters(); - }); - } - - if (this.onFiltersLoaded) { - this.onFiltersLoaded.call(null, this); - } - - this.emitter.emit('initialized', this); - } - - /** - * Manages state messages - * @param {String} evt Event name - * @param {Object} cfg Config object - */ - - }, { - key: 'EvtManager', - value: function EvtManager(evt) { - var cfg = arguments.length <= 1 || arguments[1] === undefined ? { slcIndex: null, slcExternal: false, slcId: null, pgIndex: null } : arguments[1]; - - var slcIndex = cfg.slcIndex; - var slcExternal = cfg.slcExternal; - var slcId = cfg.slcId; - var pgIndex = cfg.pgIndex; - var cpt = this.Mod; - - function efx() { - /*jshint validthis:true */ - var ev = this.Evt.name; - - switch (evt) { - case ev.filter: - this._filter(); - break; - case ev.dropdown: - if (this.linkedFilters) { - cpt.dropdown._build(slcIndex, true); - } else { - cpt.dropdown._build(slcIndex, false, slcExternal, slcId); - } - break; - case ev.checklist: - cpt.checkList._build(slcIndex, slcExternal, slcId); - break; - case ev.changepage: - cpt.paging._changePage(pgIndex); - break; - case ev.clear: - this._clearFilters(); - this._filter(); - break; - case ev.changeresultsperpage: - cpt.paging._changeResultsPerPage(); - break; - case ev.resetvalues: - this._resetValues(); - this._filter(); - break; - case ev.resetpage: - cpt.paging._resetPage(this.pgNbCookie); - break; - case ev.resetpagelength: - cpt.paging._resetPageLength(this.pgLenCookie); - break; - case ev.loadextensions: - this._loadExtensions(); - break; - case ev.loadthemes: - this._loadThemes(); - break; - } - if (this.statusBar) { - cpt.statusBar.message(''); - } - if (this.loader) { - cpt.loader.show('none'); - } - } - - if (!this.loader && !this.statusBar && !this.linkedFilters) { - efx.call(this); - } else { - if (this.loader) { - cpt.loader.show(''); - } - if (this.statusBar) { - cpt.statusBar.message(this['msg' + evt]); - } - global.setTimeout(efx.bind(this), this.execDelay); - } - } - - /** - * Return a feature instance for a given name - * @param {String} name Name of the feature - * @return {Object} - */ - - }, { - key: 'feature', - value: function feature(name) { - return this.Mod[name]; - } - - /** - * Initialise all the extensions defined in the configuration object - */ - - }, { - key: 'initExtensions', - value: function initExtensions() { - var exts = this.extensions; - - for (var i = 0, len = exts.length; i < len; i++) { - var ext = exts[i]; - if (!this.ExtRegistry[ext.name]) { - this.loadExtension(ext); - } - } - } - - /** - * Load an extension module - * @param {Object} ext Extension config object - */ - - }, { - key: 'loadExtension', - value: function loadExtension(ext) { - var _this3 = this; - - if (!ext || !ext.name) { - return; - } - - var name = ext.name; - var path = ext.path; - var modulePath = undefined; - - if (name && path) { - modulePath = ext.path + name; - } else { - name = name.replace('.js', ''); - modulePath = 'extensions/{}/{}'.replace(/{}/g, name); - } - - // Trick to set config's publicPath dynamically for Webpack... - __webpack_require__.p = this.basePath; - - __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) { - var inst = new mod.default(_this3, ext); - inst.init(); - _this3.ExtRegistry[name] = inst; - }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}); - } - - /** - * Get an extension instance - * @param {String} name Name of the extension - * @return {Object} Extension instance - */ - - }, { - key: 'extension', - value: function extension(name) { - return this.ExtRegistry[name]; - } - - /** - * Check passed extension name exists - * @param {String} name Name of the extension - * @return {Boolean} - */ - - }, { - key: 'hasExtension', - value: function hasExtension(name) { - return !_types2.default.isEmpty(this.ExtRegistry[name]); - } - - /** - * Destroy all the extensions defined in the configuration object - */ - - }, { - key: 'destroyExtensions', - value: function destroyExtensions() { - var exts = this.extensions; - - for (var i = 0, len = exts.length; i < len; i++) { - var ext = exts[i]; - var extInstance = this.ExtRegistry[ext.name]; - if (extInstance) { - extInstance.destroy(); - this.ExtRegistry[ext.name] = null; - } - } - } - }, { - key: 'loadThemes', - value: function loadThemes() { - this.EvtManager(this.Evt.name.loadthemes); - } - - /** - * Load themes defined in the configuration object - */ - - }, { - key: '_loadThemes', - value: function _loadThemes() { - var themes = this.themes; - //Default theme config - if (this.enableDefaultTheme) { - var defaultTheme = { name: 'default' }; - this.themes.push(defaultTheme); - } - if (_types2.default.isArray(themes)) { - for (var i = 0, len = themes.length; i < len; i++) { - var theme = themes[i]; - var name = theme.name; - var path = theme.path; - var styleId = this.prfxTf + name; - if (name && !path) { - path = this.themesPath + name + '/' + name + '.css'; - } else if (!name && theme.path) { - name = 'theme{0}'.replace('{0}', i); - } - - if (!this.isImported(path, 'link')) { - this.import(styleId, path, null, 'link'); - } - } - } - - //Some elements need to be overriden for default 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; - } - - /** - * Return stylesheet DOM element for a given theme name - * @return {DOMElement} stylesheet element - */ - - }, { - key: 'getStylesheet', - value: function getStylesheet() { - var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; - - return _dom2.default.id(this.prfxTf + name); - } - - /** - * Destroy filter grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this._hasGrid) { - return; - } - var rows = this.tbl.rows, - Mod = this.Mod; - - this._clearFilters(); - - if (this.isExternalFlt && !this.popupFilters) { - this.removeExternalFlts(); - } - if (this.infDiv) { - this.removeToolbar(); - } - if (this.highlightKeywords) { - Mod.highlightKeyword.unhighlightAll(); - } - if (this.markActiveColumns) { - this.clearActiveColumns(); - } - if (this.hasExtensions) { - this.destroyExtensions(); - } - - for (var j = this.refRow; j < this.nbRows; j++) { - // validate row - this.validateRow(j, true); - - //removes alternating colors - if (this.alternateRows) { - Mod.alternateRows.removeRowBg(j); - } - } //for j - - if (this.fltGrid && !this.gridLayout) { - this.fltGridEl = rows[this.filtersRowIndex]; - this.tbl.deleteRow(this.filtersRowIndex); - } - - // Destroy modules - Object.keys(Mod).forEach(function (key) { - var feature = Mod[key]; - if (feature && _types2.default.isFn(feature.destroy)) { - feature.destroy(); - } - }); - - // unsubscribe to events - if (this.hasVisibleRows) { - this.emitter.off('after-filtering', function () { - return _this4.enforceVisibility(); - }); - } - if (this.linkedFilters) { - this.emitter.off('after-filtering', function () { - return _this4.linkFilters(); - }); - } - - _dom2.default.removeClass(this.tbl, this.prfxTf); - this.nbHiddenRows = 0; - this.validRowsIndex = null; - this.activeFlt = null; - this._hasGrid = false; - this.tbl = null; - } - - /** - * Generate container element for paging, reset button, rows counter etc. - */ - - }, { - key: 'setToolbar', - value: function setToolbar() { - if (this.infDiv) { - return; - } - - /*** container div ***/ - var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); - infdiv.className = this.infDivCssClass; - - //custom container - if (this.toolBarTgtId) { - _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); - } - //grid-layout - else if (this.gridLayout) { - var gridLayout = this.Mod.gridLayout; - gridLayout.tblMainCont.appendChild(infdiv); - infdiv.className = gridLayout.gridInfDivCssClass; - } - //default location: just above the table - else { - var cont = _dom2.default.create('caption'); - cont.appendChild(infdiv); - this.tbl.insertBefore(cont, this.tbl.firstChild); - } - this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); - - /*** left div containing rows # displayer ***/ - var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); - ldiv.className = this.lDivCssClass; - infdiv.appendChild(ldiv); - this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); - - /*** right div containing reset button - + nb results per page select ***/ - var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); - rdiv.className = this.rDivCssClass; - infdiv.appendChild(rdiv); - this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); - - /*** mid div containing paging elements ***/ - var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); - mdiv.className = this.mDivCssClass; - infdiv.appendChild(mdiv); - this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); - - // Enable help instructions by default if topbar is generated and not - // explicitely set to false - if (_types2.default.isUndef(this.help)) { - if (!this.Mod.help) { - this.Mod.help = new _help.Help(this); - } - this.Mod.help.init(); - this.help = true; - } - } - - /** - * Remove toolbar container element - */ - - }, { - key: 'removeToolbar', - value: function removeToolbar() { - if (!this.infDiv) { - return; - } - _dom2.default.remove(this.infDiv); - this.infDiv = null; - - var tbl = this.tbl; - var captions = _dom2.default.tag(tbl, 'caption'); - if (captions.length > 0) { - [].forEach.call(captions, function (elm) { - tbl.removeChild(elm); - }); - } - } - - /** - * Remove all the external column filters - */ - - }, { - key: 'removeExternalFlts', - value: function removeExternalFlts() { - if (!this.isExternalFlt || !this.externalFltTgtIds) { - return; - } - var ids = this.externalFltTgtIds, - len = ids.length; - for (var ct = 0; ct < len; ct++) { - var externalFltTgtId = ids[ct], - externalFlt = _dom2.default.id(externalFltTgtId); - if (externalFlt) { - externalFlt.innerHTML = ''; - } - } - } - - /** - * Check if given column implements a filter with custom options - * @param {Number} colIndex Column's index - * @return {Boolean} - */ - - }, { - key: 'isCustomOptions', - value: function isCustomOptions(colIndex) { - return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; - } - - /** - * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the - * custom options values and texts - * @param {Number} colIndex Column's index - * @return {Array} - */ - - }, { - key: 'getCustomOptions', - value: function getCustomOptions(colIndex) { - if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { - return; - } - - var customOptions = this.customOptions; - var cols = customOptions.cols; - var optTxt = [], - optArray = []; - var index = cols.indexOf(colIndex); - var slcValues = customOptions.values[index]; - var slcTexts = customOptions.texts[index]; - var slcSort = customOptions.sorts[index]; - - for (var r = 0, len = slcValues.length; r < len; r++) { - optArray.push(slcValues[r]); - if (slcTexts[r]) { - optTxt.push(slcTexts[r]); - } else { - optTxt.push(slcValues[r]); - } - } - if (slcSort) { - optArray.sort(); - optTxt.sort(); - } - return [optArray, optTxt]; - } - }, { - key: 'resetValues', - value: function resetValues() { - this.EvtManager(this.Evt.name.resetvalues); - } - - /** - * Reset persisted filter values - */ - - }, { - key: '_resetValues', - value: function _resetValues() { - //only loadFltOnDemand - if (this.rememberGridValues && this.loadFltOnDemand) { - this._resetGridValues(this.fltsValuesCookie); - } - if (this.rememberPageLen && this.Mod.paging) { - this.Mod.paging.resetPageLength(this.pgLenCookie); - } - if (this.rememberPageNb && this.Mod.paging) { - this.Mod.paging.resetPage(this.pgNbCookie); - } - } - - /** - * Reset persisted filter values when load filters on demand feature is - * enabled - * @param {String} name cookie name storing filter values - */ - - }, { - key: '_resetGridValues', - value: function _resetGridValues(name) { - if (!this.loadFltOnDemand) { - return; - } - var fltsValues = this.Mod.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 = undefined, - opt = undefined; - var fltType = this.getFilterType(i); - // if loadFltOnDemand, drop-down needs to contain stored - // value(s) for filtering - if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { - var slc = _dom2.default.id(this.fltIds[i]); - slc.options[0].selected = false; - - //selects - if (slcFltsIndex.indexOf(i) != -1) { - opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - //multiple select - if (multiFltsIndex.indexOf(i) != -1) { - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - opt = _dom2.default.createOpt(s[j], s[j], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - } // if multiFltsIndex - } else if (fltType === this.fltTypeCheckList) { - var checkList = this.Mod.checkList; - var divChk = checkList.checkListDiv[i]; - divChk.title = divChk.innerHTML; - divChk.innerHTML = ''; - - var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); - ul.className = checkList.checkListCssClass; - - var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); - li0.className = checkList.checkListItemCssClass; - ul.appendChild(li0); - - divChk.appendChild(ul); - - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - var li = _dom2.default.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.Mod.paging.setPagingInfo(); - } - } //end if - } - }, { - key: 'filter', - value: function filter() { - this.EvtManager(this.Evt.name.filter); - } - - /** - * Filter the table by retrieving the data from each cell in every single - * row and comparing it to the search term for current column. A row is - * hidden when all the search terms are not found in inspected row. - * - * TODO: Reduce complexity of this massive method - */ - - }, { - key: '_filter', - value: function _filter() { - if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { - return; - } - //invoke onbefore callback - if (this.onBeforeFilter) { - this.onBeforeFilter.call(null, this); - } - this.emitter.emit('before-filtering', this); - - var row = this.tbl.rows, - Mod = this.Mod, - hiddenrows = 0; - - this.validRowsIndex = []; - - // removes keyword highlighting - // if(this.highlightKeywords){ - // Mod.highlightKeyword.unhighlightAll(); - // } - //removes popup filters active icons - // if(this.popupFilters){ - // Mod.popupFilter.buildIcons(); - // } - //removes active column header class - if (this.markActiveColumns) { - this.clearActiveColumns(); - } - // search args re-init - this.searchArgs = this.getFiltersValue(); - - var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); - - //keyword highlighting - function highlight(str, ok, cell) { - /*jshint validthis:true */ - if (this.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 = _dom2.default.getText(cell); - } - if (w !== '') { - Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); - } - } - } - - //looks for search argument in current row - function hasArg(sA, cellData, j) { - /*jshint validthis:true */ - var occurence = undefined, - removeNbFormat = _helpers2.default.removeNbFormat; - - //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); - var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); - var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); - var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); - var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); - var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); - - var dte1 = undefined, - dte2 = undefined; - //dates - if (_date2.default.isValid(cellData, dtType)) { - dte1 = _date2.default.format(cellData, dtType); - // lower date - if (isLDate) { - dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); - occurence = dte1 < dte2; - } - // lower equal date - else if (isLEDate) { - dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); - occurence = dte1 <= dte2; - } - // greater equal date - else if (isGEDate) { - dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); - occurence = dte1 >= dte2; - } - // greater date - else if (isGDate) { - dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); - occurence = dte1 > dte2; - } - // different date - else if (isDFDate) { - dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); - occurence = dte1.toString() != dte2.toString(); - } - // equal date - else if (isEQDate) { - dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } else if (_date2.default.isValid(sA, dtType)) { - dte2 = _date2.default.format(sA, dtType); - occurence = dte1.toString() === dte2.toString(); - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } else { - //first numbers need to be formated - if (this.hasColNbFormat && this.colNbFormat[j]) { - numCellData = removeNbFormat(cellData, this.colNbFormat[j]); - nbFormat = this.colNbFormat[j]; - } else { - if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { - numCellData = removeNbFormat(cellData, 'us'); - nbFormat = 'us'; - } else { - numCellData = removeNbFormat(cellData, 'eu'); - nbFormat = 'eu'; - } - } - - // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, - // rgx:) - // lower equal - if (hasLE) { - occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); - } - //greater equal - else if (hasGE) { - occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); - } - //lower - else if (hasLO) { - occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); - } - //greater - else if (hasGR) { - occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); - } - //different - else if (hasDF) { - occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; - } - //like - else if (hasLK) { - occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } - //equal - else if (hasEQ) { - occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); - } - //starts with - else if (hasST) { - occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; - } - //ends with - else if (hasEN) { - var searchArg = sA.replace(re_en, ''); - occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } - //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(cellData); - } catch (e) { - occurence = false; - } - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } //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 = true, - - //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]; - var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; - if (sA === '') { - continue; - } - - var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); - - //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 = undefined, - occur = false, - s = hasMultiOrSA ? sAOrSplit : sAAndSplit; - for (var w = 0, len = s.length; w < len; w++) { - cS = _string2.default.trim(s[w]); - occur = hasArg.call(this, cS, cellData, j); - highlight.call(this, cS, occur, cell[j]); - if (hasMultiOrSA && occur) { - break; - } - if (hasMultiAndSA && !occur) { - break; - } - } - occurence[j] = occur; - } - //single search parameter - else { - occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); - highlight.call(this, sA, occurence[j], cell[j]); - } //else single param - - if (!occurence[j]) { - isRowValid = false; - } - if (this.singleSearchFlt && occurence[j]) { - singleFltRowValid = true; - } - if (this.popupFilters) { - Mod.popupFilter.buildIcon(j, true); - } - if (this.markActiveColumns) { - if (k === this.refRow) { - if (this.onBeforeActiveColumn) { - this.onBeforeActiveColumn.call(null, this, j); - } - _dom2.default.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); - if (Mod.alternateRows) { - Mod.alternateRows.removeRowBg(k); - } - // always visible rows need to be counted as valid - if (this.hasVisibleRows && this.visibleRows.indexOf(k) !== -1) { - this.validRowsIndex.push(k); - } else { - hiddenrows++; - } - } else { - this.validateRow(k, true); - this.validRowsIndex.push(k); - if (this.alternateRows) { - Mod.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; - - //invokes onafterfilter callback - if (this.onAfterFilter) { - this.onAfterFilter.call(null, this); - } - - this.emitter.emit('after-filtering', this); - } - - /** - * Return the data of a specified colum - * @param {Number} colIndex Column index - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} num Optional: return unformatted number - * @param {Array} exclude Optional: list of row indexes to be excluded - * @return {Array} Flat list of data for a column - */ - - }, { - key: 'getColValues', - value: function getColValues(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; - - if (!this.fltGrid) { - return; - } - var row = this.tbl.rows, - colValues = []; - - if (includeHeaders) { - colValues.push(this.getHeadersText()[colIndex]); - } - - for (var i = this.refRow; i < this.nbRows; i++) { - var isExludedRow = false; - // checks if current row index appears in exclude array - if (exclude.length > 0) { - isExludedRow = exclude.indexOf(i) != -1; - } - 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 !== '') { - continue; - } - var cellData = this.getCellData(cell[j]), - nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, - data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; - colValues.push(data); - } - } - } - return colValues; - } - - /** - * Return the filter's value of a specified column - * @param {Number} index Column index - * @return {String} Filter value - */ - - }, { - key: 'getFilterValue', - value: function getFilterValue(index) { - if (!this.fltGrid) { - return; - } - var fltValue = undefined, - flt = this.getFilterElement(index); - if (!flt) { - return ''; - } - - var fltColType = this.getFilterType(index); - if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { - fltValue = flt.value; - } - //mutiple select - else if (fltColType === this.fltTypeMulti) { - fltValue = ''; - for (var j = 0, len = flt.options.length; j < len; 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; - } - - /** - * Return the filters' values - * @return {Array} List of filters' values - */ - - }, { - key: 'getFiltersValue', - value: function getFiltersValue() { - if (!this.fltGrid) { - return; - } - var searchArgs = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); - } - return searchArgs; - } - - /** - * Return the ID of the filter of a specified column - * @param {Number} index Column's index - * @return {String} ID of the filter element - */ - - }, { - key: 'getFilterId', - value: function getFilterId(index) { - if (!this.fltGrid) { - return; - } - return this.fltIds[index]; - } - - /** - * Return the list of ids of filters matching a specified type. - * Note: hidden filters are also returned - * - * @param {String} type Filter type string ('input', 'select', 'multiple', - * 'checklist') - * @param {Boolean} bool If true returns columns indexes instead of IDs - * @return {[type]} List of element IDs or column indexes - */ - - }, { - key: 'getFiltersByType', - value: function getFiltersByType(type, bool) { - if (!this.fltGrid) { - return; - } - var arr = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - var fltType = this.getFilterType(i); - if (fltType === _string2.default.lower(type)) { - var a = bool ? i : this.fltIds[i]; - arr.push(a); - } - } - return arr; - } - - /** - * Return the filter's DOM element for a given column - * @param {Number} index Column's index - * @return {DOMElement} - */ - - }, { - key: 'getFilterElement', - value: function getFilterElement(index) { - var fltId = this.fltIds[index]; - return _dom2.default.id(fltId); - } - - /** - * Return the number of cells for a given row index - * @param {Number} rowIndex Index of the row - * @return {Number} Number of cells - */ - - }, { - key: 'getCellsNb', - value: function getCellsNb() { - var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; - - var tr = this.tbl.rows[rowIndex]; - return tr.cells.length; - } - - /** - * Return the number of filterable rows starting from reference row if - * defined - * @param {Boolean} includeHeaders Include the headers row - * @return {Number} Number of filterable rows - */ - - }, { - key: 'getRowsNb', - value: function getRowsNb(includeHeaders) { - var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, - ntrs = this.tbl.rows.length; - if (includeHeaders) { - s = 0; - } - return parseInt(ntrs - s, 10); - } - - /** - * Return the data of a given cell - * @param {DOMElement} cell Cell's DOM object - * @return {String} - */ - - }, { - key: 'getCellData', - value: function getCellData(cell) { - var idx = cell.cellIndex; - //Check for customCellData callback - if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { - return this.customCellData.call(null, this, cell, idx); - } else { - return _dom2.default.getText(cell); - } - } - - /** - * Return the table data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getTableData', - value: function getTableData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var rows = this.tbl.rows; - var tblData = []; - if (includeHeaders) { - tblData.push([this.getHeadersRowIndex(), this.getHeadersText()]); - } - for (var k = this.refRow; k < this.nbRows; k++) { - var rowData = [k, []]; - var cells = rows[k].cells; - for (var j = 0, len = cells.length; j < len; j++) { - var cellData = this.getCellData(cells[j]); - rowData[1].push(cellData); - } - tblData.push(rowData); - } - return tblData; - } - - /** - * Return the filtered data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredData', - value: function getFilteredData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - if (!this.validRowsIndex) { - return []; - } - var rows = this.tbl.rows, - filteredData = []; - if (includeHeaders) { - filteredData.push([this.getHeadersRowIndex(), this.getHeadersText()]); - } - - var validRows = this.getValidRows(true); - for (var i = 0; i < validRows.length; i++) { - var rData = [this.validRowsIndex[i], []], - cells = rows[this.validRowsIndex[i]].cells; - for (var k = 0; k < cells.length; k++) { - var cellData = this.getCellData(cells[k]); - rData[1].push(cellData); - } - filteredData.push(rData); - } - return filteredData; - } - - /** - * Return the filtered data for a given column index - * @param {Number} colIndex Colmun's index - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} Flat list of values ['val0','val1','val2'...] - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredDataCol', - value: function getFilteredDataCol(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (_types2.default.isUndef(colIndex)) { - return []; - } - var data = this.getFilteredData(), - colData = []; - if (includeHeaders) { - colData.push(this.getHeadersText()[colIndex]); - } - for (var i = 0, len = data.length; i < len; 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; - } - - /** - * Get the display value of a row - * @param {RowElement} DOM element of the row - * @return {String} Usually 'none' or '' - */ - - }, { - key: 'getRowDisplay', - value: function getRowDisplay(row) { - if (!_types2.default.isObj(row)) { - return null; - } - return row.style.display; - } - - /** - * Validate/invalidate row by setting the 'validRow' attribute on the row - * @param {Number} rowIndex Index of the row - * @param {Boolean} isValid - */ - - }, { - key: 'validateRow', - value: function validateRow(rowIndex, isValid) { - var row = this.tbl.rows[rowIndex]; - if (!row || typeof isValid !== 'boolean') { - return; - } - - // always visible rows are valid - if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { - isValid = true; - } - - var displayFlag = isValid ? '' : 'none', - validFlag = isValid ? 'true' : 'false'; - row.style.display = displayFlag; - - if (this.paging) { - row.setAttribute('validRow', validFlag); - } - } - - /** - * Validate all filterable rows - */ - - }, { - key: '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); - } - } - - /** - * Set search value to a given filter - * @param {Number} index Column's index - * @param {String} searcharg Search term - */ - - }, { - key: 'setFilterValue', - value: function setFilterValue(index) { - var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; - - if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { - return; - } - var slc = this.getFilterElement(index), - fltColType = this.getFilterType(index); - - if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { - slc.value = searcharg; - } - //multiple selects - else if (fltColType === this.fltTypeMulti) { - var s = searcharg.split(' ' + this.orOperator + ' '); - // let ct = 0; //keywords counter - for (var j = 0, len = slc.options.length; j < len; j++) { - var option = slc.options[j]; - if (s === '' || s[0] === '') { - option.selected = false; - } - if (option.value === '') { - option.selected = false; - } - if (option.value !== '' && _array2.default.has(s, option.value, true)) { - option.selected = true; - } //if - } //for j - } - //checklist - else if (fltColType === this.fltTypeCheckList) { - searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); - var sarg = searcharg.split(' ' + this.orOperator + ' '); - var lisNb = _dom2.default.tag(slc, 'li').length; - - slc.setAttribute('value', ''); - slc.setAttribute('indexes', ''); - - for (var k = 0; k < lisNb; k++) { - var li = _dom2.default.tag(slc, 'li')[k], - lbl = _dom2.default.tag(li, 'label')[0], - chk = _dom2.default.tag(li, 'input')[0], - lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); - if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { - chk.checked = true; - this.Mod.checkList.setCheckListValues(chk); - } else { - chk.checked = false; - this.Mod.checkList.setCheckListValues(chk); - } - } - } - } - - /** - * Set them columns' widths as per configuration - * @param {Number} rowIndex Optional row index to apply the widths to - * @param {Element} tbl DOM element - */ - - }, { - key: 'setColWidths', - value: function setColWidths(rowIndex, tbl) { - if (!this.fltGrid || !this.hasColWidths) { - return; - } - tbl = tbl || this.tbl; - var rIndex = undefined; - if (rowIndex === undefined) { - rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; - } else { - rIndex = rowIndex; - } - - setWidths.call(this); - - function setWidths() { - /*jshint validthis:true */ - var nbCols = this.nbCells; - var colWidths = this.colWidths; - var colTags = _dom2.default.tag(tbl, 'col'); - var tblHasColTag = colTags.length > 0; - var frag = !tblHasColTag ? doc.createDocumentFragment() : null; - for (var k = 0; k < nbCols; k++) { - var col = undefined; - if (tblHasColTag) { - col = colTags[k]; - } else { - col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); - frag.appendChild(col); - } - col.style.width = colWidths[k]; - } - if (!tblHasColTag) { - tbl.insertBefore(frag, tbl.firstChild); - } - } - } - - /** - * Makes defined rows always visible - */ - - }, { - key: 'enforceVisibility', - value: function enforceVisibility() { - if (!this.hasVisibleRows) { - return; - } - for (var i = 0, len = this.visibleRows.length; i < len; i++) { - var row = this.visibleRows[i]; - //row index cannot be > nrows - if (row <= this.nbRows) { - this.validateRow(row, true); - } - } - } - }, { - key: 'clearFilters', - value: function clearFilters() { - this.EvtManager(this.Evt.name.clear); - } - - /** - * Clear all the filters' values - */ - - }, { - key: '_clearFilters', - value: function _clearFilters() { - if (!this.fltGrid) { - return; - } - if (this.onBeforeReset) { - this.onBeforeReset.call(null, this, this.getFiltersValue()); - } - for (var i = 0, len = this.fltIds.length; i < len; i++) { - this.setFilterValue(i, ''); - } - // if(this.linkedFilters){ - // this.linkFilters(); - // } - if (this.rememberPageLen) { - _cookie2.default.remove(this.pgLenCookie); - } - if (this.rememberPageNb) { - _cookie2.default.remove(this.pgNbCookie); - } - if (this.onAfterReset) { - this.onAfterReset.call(null, this); - } - - this.emitter.emit('cleared-filters', this); - } - - /** - * Clears filtered columns visual indicator (background color) - */ - - }, { - key: 'clearActiveColumns', - value: function clearActiveColumns() { - for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { - _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); - } - } - - /** - * Refresh the filters subject to linking ('select', 'multiple', - * 'checklist' type) - */ - - }, { - key: 'linkFilters', - value: function linkFilters() { - if (!this.linkedFilters || !this.activeFilterId) { - return; - } - 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); - - var activeFlt = this.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(this.prfxFlt)[1]; - var slcSelectedValue = undefined; - for (var i = 0, len = slcIndex.length; i < len; i++) { - var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); - slcSelectedValue = this.getFilterValue(slcIndex[i]); - - // Welcome to cyclomatic complexity hell :) - // TODO: simplify/refactor if statement - if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; - } else { - curSlc.innerHTML = ''; - } - - //1st option needs to be inserted - if (this.loadFltOnDemand) { - var opt0 = _dom2.default.createOpt(this.displayAllText, ''); - if (curSlc) { - curSlc.appendChild(opt0); - } - } - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList._build(slcIndex[i]); - } else { - this.Mod.dropdown._build(slcIndex[i], true); - } - - this.setFilterValue(slcIndex[i], slcSelectedValue); - } - } // for i - } - - /** - * Re-generate the filters grid bar when previously removed - */ - - }, { - key: '_resetGrid', - value: function _resetGrid() { - if (this.isFirstLoad) { - return; - } - - var Mod = this.Mod; - var tbl = this.tbl; - var rows = tbl.rows; - var filtersRowIndex = this.filtersRowIndex; - var filtersRow = rows[filtersRowIndex]; - - // grid was removed, grid row element is stored in fltGridEl property - if (!this.gridLayout) { - // If table has a thead ensure the filters row is appended in the - // thead element - if (tbl.tHead) { - var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); - tbl.tHead.replaceChild(this.fltGridEl, tempRow); - } else { - filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); - } - } - - // filters are appended in external placeholders elements - if (this.isExternalFlt) { - var externalFltTgtIds = this.externalFltTgtIds; - for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { - var extFlt = _dom2.default.id(externalFltTgtIds[ct]); - - if (!extFlt) { - continue; - } - - var externalFltEl = this.externalFltEls[ct]; - extFlt.appendChild(externalFltEl); - var colFltType = this.getFilterType(ct); - //IE special treatment for gridLayout, appended filters are - //empty - if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { - if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { - Mod.dropdown.build(ct); - } - if (colFltType === this.fltTypeCheckList) { - Mod.checkList.build(ct); - } - } - } - } - - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = rows.length; - - if (this.popupFilters) { - this.headersRow++; - Mod.popupFilter.reset(); - } - - if (!this.gridLayout) { - _dom2.default.addClass(this.tbl, this.prfxTf); - } - this._hasGrid = true; - } - - /** - * Determines if passed filter column implements exact query match - * @param {Number} colIndex [description] - * @return {Boolean} [description] - */ - - }, { - key: 'isExactMatch', - value: function isExactMatch(colIndex) { - var fltType = this.getFilterType(colIndex); - return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; - } - - /** - * Check if passed script or stylesheet is already imported - * @param {String} filePath Ressource path - * @param {String} type Possible values: 'script' or 'link' - * @return {Boolean} - */ - - }, { - key: 'isImported', - value: function isImported(filePath, type) { - var imported = false, - importType = !type ? 'script' : type, - attr = importType == 'script' ? 'src' : 'href', - files = _dom2.default.tag(doc, importType); - for (var i = 0, len = files.length; i < len; i++) { - if (files[i][attr] === undefined) { - continue; - } - if (files[i][attr].match(filePath)) { - imported = true; - break; - } - } - return imported; - } - - /** - * Import script or stylesheet - * @param {String} fileId Ressource ID - * @param {String} filePath Ressource path - * @param {Function} callback Callback - * @param {String} type Possible values: 'script' or 'link' - */ - - }, { - key: 'import', - value: function _import(fileId, filePath, callback, type) { - var ftype = !type ? 'script' : type, - imported = this.isImported(filePath, ftype); - if (imported) { - return; - } - var o = this, - isLoaded = false, - file = undefined, - head = _dom2.default.tag(doc, 'head')[0]; - - if (_string2.default.lower(ftype) === 'link') { - file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); - } else { - file = _dom2.default.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: ' + filePath); - }; - head.appendChild(file); - } - - /** - * Check if table has filters grid - * @return {Boolean} - */ - - }, { - key: 'hasGrid', - value: function hasGrid() { - return this._hasGrid; - } - - /** - * Get list of filter IDs - * @return {[type]} [description] - */ - - }, { - key: 'getFiltersId', - value: function getFiltersId() { - return this.fltIds || []; - } - - /** - * Get filtered (valid) rows indexes - * @param {Boolean} reCalc Force calculation of filtered rows list - * @return {Array} List of row indexes - */ - - }, { - key: 'getValidRows', - value: function getValidRows(reCalc) { - 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; - } - - /** - * Get the index of the row containing the filters - * @return {Number} - */ - - }, { - key: 'getFiltersRowIndex', - value: function getFiltersRowIndex() { - return this.filtersRowIndex; - } - - /** - * Get the index of the headers row - * @return {Number} - */ - - }, { - key: 'getHeadersRowIndex', - value: function getHeadersRowIndex() { - return this.headersRow; - } - - /** - * Get the row index from where the filtering process start (1st filterable - * row) - * @return {Number} - */ - - }, { - key: 'getStartRowIndex', - value: function getStartRowIndex() { - return this.refRow; - } - - /** - * Get the index of the last row - * @return {Number} - */ - - }, { - key: 'getLastRowIndex', - value: function getLastRowIndex() { - if (!this._hasGrid) { - return; - } - return this.nbRows - 1; - } - - /** - * Get the header DOM element for a given column index - * @param {Number} colIndex Column index - * @return {Object} - */ - - }, { - key: 'getHeaderElement', - value: function getHeaderElement(colIndex) { - var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; - var tHead = _dom2.default.tag(table, 'thead'); - var headersRow = this.headersRow; - var header = undefined; - for (var i = 0; i < this.nbCells; i++) { - if (i !== colIndex) { - continue; - } - if (tHead.length === 0) { - header = table.rows[headersRow].cells[i]; - } - if (tHead.length === 1) { - header = tHead[0].rows[headersRow].cells[i]; - } - break; - } - return header; - } - - /** - * Return the list of headers' text - * @return {Array} list of headers' text - */ - - }, { - key: 'getHeadersText', - value: function getHeadersText() { - var headers = []; - for (var j = 0; j < this.nbCells; j++) { - var header = this.getHeaderElement(j); - var headerText = _dom2.default.getText(header); - headers.push(headerText); - } - return headers; - } - - /** - * Return the filter type for a specified column - * @param {Number} colIndex Column's index - * @return {String} - */ - - }, { - key: 'getFilterType', - value: function getFilterType(colIndex) { - var colType = this.cfg['col_' + colIndex]; - return !colType ? this.fltTypeInp : _string2.default.lower(colType); - } - - /** - * Get the total number of filterable rows - * @return {Number} - */ - - }, { - key: 'getFilterableRowsNb', - value: function getFilterableRowsNb() { - return this.getRowsNb(false); - } - - /** - * Get the configuration object (literal object) - * @return {Object} - */ - - }, { - key: 'config', - value: function config() { - return this.cfg; - } - }]); - - return TableFilter; - })(); - -/***/ }, -/* 1 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * DOM event utilities - */ - - exports.default = { - 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; - } - }, - target: function target(evt) { - return evt && evt.target || window.event && window.event.srcElement; - }, - keyCode: function keyCode(evt) { - return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; - } - }; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * DOM utilities - */ - - exports.default = { - - /** - * Returns text + text of children of given node - * @param {NodeElement} node - * @return {String} - */ - - getText: function getText(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 - */ - create: function create(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]); - } - } - } - return el; - }, - - /** - * Removes passed node from DOM - * @param {DOMElement} node - * @return {DOMElement} old node reference - */ - remove: function remove(node) { - return node.parentNode.removeChild(node); - }, - - /** - * Returns a text node with given text - * @param {String} txt - * @return {Object} - */ - text: function text(txt) { - return document.createTextNode(txt); - }, - hasClass: function hasClass(ele, cls) { - if (!ele) { - return false; - } - - if (supportsClassList()) { - return ele.classList.contains(cls); - } - return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); - }, - addClass: function addClass(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; - } - }, - removeClass: function removeClass(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 - */ - createOpt: function createOpt(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 - */ - createCheckItem: function createCheckItem(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; - }, - id: function id(key) { - return document.getElementById(key); - }, - tag: function tag(o, tagname) { - return o.getElementsByTagName(tagname); - } - }; - - // HTML5 classList API - - function supportsClassList() { - return document.documentElement.classList; - } - -/***/ }, -/* 3 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * String utilities - */ - - exports.default = { - lower: function lower(text) { - return text.toLowerCase(); - }, - upper: function upper(text) { - return text.toUpperCase(); - }, - trim: function trim(text) { - if (text.trim) { - return text.trim(); - } - return text.replace(/^\s*|\s*$/g, ''); - }, - isEmpty: function isEmpty(text) { - return this.trim(text) === ''; - }, - rgxEsc: function rgxEsc(text) { - var chars = /[-\/\\^$*+?.()|[\]{}]/g; - var escMatch = '\\$&'; - return String(text).replace(chars, escMatch); - }, - matchCase: function matchCase(text, caseSensitive) { - if (!caseSensitive) { - return this.lower(text); - } - return text; - }, - - /** - * Checks if passed data contains the searched term - * @param {String} term Searched term - * @param {String} data Data string - * @param {Boolean} exactMatch Exact match - * @param {Boolean} caseSensitive Case sensitive - * @return {Boolean} - */ - contains: function contains(term, data) { - var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; - - // Improved by Cedric Wartel (cwl) automatic exact match for selects and - // special characters are now filtered - var regexp = undefined, - modifier = caseSensitive ? 'g' : 'gi'; - if (exactMatch) { - regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); - } else { - regexp = new RegExp(this.rgxEsc(term), modifier); - } - return regexp.test(data); - } - }; - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Cookie utilities - */ - - exports.default = { - write: function write(name, value, hours) { - var expire = ''; - if (hours) { - expire = new Date(new Date().getTime() + hours * 3600000); - expire = '; expires=' + expire.toGMTString(); - } - document.cookie = name + '=' + escape(value) + expire; - }, - read: function read(name) { - var cookieValue = '', - search = name + '='; - if (document.cookie.length > 0) { - var cookie = document.cookie, - offset = cookie.indexOf(search); - if (offset !== -1) { - offset += search.length; - var end = cookie.indexOf(';', offset); - if (end === -1) { - end = cookie.length; - } - cookieValue = unescape(cookie.substring(offset, end)); - } - } - return cookieValue; - }, - remove: function remove(name) { - this.write(name, '', -1); - }, - valueToArray: function valueToArray(name, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.read(name); - //creates an array with filters' values - var arr = val.split(separator); - return arr; - }, - getValueByIndex: function getValueByIndex(name, index, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.valueToArray(name, separator); - return val[index]; - } - }; - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * Types utilities - */ - - var UNDEFINED = void 0; - - exports.default = { - /** - * Check if argument is an object or a global object - * @param {String or Object} v - * @return {Boolean} - */ - - isObj: function isObj(v) { - var isO = false; - if (typeof v === 'string') { - if (window[v] && _typeof(window[v]) === 'object') { - isO = true; - } - } else { - if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { - isO = true; - } - } - return isO; - }, - - /** - * Check if argument is a function - * @param {Function} fn - * @return {Boolean} - */ - isFn: function isFn(fn) { - return fn && fn.constructor == Function; - }, - - /** - * Check if argument is an array - * @param {Array} obj - * @return {Boolean} - */ - isArray: function isArray(obj) { - return obj && obj.constructor == Array; - }, - - /** - * Determine if argument is undefined - * @param {Any} o - * @return {Boolean} - */ - isUndef: function isUndef(o) { - return o === UNDEFINED; - }, - - /** - * Determine if argument is null - * @param {Any} o - * @return {Boolean} - */ - isNull: function isNull(o) { - return o === null; - }, - - /** - * Determine if argument is empty (undefined, null or empty string) - * @param {Any} o - * @return {Boolean} - */ - isEmpty: function isEmpty(o) { - return this.isUndef(o) || this.isNull(o) || o.length === 0; - } - }; - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - has: function has(arr, val, caseSensitive) { - var sCase = caseSensitive === undefined ? false : caseSensitive; - for (var i = 0; i < arr.length; i++) { - if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { - return true; - } - } - return false; - } - }; /** - * Array utilities - */ - -/***/ }, -/* 7 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Date utilities - */ - - exports.default = { - 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 = undefined, - reg2 = undefined; - // 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 = undefined, - dd = undefined, - yy = undefined; - // 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(dateStr, formatStr) { - if (!formatStr) { - formatStr = 'DMY'; - } - if (!dateStr || dateStr === '') { - return new Date(1001, 0, 1); - } - var oDate = undefined; - var parts = undefined; - - switch (formatStr.toUpperCase()) { - case 'DDMMMYYYY': - parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); - oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); - break; - case 'DMY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'MDY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'YMD': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - default: - //in case format is not correct - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - } - return oDate; - } - }; - - function y2kDate(yr) { - if (yr === undefined) { - return 0; - } - if (yr.length > 2) { - return yr; - } - var y = undefined; - //>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; - } - - function mmm2mm(mmm) { - if (mmm === undefined) { - return 0; - } - var mondigit = undefined; - 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; - } - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - removeNbFormat: function removeNbFormat(data, format) { - if (!data) { - return; - } - if (!format) { - format = 'us'; - } - var n = data; - if (_string2.default.lower(format) === 'us') { - n = +n.replace(/[^\d\.-]/g, ''); - } else { - n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); - } - return n; - } - }; /** - * Misc helpers - */ - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - "use strict"; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /** - * Event emitter class - */ - - var Emitter = exports.Emitter = (function () { - function Emitter() { - _classCallCheck(this, Emitter); - - /** - * Events object - * @type {Object} - */ - this.events = {}; - } - - /** - * Subscribe to an event - * @param {String} evt Event name - * @param {Function} fn Function invoked when event is emitted - */ - - _createClass(Emitter, [{ - key: "on", - value: function on(evt, fn) { - this.events[evt] = this.events[evt] || []; - this.events[evt].push(fn); - } - - /** - * Unsubscribe to an event - * @param {String} evt Event name - * @param {Function} fn Function invoked when event is emitted - */ - - }, { - key: "off", - value: function off(evt, fn) { - if (evt in this.events) { - this.events[evt].splice(this.events[evt].indexOf(fn), 1); - } - } - - /** - * Emit an event - * @param {String} evt Event name followed by any other argument passed to - * the invoked function - */ - - }, { - key: "emit", - value: function emit(evt /*, args...*/) { - if (evt in this.events === false) { - return; - } - for (var i = 0; i < this.events[evt].length; i++) { - this.events[evt][i].apply(this, [].slice.call(arguments, 1)); - } - } - }]); - - return Emitter; - })(); - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Store = undefined; - - var _cookie = __webpack_require__(4); - - var _cookie2 = _interopRequireDefault(_cookie); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Store = exports.Store = (function () { - - /** - * Store, persistence manager - * @param {Object} tf TableFilter instance - * - * TODO: use localStorage and fallback to cookie persistence - */ - - function Store(tf) { - _classCallCheck(this, Store); - - var f = tf.config(); - - this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(Store, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on('after-filtering', function () { - return _this.saveFilterValues(_this.tf.fltsValuesCookie); - }); - } - - /** - * Store filters' values in cookie - * @param {String} cookie name - */ - - }, { - key: 'saveFilterValues', - value: function saveFilterValues(name) { - var tf = this.tf; - var fltValues = []; - //store filters' values - for (var i = 0; i < tf.fltIds.length; i++) { - var value = tf.getFilterValue(i); - if (value === '') { - value = ' '; - } - fltValues.push(value); - } - //adds array size - fltValues.push(tf.fltIds.length); - - //writes cookie - _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); - } - - /** - * Retrieve filters' values from cookie - * @param {String} cookie name - * @return {Array} - */ - - }, { - key: 'getFilterValues', - value: function getFilterValues(name) { - var flts = _cookie2.default.read(name); - var rgx = new RegExp(this.tf.separator, 'g'); - // filters' values array - return flts.split(rgx); - } - - /** - * Store page number in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageNb', - value: function savePageNb(name) { - _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); - } - - /** - * Retrieve page number from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageNb', - value: function getPageNb(name) { - return _cookie2.default.read(name); - } - - /** - * Store page length in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageLength', - value: function savePageLength(name) { - _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); - } - - /** - * Retrieve page length from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageLength', - value: function getPageLength(name) { - return _cookie2.default.read(name); - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off('after-filtering', function () { - return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); - }); - } - }]); - - return Store; - })(); - -/***/ }, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.GridLayout = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var GridLayout = exports.GridLayout = (function (_Feature) { - _inherits(GridLayout, _Feature); - - /** - * Grid layout, table with fixed headers - * @param {Object} tf TableFilter instance - */ - - function GridLayout(tf) { - _classCallCheck(this, GridLayout); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); - - var f = _this.config; - - //defines grid width - _this.gridWidth = f.grid_width || null; - //defines grid height - _this.gridHeight = f.grid_height || null; - //defines css class for main container - _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; - //defines css class for div containing table - _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; - //defines css class for div containing headers' table - _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; - //defines css class for div containing rows counter, paging etc. - _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; - //defines which row contains column headers - _this.gridHeadRowIndex = f.grid_headers_row_index || 0; - //array of headers row indexes to be placed in header table - _this.gridHeadRows = f.grid_headers_rows || [0]; - //generate filters in table headers - _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; - //default col width - _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; - - _this.gridColElms = []; - - //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_'; - - _this.sourceTblHtml = tf.tbl.outerHTML; - return _this; - } - - /** - * Generates a grid with fixed headers - */ - - _createClass(GridLayout, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - var f = this.config; - var tbl = tf.tbl; - - if (this.initialized) { - return; - } - - tf.isExternalFlt = true; - - // default width of 100px if column widths not set - if (!tf.hasColWidths) { - tf.colWidths = []; - for (var k = 0; k < tf.nbCells; k++) { - var colW, - cell = tbl.rows[this.gridHeadRowIndex].cells[k]; - if (cell.width !== '') { - colW = cell.width; - } else if (cell.style.width !== '') { - colW = parseInt(cell.style.width, 10); - } else { - colW = this.gridDefaultColWidth; - } - tf.colWidths[k] = colW; - } - tf.hasColWidths = true; - } - tf.setColWidths(this.gridHeadRowIndex); - - var tblW; //initial table width - if (tbl.width !== '') { - tblW = tbl.width; - } else if (tbl.style.width !== '') { - tblW = parseInt(tbl.style.width, 10); - } else { - tblW = tbl.clientWidth; - } - - //Main container: it will contain all the elements - this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); - this.tblMainCont.className = this.gridMainContCssClass; - if (this.gridWidth) { - this.tblMainCont.style.width = this.gridWidth; - } - tbl.parentNode.insertBefore(this.tblMainCont, tbl); - - //Table container: div wrapping content table - this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); - this.tblCont.className = this.gridContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.tblCont.style.width = '100%'; - } else { - this.tblCont.style.width = this.gridWidth; - } - } - if (this.gridHeight) { - this.tblCont.style.height = this.gridHeight; - } - tbl.parentNode.insertBefore(this.tblCont, tbl); - var t = _dom2.default.remove(tbl); - this.tblCont.appendChild(t); - - //In case table width is expressed in % - if (tbl.style.width === '') { - tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; - } - - var d = _dom2.default.remove(this.tblCont); - this.tblMainCont.appendChild(d); - - //Headers table container: div wrapping headers table - this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); - this.headTblCont.className = this.gridHeadContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.headTblCont.style.width = '100%'; - } else { - this.headTblCont.style.width = this.gridWidth; - } - } - - //Headers table - this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); - var tH = _dom2.default.create('tHead'); - - //1st row should be headers row, ids are added if not set - //Those ids are used by the sort feature - var hRow = tbl.rows[this.gridHeadRowIndex]; - var sortTriggers = []; - for (var n = 0; n < tf.nbCells; n++) { - var c = hRow.cells[n]; - var thId = c.getAttribute('id'); - if (!thId || thId === '') { - thId = this.prfxGridTh + n + '_' + tf.id; - c.setAttribute('id', thId); - } - sortTriggers.push(thId); - } - - //Filters row is created - var filtersRow = _dom2.default.create('tr'); - if (this.gridEnableFilters && tf.fltGrid) { - tf.externalFltTgtIds = []; - for (var j = 0; j < tf.nbCells; j++) { - var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; - var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); - filtersRow.appendChild(cl); - tf.externalFltTgtIds[j] = fltTdId; - } - } - //Headers row are moved from content table to headers table - for (var i = 0; i < this.gridHeadRows.length; i++) { - var headRow = tbl.rows[this.gridHeadRows[0]]; - tH.appendChild(headRow); - } - this.headTbl.appendChild(tH); - if (tf.filtersRowIndex === 0) { - tH.insertBefore(filtersRow, hRow); - } else { - tH.appendChild(filtersRow); - } - - this.headTblCont.appendChild(this.headTbl); - this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); - - //THead needs to be removed in content table for sort feature - var thead = _dom2.default.tag(tbl, 'thead'); - if (thead.length > 0) { - tbl.removeChild(thead[0]); - } - - //Headers table style - this.headTbl.style.tableLayout = 'fixed'; - tbl.style.tableLayout = 'fixed'; - this.headTbl.cellPadding = tbl.cellPadding; - this.headTbl.cellSpacing = tbl.cellSpacing; - // this.headTbl.style.width = tbl.style.width; - - //content table without headers needs col widths to be reset - tf.setColWidths(0, this.headTbl); - - //Headers container width - // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; - - tbl.style.width = ''; - // - this.headTbl.style.width = tbl.clientWidth + 'px'; - // - - //scroll synchronisation - _event2.default.add(this.tblCont, 'scroll', function (evt) { - var elm = _event2.default.target(evt); - var scrollLeft = elm.scrollLeft; - _this2.headTblCont.scrollLeft = scrollLeft; - //New pointerX calc taking into account scrollLeft - // if(!o.isPointerXOverwritten){ - // try{ - // o.Evt.pointerX = function(evt){ - // var e = evt || global.event; - // var bdScrollLeft = tf_StandardBody().scrollLeft + - // scrollLeft; - // return (e.pageX + scrollLeft) || - // (e.clientX + bdScrollLeft); - // }; - // o.isPointerXOverwritten = true; - // } catch(err) { - // o.isPointerXOverwritten = false; - // } - // } - }); - - //Configure sort extension if any - var sort = (f.extensions || []).filter(function (itm) { - return itm.name === 'sort'; - }); - if (sort.length === 1) { - sort[0].async_sort = true; - sort[0].trigger_ids = sortTriggers; - } - - //Cols generation for all browsers excepted IE<=7 - this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; - - //Col elements are enough to keep column widths after sorting and - //filtering - var createColTags = function createColTags() { - for (var k = tf.nbCells - 1; k >= 0; k--) { - var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); - tbl.insertBefore(col, tbl.firstChild); - col.style.width = tf.colWidths[k]; - this.gridColElms[k] = col; - } - this.tblHasColTag = true; - }; - - if (!this.tblHasColTag) { - createColTags.call(this); - } else { - var cols = _dom2.default.tag(tbl, 'col'); - for (var ii = 0; ii < tf.nbCells; ii++) { - cols[ii].setAttribute('id', tf.id + '_col_' + ii); - cols[ii].style.width = tf.colWidths[ii]; - this.gridColElms.push(cols[ii]); - } - } - - var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; - f.on_after_col_resized = function (o, colIndex) { - if (!colIndex) { - return; - } - var w = o.crWColsRow.cells[colIndex].style.width; - var col = o.gridColElms[colIndex]; - col.style.width = w; - - var thCW = o.crWColsRow.cells[colIndex].clientWidth; - var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; - - if (thCW != tdCW) { - o.headTbl.style.width = tbl.clientWidth + 'px'; - } - - if (afterColResizedFn) { - afterColResizedFn.call(null, o, colIndex); - } - }; - - if (tf.popupFilters) { - filtersRow.style.display = 'none'; - } - - if (tbl.clientWidth !== this.headTbl.clientWidth) { - tbl.style.width = this.headTbl.clientWidth + 'px'; - } - - this.initialized = true; - } - - /** - * Removes the grid layout - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - var tbl = tf.tbl; - - if (!this.initialized) { - return; - } - var t = _dom2.default.remove(tbl); - this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); - _dom2.default.remove(this.tblMainCont); - - this.tblMainCont = null; - this.headTblCont = null; - this.headTbl = null; - this.tblCont = null; - - tbl.outerHTML = this.sourceTblHtml; - //needed to keep reference of table element for future usage - this.tf.tbl = t; - - this.initialized = false; - } - }]); - - return GridLayout; - })(_feature.Feature); - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var NOTIMPLEMENTED = 'Not implemented.'; - - var Feature = exports.Feature = (function () { - function Feature(tf, feature) { - _classCallCheck(this, Feature); - - this.tf = tf; - this.feature = feature; - this.enabled = tf[feature]; - this.config = tf.config(); - this.emitter = tf.emitter; - this.initialized = false; - } - - _createClass(Feature, [{ - key: 'init', - value: function init() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - } - }, { - key: 'destroy', - value: function destroy() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'enable', - value: function enable() { - this.enabled = true; - } - }, { - key: 'disable', - value: function disable() { - this.enabled = false; - } - }, { - key: 'isEnabled', - value: function isEnabled() { - return this.enabled; - } - }]); - - return Feature; - })(); - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Loader = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var Loader = exports.Loader = (function (_Feature) { - _inherits(Loader, _Feature); - - /** - * Loading message/spinner - * @param {Object} tf TableFilter instance - */ - - function Loader(tf) { - _classCallCheck(this, Loader); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); - - var f = _this.config; - - //id of container element - _this.loaderTgtId = f.loader_target_id || null; - //div containing loader - _this.loaderDiv = null; - //defines loader text - _this.loaderText = f.loader_text || 'Loading...'; - //defines loader innerHtml - _this.loaderHtml = f.loader_html || null; - //defines css class for loader div - _this.loaderCssClass = f.loader_css_class || 'loader'; - //delay for hiding loader - _this.loaderCloseDelay = 200; - //callback function before loader is displayed - _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; - //callback function after loader is closed - _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; - //loader div - _this.prfxLoader = 'load_'; - return _this; - } - - _createClass(Loader, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - var tf = this.tf; - - var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); - containerDiv.className = this.loaderCssClass; - - var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); - if (!this.loaderTgtId) { - targetEl.insertBefore(containerDiv, tf.tbl); - } else { - targetEl.appendChild(containerDiv); - } - this.loaderDiv = containerDiv; - if (!this.loaderHtml) { - this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); - } else { - this.loaderDiv.innerHTML = this.loaderHtml; - } - - this.show('none'); - this.initialized = true; - } - }, { - key: 'show', - value: function show(p) { - var _this2 = this; - - if (!this.isEnabled() || this.loaderDiv.style.display === p) { - return; - } - - var displayLoader = function displayLoader() { - if (!_this2.loaderDiv) { - return; - } - if (_this2.onShowLoader && p !== 'none') { - _this2.onShowLoader.call(null, _this2); - } - _this2.loaderDiv.style.display = p; - if (_this2.onHideLoader && p === 'none') { - _this2.onHideLoader.call(null, _this2); - } - }; - - var t = p === 'none' ? this.loaderCloseDelay : 1; - global.setTimeout(displayLoader, t); - } - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - - _dom2.default.remove(this.loaderDiv); - this.loaderDiv = null; - this.initialized = false; - } - }]); - - return Loader; - })(_feature.Feature); - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.HighlightKeyword = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var HighlightKeyword = exports.HighlightKeyword = (function () { - - /** - * HighlightKeyword, highlight matched keyword - * @param {Object} tf TableFilter instance - */ - - function HighlightKeyword(tf) { - _classCallCheck(this, HighlightKeyword); - - var f = tf.config(); - //defines css class for highlighting - this.highlightCssClass = f.highlight_css_class || 'keyword'; - this.highlightedNodes = []; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(HighlightKeyword, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on('before-filtering', function () { - return _this.unhighlightAll(); - }); - } - - /** - * highlight occurences of searched term in passed node - * @param {Node} node - * @param {String} word Searched term - * @param {String} cssClass Css class name - */ - - }, { - key: 'highlight', - value: function highlight(node, word, cssClass) { - // Iterate into this nodes childNodes - if (node.hasChildNodes) { - var children = node.childNodes; - for (var i = 0; i < children.length; i++) { - this.highlight(children[i], word, cssClass); - } - } - - if (node.nodeType === 3) { - var tempNodeVal = _string2.default.lower(node.nodeValue); - var tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) != -1) { - var pn = node.parentNode; - if (pn && pn.className != cssClass) { - // word not highlighted yet - var nv = node.nodeValue, - ni = tempNodeVal.indexOf(tempWordVal), - - // Create a load of replacement nodes - before = _dom2.default.text(nv.substr(0, ni)), - docWordVal = nv.substr(ni, word.length), - after = _dom2.default.text(nv.substr(ni + word.length)), - hiwordtext = _dom2.default.text(docWordVal), - hiword = _dom2.default.create('span'); - hiword.className = cssClass; - hiword.appendChild(hiwordtext); - pn.insertBefore(before, node); - pn.insertBefore(hiword, node); - pn.insertBefore(after, node); - pn.removeChild(node); - this.highlightedNodes.push(hiword.firstChild); - } - } - } - } - - /** - * Removes highlight to nodes matching passed string - * @param {String} word - * @param {String} cssClass Css class to remove - */ - - }, { - key: 'unhighlight', - value: function unhighlight(word, cssClass) { - var arrRemove = []; - var highlightedNodes = this.highlightedNodes; - for (var i = 0; i < highlightedNodes.length; i++) { - var n = highlightedNodes[i]; - if (!n) { - continue; - } - var tempNodeVal = _string2.default.lower(n.nodeValue), - tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) !== -1) { - var pn = n.parentNode; - if (pn && pn.className === cssClass) { - var prevSib = pn.previousSibling, - nextSib = pn.nextSibling; - if (!prevSib || !nextSib) { - continue; - } - nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; - prevSib.nodeValue = ''; - n.nodeValue = ''; - arrRemove.push(i); - } - } - } - for (var k = 0; k < arrRemove.length; k++) { - highlightedNodes.splice(arrRemove[k], 1); - } - } - - /** - * Clear all occurrences of highlighted nodes - */ - - }, { - key: 'unhighlightAll', - value: function unhighlightAll() { - if (!this.tf.highlightKeywords || !this.tf.searchArgs) { - return; - } - for (var y = 0; y < this.tf.searchArgs.length; y++) { - this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); - } - this.highlightedNodes = []; - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off('before-filtering', function () { - return _this2.unhighlightAll(); - }); - } - }]); - - return HighlightKeyword; - })(); - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.PopupFilter = undefined; - - var _feature = __webpack_require__(12); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var PopupFilter = exports.PopupFilter = (function (_Feature) { - _inherits(PopupFilter, _Feature); - - /** - * Pop-up filter component - * @param {Object} tf TableFilter instance - */ - - function PopupFilter(tf) { - _classCallCheck(this, PopupFilter); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); - - var f = _this.config; - - // Enable external filters behaviour - tf.isExternalFlt = true; - tf.externalFltTgtIds = []; - - //filter icon path - _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; - //active filter icon path - _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; - _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; - //defines css class for popup div containing filter - _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; - //callback function before popup filtes is opened - _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; - //callback function after popup filtes is opened - _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; - //callback function before popup filtes is closed - _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; - //callback function after popup filtes is closed - _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; - - //stores filters spans - _this.popUpFltSpans = []; - //stores filters icons - _this.popUpFltImgs = []; - //stores filters containers - _this.popUpFltElms = _this.popUpFltElmCache || []; - _this.popUpFltAdjustToContainer = true; - - //id prefix for pop-up filter span - _this.prfxPopUpSpan = 'popUpSpan_'; - //id prefix for pop-up div containing filter - _this.prfxPopUpDiv = 'popUpDiv_'; - return _this; - } - - _createClass(PopupFilter, [{ - key: 'onClick', - value: function onClick(e) { - var evt = e || global.event, - elm = evt.target.parentNode, - colIndex = parseInt(elm.getAttribute('ci'), 10); - - this.closeAll(colIndex); - this.toggle(colIndex); - - if (this.popUpFltAdjustToContainer) { - var popUpDiv = this.popUpFltElms[colIndex], - header = this.tf.getHeaderElement(colIndex), - headerWidth = header.clientWidth * 0.95; - popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; - } - _event2.default.cancel(evt); - _event2.default.stop(evt); - } - - /** - * Initialize DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - for (var i = 0; i < tf.nbCells; i++) { - if (tf.getFilterType(i) === tf.fltTypeNone) { - continue; - } - var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); - popUpSpan.innerHTML = this.popUpImgFltHtml; - var header = tf.getHeaderElement(i); - header.appendChild(popUpSpan); - _event2.default.add(popUpSpan, 'click', function (evt) { - _this2.onClick(evt); - }); - this.popUpFltSpans[i] = popUpSpan; - this.popUpFltImgs[i] = popUpSpan.firstChild; - } - - // subscribe to events - this.emitter.on('before-filtering', function () { - return _this2.buildIcons(); - }); - this.emitter.on('after-filtering', function () { - return _this2.closeAll(); - }); - - this.initialized = true; - } - - /** - * Reset previously destroyed feature - */ - - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - this.buildAll(); - } - - /** - * Build all pop-up filters elements - */ - - }, { - key: 'buildAll', - value: function buildAll() { - for (var i = 0; i < this.popUpFltElmCache.length; i++) { - this.build(i, this.popUpFltElmCache[i]); - } - } - - /** - * Build a specified pop-up filter elements - * @param {Number} colIndex Column index - * @param {Object} div Optional container DOM element - */ - - }, { - key: 'build', - value: function build(colIndex, div) { - var tf = this.tf; - var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; - popUpDiv.className = this.popUpDivCssClass; - tf.externalFltTgtIds.push(popUpDiv.id); - var header = tf.getHeaderElement(colIndex); - header.insertBefore(popUpDiv, header.firstChild); - _event2.default.add(popUpDiv, 'click', function (evt) { - _event2.default.stop(evt); - }); - this.popUpFltElms[colIndex] = popUpDiv; - } - - /** - * Toogle visibility of specified filter - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggle', - value: function toggle(colIndex) { - var tf = this.tf, - popUpFltElm = this.popUpFltElms[colIndex]; - - if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { - if (this.onBeforePopUpOpen) { - this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'block'; - if (tf.getFilterType(colIndex) === tf.fltTypeInp) { - var flt = tf.getFilterElement(colIndex); - if (flt) { - flt.focus(); - } - } - if (this.onAfterPopUpOpen) { - this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } else { - if (this.onBeforePopUpClose) { - this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'none'; - if (this.onAfterPopUpClose) { - this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } - } - - /** - * Close all filters excepted for the specified one if any - * @param {Number} exceptIdx Column index of the filter to not close - */ - - }, { - key: 'closeAll', - value: function closeAll(exceptIdx) { - for (var i = 0; i < this.popUpFltElms.length; i++) { - if (i === exceptIdx) { - continue; - } - var popUpFltElm = this.popUpFltElms[i]; - if (popUpFltElm) { - popUpFltElm.style.display = 'none'; - } - } - } - - /** - * Build all the icons representing the pop-up filters - */ - - }, { - key: 'buildIcons', - value: function buildIcons() { - for (var i = 0; i < this.popUpFltImgs.length; i++) { - this.buildIcon(i, false); - } - } - - /** - * Build specified icon - * @param {Number} colIndex Column index - * @param {Boolean} active Apply active state - */ - - }, { - key: 'buildIcon', - value: function buildIcon(colIndex, active) { - if (this.popUpFltImgs[colIndex]) { - this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; - } - } - - /** - * Remove pop-up filters - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - this.popUpFltElmCache = []; - for (var i = 0; i < this.popUpFltElms.length; i++) { - var popUpFltElm = this.popUpFltElms[i], - popUpFltSpan = this.popUpFltSpans[i], - popUpFltImg = this.popUpFltImgs[i]; - if (popUpFltElm) { - _dom2.default.remove(popUpFltElm); - this.popUpFltElmCache[i] = popUpFltElm; - } - popUpFltElm = null; - if (popUpFltSpan) { - _dom2.default.remove(popUpFltSpan); - } - popUpFltSpan = null; - if (popUpFltImg) { - _dom2.default.remove(popUpFltImg); - } - popUpFltImg = null; - } - this.popUpFltElms = []; - this.popUpFltSpans = []; - this.popUpFltImgs = []; - - // unsubscribe to events - this.emitter.off('before-filtering', function () { - return _this3.buildIcons(); - }); - this.emitter.off('after-filtering', function () { - return _this3.closeAll(); - }); - - this.initialized = false; - } - }]); - - return PopupFilter; - })(_feature.Feature); - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Dropdown = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Dropdown = exports.Dropdown = (function () { - - /** - * Dropdown UI component - * @param {Object} tf TableFilter instance - */ - - function Dropdown(tf) { - _classCallCheck(this, Dropdown); - - // Configuration object - var f = tf.config(); - - this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; - //defines empty option text - this.nonEmptyText = f.non_empty_text || '(Non empty)'; - //sets select filling method: 'innerHTML' or 'createElement' - this.slcFillingMethod = f.slc_filling_method || 'createElement'; - //IE only, tooltip text appearing on select before it is populated - this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; - //tooltip text appearing on multiple select - this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; - - this.isCustom = null; - this.opts = null; - this.optsTxt = null; - this.slcInnerHtml = null; - - this.tf = tf; - } - - /** - * Build drop-down filter UI asynchronously - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Boolean} isExternal Render in external container - * @param {String} extSlcId External container id - */ - - _createClass(Dropdown, [{ - key: 'build', - value: function build(colIndex, isLinked, isExternal, extSlcId) { - var tf = this.tf; - tf.EvtManager(tf.Evt.name.dropdown, { - slcIndex: colIndex, - slcRefreshed: isLinked, - slcExternal: isExternal, - slcId: extSlcId - }); - } - - /** - * Build drop-down filter UI - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Boolean} isExternal Render in external container - * @param {String} extSlcId External container id - */ - - }, { - key: '_build', - value: function _build(colIndex) { - var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.opts = []; - this.optsTxt = []; - this.slcInnerHtml = ''; - - var slcId = tf.fltIds[colIndex]; - if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { - return; - } - var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), - rows = tf.tbl.rows, - matchCase = tf.matchCase; - - //custom select test - this.isCustom = tf.isCustomOptions(colIndex); - - //custom selects text - var activeFlt; - if (isLinked && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - /*** remember grid values ***/ - var fltsValues = [], - fltArr = []; - if (tf.rememberGridValues) { - fltsValues = tf.feature('store').getFilterValues(tf.fltsValuesCookie); - if (fltsValues && !_string2.default.isEmpty(fltsValues.toString())) { - if (this.isCustom) { - fltArr.push(fltsValues[colIndex]); - } else { - fltArr = fltsValues[colIndex].split(' ' + tf.orOperator + ' '); - } - } - } - - var excludedOpts = null, - filteredDataCol = null; - if (isLinked && tf.disableExcludedOptions) { - excludedOpts = []; - filteredDataCol = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cell = rows[k].cells, - nchilds = cell.length; - - // checks if row has exact cell # - if (nchilds !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - // WTF: cyclomatic complexity hell - if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cell[j]), - - //Vary Peter's patch - cell_string = _string2.default.matchCase(cell_data, matchCase); - - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, matchCase)) { - this.opts.push(cell_data); - } - - if (isLinked && tf.disableExcludedOptions) { - var filteredCol = filteredDataCol[j]; - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { - excludedOpts.push(cell_data); - } - } - } //if colIndex==j - } //for j - } //for k - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (excludedOpts) { - excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - } - } - - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (excludedOpts) { - excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (excludedOpts) { - excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - //populates drop-down - this.addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr); - } - - /** - * Add drop-down options - * @param {Number} colIndex Column index - * @param {Object} slc Select Dom element - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Array} excludedOpts Array of excluded options - * @param {Array} fltsValues Collection of persisted filter values - * @param {Array} fltArr Collection of persisted filter values - */ - - }, { - key: 'addOptions', - value: function addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod), - slcValue = slc.value; - - slc.innerHTML = ''; - slc = this.addFirstOption(slc); - - for (var y = 0; y < this.opts.length; y++) { - if (this.opts[y] === '') { - continue; - } - var val = this.opts[y]; //option value - var lbl = this.isCustom ? this.optsTxt[y] : val; //option text - var isDisabled = false; - if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - isDisabled = true; - } - - if (fillMethod === 'innerhtml') { - var slcAttr = ''; - if (tf.loadFltOnDemand && slcValue === this.opts[y]) { - slcAttr = 'selected="selected"'; - } - this.slcInnerHtml += ''; - } else { - var opt; - //fill select on demand - if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { - opt = _dom2.default.createOpt(lbl, val, true); - } else { - if (tf.getFilterType(colIndex) !== tf.fltTypeMulti) { - opt = _dom2.default.createOpt(lbl, val, fltsValues[colIndex] !== ' ' && val === fltsValues[colIndex] ? true : false); - } else { - opt = _dom2.default.createOpt(lbl, val, _array2.default.has(fltArr, _string2.default.matchCase(this.opts[y], tf.matchCase), tf.matchCase) || fltArr.toString().indexOf(val) !== -1 ? true : false); - } - } - if (isDisabled) { - opt.disabled = true; - } - slc.appendChild(opt); - } - } // for y - - if (fillMethod === 'innerhtml') { - slc.innerHTML += this.slcInnerHtml; - } - slc.setAttribute('filled', '1'); - } - - /** - * Add drop-down header option - * @param {Object} slc Select DOM element - */ - - }, { - key: 'addFirstOption', - value: function addFirstOption(slc) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod); - - if (fillMethod === 'innerhtml') { - this.slcInnerHtml += ''; - } else { - var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); - if (!this.enableSlcResetFilter) { - opt0.style.display = 'none'; - } - slc.appendChild(opt0); - if (tf.enableEmptyOption) { - var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); - slc.appendChild(opt1); - } - if (tf.enableNonEmptyOption) { - var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); - slc.appendChild(opt2); - } - } - return slc; - } - }]); - - return Dropdown; - })(); - -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - ignoreCase: function ignoreCase(a, b) { - var x = _string2.default.lower(a); - var y = _string2.default.lower(b); - return x < y ? -1 : x > y ? 1 : 0; - } - }; - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.CheckList = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var CheckList = exports.CheckList = (function () { - - /** - * Checklist UI component - * @param {Object} tf TableFilter instance - */ - - function CheckList(tf) { - _classCallCheck(this, CheckList); - - // Configuration object - var f = tf.config(); - - this.checkListDiv = []; //checklist container div - //defines css class for div containing checklist filter - this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; - //defines css class for checklist filters - this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; - //defines css class for checklist item (li) - this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; - //defines css class for selected checklist item (li) - this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; - //Load on demand text - this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; - //defines css class for checklist filters - this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; - this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; - //checklist filter container div - this.prfxCheckListDiv = 'chkdiv_'; - - this.isCustom = null; - this.opts = null; - this.optsTxt = null; - this.excludedOpts = null; - - this.tf = tf; - } - - // TODO: move event here - - _createClass(CheckList, [{ - key: 'onChange', - value: function onChange(evt) { - var elm = evt.target; - this.tf.activeFilterId = elm.getAttribute('id'); - this.tf.activeFlt = _dom2.default.id(this.tf.activeFilterId); - this.tf.Evt.onSlcChange.call(this.tf, evt); - } - }, { - key: 'optionClick', - value: function optionClick(evt) { - this.setCheckListValues(evt.target); - this.onChange(evt); - } - - /** - * Build checklist UI asynchronously - * @param {Number} colIndex Column index - * @param {Boolean} isExternal Render in external container - * @param {String} extFltId External container id - */ - - }, { - key: 'build', - value: function build(colIndex, isExternal, extFltId) { - var tf = this.tf; - tf.EvtManager(tf.Evt.name.checklist, { slcIndex: colIndex, slcExternal: isExternal, slcId: extFltId }); - } - - /** - * Build checklist UI - * @param {Number} colIndex Column index - * @param {Boolean} isExternal Render in external container - * @param {String} extFltId External container id - */ - - }, { - key: '_build', - value: function _build(colIndex) { - var _this = this; - - var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.opts = []; - this.optsTxt = []; - - var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; - if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { - return; - } - - var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); - var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); - ul.className = this.checkListCssClass; - _event2.default.add(ul, 'change', function (evt) { - _this.onChange(evt); - }); - - var rows = tf.tbl.rows; - this.isCustom = tf.isCustomOptions(colIndex); - - var activeFlt; - if (tf.linkedFilters && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - var filteredDataCol = []; - if (tf.linkedFilters && tf.disableExcludedOptions) { - this.excludedOpts = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cells = rows[k].cells; - var ncells = cells.length; - - // checks if row has exact cell # - if (ncells !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < ncells; j++) { - // WTF: cyclomatic complexity hell :) - if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cells[j]); - //Vary Peter's patch - var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { - this.opts.push(cell_data); - } - var filteredCol = filteredDataCol[j]; - if (tf.linkedFilters && tf.disableExcludedOptions) { - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { - this.excludedOpts.push(cell_data); - } - } - } - } - } - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!tf.matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (this.excludedOpts) { - this.excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - } - } - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - this.addChecks(colIndex, ul, tf.separator); - - if (tf.loadFltOnDemand) { - flt.innerHTML = ''; - } - flt.appendChild(ul); - flt.setAttribute('filled', '1'); - } - - /** - * Add checklist options - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addChecks', - value: function addChecks(colIndex, ul) { - var _this2 = this; - - var tf = this.tf; - var chkCt = this.addTChecks(colIndex, ul); - var fltArr = []; //remember grid values - var store = tf.feature('store'); - var tmpVal = store ? store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null; - if (tmpVal && _string2.default.trim(tmpVal).length > 0) { - if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1) { - fltArr.push(tmpVal); - } else { - fltArr = tmpVal.split(' ' + tf.orOperator + ' '); - } - } - - for (var y = 0; y < this.opts.length; y++) { - var val = this.opts[y]; //item value - var lbl = this.isCustom ? this.optsTxt[y] : val; //item text - var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); - li.className = this.checkListItemCssClass; - if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - _dom2.default.addClass(li, this.checkListItemDisabledCssClass); - li.check.disabled = true; - li.disabled = true; - } else { - _event2.default.add(li.check, 'click', function (evt) { - _this2.optionClick(evt); - }); - } - ul.appendChild(li); - - if (val === '') { - //item is hidden - li.style.display = 'none'; - } - - /*** remember grid values ***/ - if (tf.rememberGridValues) { - if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1 && fltArr.toString().indexOf(val) != -1 || _array2.default.has(fltArr, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - li.check.checked = true; - this.setCheckListValues(li.check); - } - } - } - } - - /** - * Add checklist header option - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addTChecks', - value: function addTChecks(colIndex, ul) { - var _this3 = this; - - var tf = this.tf; - var chkCt = 1; - var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); - li0.className = this.checkListItemCssClass; - ul.appendChild(li0); - - _event2.default.add(li0.check, 'click', function (evt) { - _this3.optionClick(evt); - }); - - if (!this.enableCheckListResetFilter) { - li0.style.display = 'none'; - } - - if (tf.enableEmptyOption) { - var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); - li1.className = this.checkListItemCssClass; - ul.appendChild(li1); - _event2.default.add(li1.check, 'click', function (evt) { - _this3.optionClick(evt); - }); - chkCt++; - } - - if (tf.enableNonEmptyOption) { - var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); - li2.className = this.checkListItemCssClass; - ul.appendChild(li2); - _event2.default.add(li2.check, 'click', function (evt) { - _this3.optionClick(evt); - }); - chkCt++; - } - return chkCt; - } - - /** - * Store checked options in DOM element attribute - * @param {Object} o checklist option DOM element - */ - - }, { - key: 'setCheckListValues', - value: function setCheckListValues(o) { - if (!o) { - return; - } - var tf = this.tf; - var chkValue = o.value; //checked item value - var chkIndex = parseInt(o.id.split('_')[2], 10); - var filterTag = 'ul', - itemTag = 'li'; - var n = o; - - //ul tag search - while (_string2.default.lower(n.nodeName) !== filterTag) { - n = n.parentNode; - } - - var li = n.childNodes[chkIndex]; - var colIndex = n.getAttribute('colIndex'); - var fltValue = n.getAttribute('value'); //filter value (ul tag) - var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) - - if (o.checked) { - //show all item - if (chkValue === '') { - if (fltIndexes && fltIndexes !== '') { - //items indexes - var indSplit = fltIndexes.split(tf.separator); - //checked items loop - for (var u = 0; u < indSplit.length; u++) { - //checked item - var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); - if (cChk) { - cChk.checked = false; - _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); - } - } - } - n.setAttribute('value', ''); - n.setAttribute('indexes', ''); - } else { - fltValue = fltValue ? fltValue : ''; - chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); - chkIndex = fltIndexes + chkIndex + tf.separator; - n.setAttribute('value', chkValue); - n.setAttribute('indexes', chkIndex); - //1st option unchecked - if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { - _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; - } - } - - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); - _dom2.default.addClass(li, this.checkListSlcItemCssClass); - } - } else { - //removes values and indexes - if (chkValue !== '') { - var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); - fltValue = fltValue.replace(replaceValue, ''); - n.setAttribute('value', _string2.default.trim(fltValue)); - - var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); - fltIndexes = fltIndexes.replace(replaceIndex, ''); - n.setAttribute('indexes', fltIndexes); - } - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(li, this.checkListSlcItemCssClass); - } - } - } - }]); - - return CheckList; - })(); - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.RowsCounter = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var RowsCounter = exports.RowsCounter = (function (_Feature) { - _inherits(RowsCounter, _Feature); - - /** - * Rows counter - * @param {Object} tf TableFilter instance - */ - - function RowsCounter(tf) { - _classCallCheck(this, RowsCounter); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); - - var f = _this.config; - - //id of custom container element - _this.rowsCounterTgtId = f.rows_counter_target_id || null; - //element containing tot nb rows - _this.rowsCounterDiv = null; - //element containing tot nb rows label - _this.rowsCounterSpan = null; - //defines rows counter text - _this.rowsCounterText = f.rows_counter_text || 'Rows: '; - _this.fromToTextSeparator = f.from_to_text_separator || '-'; - _this.overText = f.over_text || ' / '; - //defines css class rows counter - _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; - //rows counter div - _this.prfxCounter = 'counter_'; - //nb displayed rows label - _this.prfxTotRows = 'totrows_span_'; - //label preceding nb rows label - _this.prfxTotRowsTxt = 'totRowsTextSpan_'; - //callback raised before counter is refreshed - _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; - //callback raised after counter is refreshed - _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; - return _this; - } - - _createClass(RowsCounter, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - //rows counter container - var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); - countDiv.className = this.totRowsCssClass; - //rows counter label - var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); - var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); - countText.appendChild(_dom2.default.text(this.rowsCounterText)); - - // counter is added to defined element - if (!this.rowsCounterTgtId) { - tf.setToolbar(); - } - var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); - - //default container: 'lDiv' - if (!this.rowsCounterTgtId) { - countDiv.appendChild(countText); - countDiv.appendChild(countSpan); - targetEl.appendChild(countDiv); - } else { - //custom container, no need to append statusDiv - targetEl.appendChild(countText); - targetEl.appendChild(countSpan); - } - this.rowsCounterDiv = countDiv; - this.rowsCounterSpan = countSpan; - - // subscribe to after-filtering event - this.emitter.on('after-filtering', function () { - return _this2.refresh(tf.nbVisibleRows); - }); - // subscribe to grouped-by-page event - this.emitter.on('grouped-by-page', function () { - return _this2.refresh(tf.nbVisibleRows); - }); - // subscribe to rows-changed event - this.emitter.on('rows-changed', function () { - return _this2.refresh(); - }); - - this.initialized = true; - this.refresh(); - } - }, { - key: 'refresh', - value: function refresh(p) { - if (!this.initialized || !this.isEnabled()) { - return; - } - - var tf = this.tf; - - if (this.onBeforeRefreshCounter) { - this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); - } - - var totTxt; - if (!tf.paging) { - if (p && p !== '') { - totTxt = p; - } else { - totTxt = tf.nbFilterableRows - tf.nbHiddenRows; - } - } else { - var paging = tf.feature('paging'); - if (paging) { - //paging start row - var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); - var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; - totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; - } - } - - this.rowsCounterSpan.innerHTML = totTxt; - if (this.onAfterRefreshCounter) { - this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - if (!this.rowsCounterTgtId && this.rowsCounterDiv) { - _dom2.default.remove(this.rowsCounterDiv); - } else { - _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; - } - this.rowsCounterSpan = null; - this.rowsCounterDiv = null; - - // unsubscribe to events - this.emitter.off('after-filtering', function () { - return _this3.refresh(tf.nbVisibleRows); - }); - this.emitter.off('grouped-by-page', function () { - return _this3.refresh(tf.nbVisibleRows); - }); - this.emitter.off('rows-changed', function () { - return _this3.refresh(); - }); - - this.initialized = false; - } - }]); - - return RowsCounter; - })(_feature.Feature); - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.StatusBar = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var StatusBar = exports.StatusBar = (function (_Feature) { - _inherits(StatusBar, _Feature); - - /** - * Status bar UI component - * @param {Object} tf TableFilter instance - */ - - function StatusBar(tf) { - _classCallCheck(this, StatusBar); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); - - var f = _this.config; - - //id of custom container element - _this.statusBarTgtId = f.status_bar_target_id || null; - //element containing status bar label - _this.statusBarDiv = null; - //status bar - _this.statusBarSpan = null; - //status bar label - _this.statusBarSpanText = null; - //defines status bar text - _this.statusBarText = f.status_bar_text || ''; - //defines css class status bar - _this.statusBarCssClass = f.status_bar_css_class || 'status'; - //delay for status bar clearing - _this.statusBarCloseDelay = 250; - - //calls function before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //calls function after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - - // status bar div - _this.prfxStatus = 'status_'; - // status bar label - _this.prfxStatusSpan = 'statusSpan_'; - // text preceding status bar label - _this.prfxStatusTxt = 'statusText_'; - return _this; - } - - _createClass(StatusBar, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - var tf = this.tf; - - //status bar container - var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); - statusDiv.className = this.statusBarCssClass; - - //status bar label - var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); - //preceding text - var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); - statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); - - // target element container - if (!this.statusBarTgtId) { - tf.setToolbar(); - } - var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); - - //default container: 'lDiv' - if (!this.statusBarTgtId) { - statusDiv.appendChild(statusSpanText); - statusDiv.appendChild(statusSpan); - targetEl.appendChild(statusDiv); - } else { - // custom container, no need to append statusDiv - targetEl.appendChild(statusSpanText); - targetEl.appendChild(statusSpan); - } - - this.statusBarDiv = statusDiv; - this.statusBarSpan = statusSpan; - this.statusBarSpanText = statusSpanText; - - this.initialized = true; - } - }, { - key: 'message', - value: function message() { - var _this2 = this; - - var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; - - if (!this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, t); - } - - var d = t === '' ? this.statusBarCloseDelay : 1; - global.setTimeout(function () { - _this2.statusBarSpan.innerHTML = t; - if (_this2.onAfterShowMsg) { - _this2.onAfterShowMsg.call(null, _this2.tf, t); - } - }, d); - } - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - - this.statusBarDiv.innerHTML = ''; - _dom2.default.remove(this.statusBarDiv); - this.statusBarSpan = null; - this.statusBarSpanText = null; - this.statusBarDiv = null; - this.initialized = false; - } - }]); - - return StatusBar; - })(_feature.Feature); - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Paging = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Paging = exports.Paging = (function (_Feature) { - _inherits(Paging, _Feature); - - /** - * Pagination component - * @param {Object} tf TableFilter instance - */ - - function Paging(tf) { - _classCallCheck(this, Paging); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); - - var f = _this.config; - - //css class for paging buttons (previous,next,etc.) - _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; - //stores paging select element - _this.pagingSlc = null; - //results per page select element - _this.resultsPerPageSlc = null; - //id of container element - _this.pagingTgtId = f.paging_target_id || null; - //defines table paging length - _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; - //id of container element - _this.resultsPerPageTgtId = f.results_per_page_target_id || null; - //css class for paging select element - _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; - //css class for paging input element - _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; - //stores results per page text and values - _this.resultsPerPage = f.results_per_page || null; - //enables/disables results per page drop-down - _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); - //defines css class for results per page select - _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; - //css class for label preceding results per page select - _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; - //1st row index of current page - _this.startPagingRow = 0; - //total nb of pages - _this.nbPages = 0; - //current page nb - _this.currentPageNb = 1; - //defines next page button text - _this.btnNextPageText = f.btn_next_page_text || '>'; - //defines previous page button text - _this.btnPrevPageText = f.btn_prev_page_text || '<'; - //defines last page button text - _this.btnLastPageText = f.btn_last_page_text || '>|'; - //defines first page button text - _this.btnFirstPageText = f.btn_first_page_text || '|<'; - //defines next page button html - _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); - //defines last page button html - _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); - //defines text preceeding page selector drop-down - _this.pageText = f.page_text || ' Page '; - //defines text after page selector drop-down - _this.ofText = f.of_text || ' of '; - //css class for span containing tot nb of pages - _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; - //enables/disables paging buttons - _this.hasPagingBtns = f.paging_btns === false ? false : true; - //defines previous page button html - _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; - //calls function before page is changed - _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; - //calls function before page is changed - _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; - - //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_'; - - var start_row = _this.refRow; - var nrows = _this.nbRows; - //calculates page nb - _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); - - //Paging elements events - var o = _this; - // Paging DOM events - _this.evt = { - slcIndex: function slcIndex() { - return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; - }, - nbOpts: function nbOpts() { - return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; - }, - next: function next() { - var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; - o.changePage(nextIndex); - }, - prev: function prev() { - var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); - o.changePage(prevIndex); - }, - last: function last() { - o.changePage(o.evt.nbOpts()); - }, - first: function first() { - o.changePage(0); - }, - _detectKey: function _detectKey(e) { - var key = _event2.default.keyCode(e); - if (key === 13) { - if (tf.sorted) { - tf.filter(); - o.changePage(o.evt.slcIndex()); - } else { - o.changePage(); - } - this.blur(); - } - }, - - slcPagesChange: null, - nextEvt: null, - prevEvt: null, - lastEvt: null, - firstEvt: null - }; - return _this; - } - - /** - * Initialize DOM elements - */ - - _createClass(Paging, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var slcPages; - var tf = this.tf; - var evt = this.evt; - - if (this.initialized) { - return; - } - - // Check resultsPerPage is in expected format and initialise the - // results per page component - if (this.hasResultsPerPage) { - if (this.resultsPerPage.length < 2) { - this.hasResultsPerPage = false; - } else { - this.pagingLength = this.resultsPerPage[1][0]; - this.setResultsPerPage(); - } - } - - evt.slcPagesChange = function (event) { - var slc = event.target; - _this2.changePage(slc.selectedIndex); - }; - - // Paging drop-down list selector - if (this.pageSelectorType === tf.fltTypeSlc) { - slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); - slcPages.className = this.pgSlcCssClass; - _event2.default.add(slcPages, 'change', evt.slcPagesChange); - } - - // Paging input selector - if (this.pageSelectorType === tf.fltTypeInp) { - slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); - slcPages.className = this.pgInpCssClass; - _event2.default.add(slcPages, 'keypress', evt._detectKey); - } - - // btns containers - var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); - var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); - var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); - var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); - - if (this.hasPagingBtns) { - // Next button - if (!this.btnNextPageHtml) { - var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); - btn_next.className = this.btnPageCssClass; - _event2.default.add(btn_next, 'click', evt.next); - btnNextSpan.appendChild(btn_next); - } else { - btnNextSpan.innerHTML = this.btnNextPageHtml; - _event2.default.add(btnNextSpan, 'click', evt.next); - } - // Previous button - if (!this.btnPrevPageHtml) { - var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); - btn_prev.className = this.btnPageCssClass; - _event2.default.add(btn_prev, 'click', evt.prev); - btnPrevSpan.appendChild(btn_prev); - } else { - btnPrevSpan.innerHTML = this.btnPrevPageHtml; - _event2.default.add(btnPrevSpan, 'click', evt.prev); - } - // Last button - if (!this.btnLastPageHtml) { - var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); - btn_last.className = this.btnPageCssClass; - _event2.default.add(btn_last, 'click', evt.last); - btnLastSpan.appendChild(btn_last); - } else { - btnLastSpan.innerHTML = this.btnLastPageHtml; - _event2.default.add(btnLastSpan, 'click', evt.last); - } - // First button - if (!this.btnFirstPageHtml) { - var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); - btn_first.className = this.btnPageCssClass; - _event2.default.add(btn_first, 'click', evt.first); - btnFirstSpan.appendChild(btn_first); - } else { - btnFirstSpan.innerHTML = this.btnFirstPageHtml; - _event2.default.add(btnFirstSpan, 'click', evt.first); - } - } - - // paging elements (buttons+drop-down list) are added to defined element - if (!this.pagingTgtId) { - tf.setToolbar(); - } - var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - targetEl.appendChild(btnFirstSpan); - targetEl.appendChild(btnPrevSpan); - - var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); - pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); - pgBeforeSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgBeforeSpan); - targetEl.appendChild(slcPages); - var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); - pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); - pgAfterSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgAfterSpan); - var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); - pgspan.className = this.nbPgSpanCssClass; - pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); - targetEl.appendChild(pgspan); - targetEl.appendChild(btnNextSpan); - targetEl.appendChild(btnLastSpan); - this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); - - if (!tf.rememberGridValues) { - this.setPagingInfo(); - } - if (!tf.fltGrid) { - tf.validateAllRows(); - this.setPagingInfo(tf.validRowsIndex); - } - - this.emitter.on('after-filtering', function () { - return _this2.resetPagingInfo(); - }); - - this.initialized = true; - } - - /** - * Reset paging when filters are already instantiated - * @param {Boolean} filterTable Execute filtering once paging instanciated - */ - - }, { - key: 'reset', - value: function reset() { - var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var tf = this.tf; - if (!tf.hasGrid() || this.isEnabled()) { - return; - } - this.enable(); - this.init(); - tf.resetValues(); - if (filterTable) { - tf.filter(); - } - } - - /** - * Reset paging info from scratch after a filtering process - */ - - }, { - key: 'resetPagingInfo', - value: function resetPagingInfo() { - this.startPagingRow = 0; - this.currentPageNb = 1; - this.setPagingInfo(this.tf.validRowsIndex); - } - - /** - * Calculate number of pages based on valid rows - * Refresh paging select according to number of pages - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'setPagingInfo', - value: function setPagingInfo() { - var validRows = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0]; - - var tf = this.tf; - var rows = tf.tbl.rows; - var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - //store valid rows indexes - tf.validRowsIndex = validRows; - - if (validRows.length === 0) { - //counts rows to be grouped - for (var j = tf.refRow; j < tf.nbRows; j++) { - var row = rows[j]; - if (!row) { - continue; - } - - var isRowValid = row.getAttribute('validRow'); - if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { - tf.validRowsIndex.push(j); - } - } - } - - //calculate nb of pages - this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); - //refresh page nb span - pgspan.innerHTML = this.nbPages; - //select clearing shortcut - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.innerHTML = ''; - } - - if (this.nbPages > 0) { - mdiv.style.visibility = 'visible'; - if (this.pageSelectorType === tf.fltTypeSlc) { - for (var z = 0; z < this.nbPages; z++) { - var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); - this.pagingSlc.options[z] = opt; - } - } else { - //input type - this.pagingSlc.value = this.currentPageNb; - } - } else { - /*** if no results paging select and buttons are hidden ***/ - mdiv.style.visibility = 'hidden'; - } - this.groupByPage(tf.validRowsIndex); - } - - /** - * Group table rows by page and display valid rows - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'groupByPage', - value: function groupByPage(validRows) { - var tf = this.tf; - var alternateRows = tf.feature('alternateRows'); - var rows = tf.tbl.rows; - var startPagingRow = parseInt(this.startPagingRow, 10); - var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); - - //store valid rows indexes - if (validRows) { - tf.validRowsIndex = validRows; - } - - //this loop shows valid rows of current page - for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { - var validRowIdx = tf.validRowsIndex[h]; - var r = rows[validRowIdx]; - var isRowValid = r.getAttribute('validRow'); - - if (h >= startPagingRow && h < endPagingRow) { - if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { - r.style.display = ''; - } - if (tf.alternateRows && alternateRows) { - alternateRows.setRowBg(validRowIdx, h); - } - } else { - r.style.display = 'none'; - if (tf.alternateRows && alternateRows) { - alternateRows.removeRowBg(validRowIdx); - } - } - } - - tf.nbVisibleRows = tf.validRowsIndex.length; - - // broadcast grouping by page - this.emitter.emit('grouped-by-page', tf, this); - } - - /** - * Return the current page number - * @return {Number} Page number - */ - - }, { - key: 'getPage', - value: function getPage() { - return this.currentPageNb; - } - - /** - * Show page based on passed param value (string or number): - * @param {String} or {Number} cmd possible string values: 'next', - * 'previous', 'last', 'first' or page number as per param - */ - - }, { - key: 'setPage', - value: function setPage(cmd) { - var tf = this.tf; - if (!tf.hasGrid() || !this.isEnabled()) { - return; - } - var btnEvt = this.evt, - cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); - if (cmdtype === 'string') { - switch (_string2.default.lower(cmd)) { - case 'next': - btnEvt.next(); - break; - case 'previous': - btnEvt.prev(); - break; - case 'last': - btnEvt.last(); - break; - case 'first': - btnEvt.first(); - break; - default: - btnEvt.next(); - break; - } - } else if (cmdtype === 'number') { - this.changePage(cmd - 1); - } - } - - /** - * Generates UI elements for the number of results per page drop-down - */ - - }, { - key: 'setResultsPerPage', - value: function setResultsPerPage() { - var _this3 = this; - - var tf = this.tf; - var evt = this.evt; - - if (!tf.hasGrid() && !tf.isFirstLoad) { - return; - } - if (this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - - evt.slcResultsChange = function (ev) { - _this3.changeResultsPerPage(); - ev.target.blur(); - }; - - var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); - slcR.className = this.resultsSlcCssClass; - var slcRText = this.resultsPerPage[0], - slcROpts = this.resultsPerPage[1]; - var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); - slcRSpan.className = this.resultsSpanCssClass; - - // results per page select is added to external element - if (!this.resultsPerPageTgtId) { - tf.setToolbar(); - } - var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); - slcRSpan.appendChild(_dom2.default.text(slcRText)); - - var help = tf.feature('help'); - if (help && help.btn) { - help.btn.parentNode.insertBefore(slcRSpan, help.btn); - help.btn.parentNode.insertBefore(slcR, help.btn); - } else { - targetEl.appendChild(slcRSpan); - targetEl.appendChild(slcR); - } - - for (var r = 0; r < slcROpts.length; r++) { - var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); - slcR.options[r] = currOpt; - } - _event2.default.add(slcR, 'change', evt.slcResultsChange); - this.resultsPerPageSlc = slcR; - } - - /** - * Remove number of results per page UI elements - */ - - }, { - key: 'removeResultsPerPage', - value: function removeResultsPerPage() { - var tf = this.tf; - if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - var slcR = this.resultsPerPageSlc, - slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); - if (slcR) { - _dom2.default.remove(slcR); - } - if (slcRSpan) { - _dom2.default.remove(slcRSpan); - } - this.resultsPerPageSlc = null; - } - - /** - * Change the page asynchronously according to passed index - * @param {Number} index Index of the page (0-n) - */ - - }, { - key: 'changePage', - value: function changePage(index) { - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.changepage, { pgIndex: index }); - } - - /** - * Change rows asynchronously according to page results - */ - - }, { - key: 'changeResultsPerPage', - value: function changeResultsPerPage() { - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.changeresultsperpage); - } - - /** - * Re-set asynchronously page nb at page re-load - */ - - }, { - key: 'resetPage', - value: function resetPage() { - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.resetpage); - } - - /** - * Re-set asynchronously page length at page re-load - */ - - }, { - key: 'resetPageLength', - value: function resetPageLength() { - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.resetpagelength); - } - - /** - * Change the page according to passed index - * @param {Number} index Index of the page (0-n) - */ - - }, { - key: '_changePage', - value: function _changePage(index) { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - if (index === null) { - index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; - } - if (index >= 0 && index <= this.nbPages - 1) { - if (this.onBeforeChangePage) { - this.onBeforeChangePage.call(null, this, index); - } - this.currentPageNb = parseInt(index, 10) + 1; - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.options[index].selected = true; - } else { - this.pagingSlc.value = this.currentPageNb; - } - - if (tf.rememberPageNb) { - tf.feature('store').savePageNb(tf.pgNbCookie); - } - this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; - - this.groupByPage(); - - if (this.onAfterChangePage) { - this.onAfterChangePage.call(null, this, index); - } - } - } - - /** - * Change rows according to page results drop-down - * TODO: accept a parameter setting the results per page length - */ - - }, { - key: '_changeResultsPerPage', - value: function _changeResultsPerPage() { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - var slcR = this.resultsPerPageSlc; - var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); - this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); - this.startPagingRow = this.pagingLength * slcPagesSelIndex; - - if (!isNaN(this.pagingLength)) { - if (this.startPagingRow >= tf.nbFilterableRows) { - this.startPagingRow = tf.nbFilterableRows - this.pagingLength; - } - this.setPagingInfo(); - - if (this.pageSelectorType === tf.fltTypeSlc) { - var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; - this.pagingSlc.options[slcIndex].selected = true; - } - if (tf.rememberPageLen) { - tf.feature('store').savePageLength(tf.pgLenCookie); - } - } - } - - /** - * Re-set page nb at page re-load - */ - - }, { - key: '_resetPage', - value: function _resetPage(name) { - var tf = this.tf; - var pgnb = tf.feature('store').getPageNb(name); - if (pgnb !== '') { - this.changePage(pgnb - 1); - } - } - - /** - * Re-set page length value at page re-load - */ - - }, { - key: '_resetPageLength', - value: function _resetPageLength(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - var pglenIndex = tf.feature('store').getPageLength(name); - - if (pglenIndex !== '') { - this.resultsPerPageSlc.options[pglenIndex].selected = true; - this.changeResultsPerPage(); - } - } - - /** - * Remove paging feature - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - var tf = this.tf; - - if (!this.initialized) { - return; - } - // btns containers - var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); - var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); - var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); - var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); - //span containing 'Page' text - var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); - //span containing 'of' text - var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); - //span containing nb of pages - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - var evt = this.evt; - - if (this.pagingSlc) { - if (this.pageSelectorType === tf.fltTypeSlc) { - _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); - } else if (this.pageSelectorType === tf.fltTypeInp) { - _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); - } - _dom2.default.remove(this.pagingSlc); - } - - if (btnNextSpan) { - _event2.default.remove(btnNextSpan, 'click', evt.next); - _dom2.default.remove(btnNextSpan); - } - - if (btnPrevSpan) { - _event2.default.remove(btnPrevSpan, 'click', evt.prev); - _dom2.default.remove(btnPrevSpan); - } - - if (btnLastSpan) { - _event2.default.remove(btnLastSpan, 'click', evt.last); - _dom2.default.remove(btnLastSpan); - } - - if (btnFirstSpan) { - _event2.default.remove(btnFirstSpan, 'click', evt.first); - _dom2.default.remove(btnFirstSpan); - } - - if (pgBeforeSpan) { - _dom2.default.remove(pgBeforeSpan); - } - - if (pgAfterSpan) { - _dom2.default.remove(pgAfterSpan); - } - - if (pgspan) { - _dom2.default.remove(pgspan); - } - - if (this.hasResultsPerPage) { - this.removeResultsPerPage(); - } - - this.emitter.off('after-filtering', function () { - return _this4.resetPagingInfo(); - }); - - this.pagingSlc = null; - this.nbPages = 0; - this.disable(); - this.initialized = false; - } - }]); - - return Paging; - })(_feature.Feature); - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.ClearButton = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var ClearButton = exports.ClearButton = (function (_Feature) { - _inherits(ClearButton, _Feature); - - /** - * Clear button component - * @param {Object} tf TableFilter instance - */ - - function ClearButton(tf) { - _classCallCheck(this, ClearButton); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); - - var f = _this.config; - - //id of container element - _this.btnResetTgtId = f.btn_reset_target_id || null; - //reset button element - _this.btnResetEl = null; - //defines reset text - _this.btnResetText = f.btn_reset_text || 'Reset'; - //defines reset button tooltip - _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; - //defines reset button innerHtml - _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); - //span containing reset button - _this.prfxResetSpan = 'resetspan_'; - return _this; - } - - _createClass(ClearButton, [{ - key: 'onClick', - value: function onClick() { - if (!this.isEnabled()) { - return; - } - this.tf.clearFilters(); - } - - /** - * Build DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - - if (this.initialized) { - return; - } - - var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); - - // reset button is added to defined element - if (!this.btnResetTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); - targetEl.appendChild(resetspan); - - if (!this.btnResetHtml) { - var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); - fltreset.className = tf.btnResetCssClass; - fltreset.appendChild(_dom2.default.text(this.btnResetText)); - resetspan.appendChild(fltreset); - _event2.default.add(fltreset, 'click', function () { - _this2.onClick(); - }); - } else { - resetspan.innerHTML = this.btnResetHtml; - var resetEl = resetspan.firstChild; - _event2.default.add(resetEl, 'click', function () { - _this2.onClick(); - }); - } - this.btnResetEl = resetspan.firstChild; - - this.initialized = true; - } - - /** - * Remove clear button UI - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - - if (!this.initialized) { - return; - } - - var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); - if (resetspan) { - _dom2.default.remove(resetspan); - } - this.btnResetEl = null; - this.initialized = false; - } - }]); - - return ClearButton; - })(_feature.Feature); - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Help = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; - var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; - - var Help = exports.Help = (function (_Feature) { - _inherits(Help, _Feature); - - /** - * Help UI component - * @param {Object} tf TableFilter instance - */ - - function Help(tf) { - _classCallCheck(this, Help); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); - - var f = _this.config; - - //id of custom container element for instructions - _this.tgtId = f.help_instructions_target_id || null; - //id of custom container element for instructions - _this.contTgtId = f.help_instructions_container_target_id || null; - //defines help text - _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; - //defines help innerHtml - _this.instrHtml = f.help_instructions_html || null; - //defines reset button text - _this.btnText = f.help_instructions_btn_text || '?'; - //defines reset button innerHtml - _this.btnHtml = f.help_instructions_btn_html || null; - //defines css class for help button - _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; - //defines css class for help container - _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; - //help button element - _this.btn = null; - //help content div - _this.cont = null; - _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; - - //id prefix for help elements - _this.prfxHelpSpan = 'helpSpan_'; - //id prefix for help elements - _this.prfxHelpDiv = 'helpDiv_'; - return _this; - } - - _createClass(Help, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); - var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); - - //help button is added to defined element - if (!this.tgtId) { - tf.setToolbar(); - } - var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); - targetEl.appendChild(helpspan); - - var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); - - if (!this.btnHtml) { - divContainer.appendChild(helpdiv); - var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); - helplink.className = this.btnCssClass; - helplink.appendChild(_dom2.default.text(this.btnText)); - helpspan.appendChild(helplink); - _event2.default.add(helplink, 'click', function () { - _this2.toggle(); - }); - } else { - helpspan.innerHTML = this.btnHtml; - var helpEl = helpspan.firstChild; - _event2.default.add(helpEl, 'click', function () { - _this2.toggle(); - }); - divContainer.appendChild(helpdiv); - } - - if (!this.instrHtml) { - helpdiv.innerHTML = this.instrText; - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } else { - if (this.contTgtId) { - divContainer.appendChild(helpdiv); - } - helpdiv.innerHTML = this.instrHtml; - if (!this.contTgtId) { - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } - } - helpdiv.innerHTML += this.defaultHtml; - _event2.default.add(helpdiv, 'click', function () { - _this2.toggle(); - }); - - this.cont = helpdiv; - this.btn = helpspan; - this.initialized = true; - } - - /** - * Toggle help pop-up - */ - - }, { - key: 'toggle', - value: function toggle() { - // check only if explicitily set to false as in this case undefined - // signifies the help feature is enabled by default - if (this.enabled === false) { - return; - } - var divDisplay = this.cont.style.display; - if (divDisplay === '' || divDisplay === 'none') { - this.cont.style.display = 'inline'; - } else { - this.cont.style.display = 'none'; - } - } - - /** - * Remove help UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - _dom2.default.remove(this.btn); - this.btn = null; - if (!this.cont) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - this.initialized = false; - } - }]); - - return Help; - })(_feature.Feature); - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AlternateRows = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var AlternateRows = exports.AlternateRows = (function (_Feature) { - _inherits(AlternateRows, _Feature); - - /** - * Alternating rows color - * @param {Object} tf TableFilter instance - */ - - function AlternateRows(tf) { - _classCallCheck(this, AlternateRows); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); - - var config = _this.config; - //defines css class for even rows - _this.evenCss = config.even_row_css_class || 'even'; - //defines css class for odd rows - _this.oddCss = config.odd_row_css_class || 'odd'; - return _this; - } - - /** - * Sets alternating rows color - */ - - _createClass(AlternateRows, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - var tf = this.tf; - var validRowsIndex = tf.validRowsIndex; - var noValidRowsIndex = validRowsIndex === null; - //1st index - var beginIndex = noValidRowsIndex ? tf.refRow : 0; - // nb indexes - var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; - var idx = 0; - - //alternates bg color - for (var j = beginIndex; j < indexLen; j++) { - var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; - this.setRowBg(rowIdx, idx); - idx++; - } - this.initialized = true; - } - - /** - * Sets row background color - * @param {Number} rowIdx Row index - * @param {Number} idx Valid rows collection index needed to calculate bg - * color - */ - - }, { - key: 'setRowBg', - value: function setRowBg(rowIdx, idx) { - if (!this.isEnabled() || isNaN(rowIdx)) { - return; - } - var rows = this.tf.tbl.rows; - var i = isNaN(idx) ? rowIdx : idx; - this.removeRowBg(rowIdx); - - _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); - } - - /** - * Removes row background color - * @param {Number} idx Row index - */ - - }, { - key: 'removeRowBg', - value: function removeRowBg(idx) { - if (isNaN(idx)) { - return; - } - var rows = this.tf.tbl.rows; - _dom2.default.removeClass(rows[idx], this.oddCss); - _dom2.default.removeClass(rows[idx], this.evenCss); - } - - /** - * Removes all alternating backgrounds - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { - this.removeRowBg(i); - } - this.initialized = false; - } - }]); - - return AlternateRows; - })(_feature.Feature); - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.NoResults = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var NoResults = exports.NoResults = (function (_Feature) { - _inherits(NoResults, _Feature); - - /** - * No results message UI component - * @param {Object} tf TableFilter instance - */ - - function NoResults(tf) { - _classCallCheck(this, NoResults); - - //configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); - - var f = _this.config.no_results_message; - - _this.content = f.content || 'No results'; - _this.customContainer = f.custom_container || null; - _this.customContainerId = f.custom_container_id || null; - _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); - _this.cssClass = f.css_class || 'no-results'; - - _this.cont = null; - - //callback before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //callback after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - //callback before message is hidden - _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; - //callback after message is hidden - _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; - - _this.prfxNoResults = 'nores_'; - return _this; - } - - _createClass(NoResults, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - var tf = this.tf; - var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; - - //container - var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); - cont.className = this.cssClass; - cont.innerHTML = this.content; - - if (this.isExternal) { - target.appendChild(cont); - } else { - target.parentNode.insertBefore(cont, target.nextSibling); - } - - this.cont = cont; - - // subscribe to after-filtering event - this.emitter.on('after-filtering', function () { - return _this2.toggle(); - }); - - this.initialized = true; - this.hide(); - } - }, { - key: 'toggle', - value: function toggle() { - if (this.tf.nbVisibleRows > 0) { - this.hide(); - } else { - this.show(); - } - } - }, { - key: 'show', - value: function show() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, this); - } - - this.setWidth(); - this.cont.style.display = 'block'; - - if (this.onAfterShowMsg) { - this.onAfterShowMsg.call(null, this.tf, this); - } - } - }, { - key: 'hide', - value: function hide() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - - this.cont.style.display = 'none'; - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - } - }, { - key: 'setWidth', - value: function setWidth() { - if (!this.initialized || this.isExternal || !this.isEnabled()) { - return; - } - if (this.tf.gridLayout) { - var gridLayout = this.tf.feature('gridLayout'); - this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; - } else { - this.cont.style.width = this.tf.tbl.clientWidth + 'px'; - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - // unsubscribe to after-filtering event - this.emitter.off('after-filtering', function () { - return _this3.toggle(); - }); - this.initialized = false; - } - }]); - - return NoResults; - })(_feature.Feature); - -/***/ } -/******/ ]) -}); -; -//# sourceMappingURL=tablefilter.js.map \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var a=s[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var n,r,o=0,h=[];on;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.1",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":a(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),a=s._ezEditTable;s.cfg.editable&&a.Editable.Remove(),s.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,a,l);break;case e.checklist:r.checkList._build(s,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,a=i.slcExternal,l=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,a=t.path,l=void 0;s&&a?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var a=[i(26)("./"+l)];(function(i){var a=new i["default"](e,t);a.init(),e.ExtRegistry[s]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],a=this.ExtRegistry[s.name];a&&(a.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var a=t[i],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],a=u["default"].id(s);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],a=[],l=i.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(a.sort(),s.sort()),[a,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(i)),""!==a&&s.highlightKeyword.highlight(i,a,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=a(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)s=l<=a(t.replace(r,""),n);else if(T)s=l>=a(t.replace(o,""),n);else if(u)s=la(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,a=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.popupFilters&&s.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&F&&(P=!0),P?(this.validateRow(x,!0),this.validRowsIndex.push(x),this.alternateRows&&s.alternateRows.setRowBg(x,this.validRowsIndex.length),this.onRowValidated&&this.onRowValidated.call(null,this,x)):(this.validateRow(x,!1),s.alternateRows&&s.alternateRows.removeRowBg(x),this.hasVisibleRows&&-1!==this.visibleRows.indexOf(x)?this.validRowsIndex.push(x):a++)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]); +for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var a=0,l=i.options.length;l>a;a++)i.options[a].selected&&(e=e.concat(i.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,a=this.fltIds.length;a>s;s++){var l=this.getFilterType(s);if(l===f["default"].lower(t)){var n=e?s:this.fltIds[s];i.push(n)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sn;n++){var o=this.getCellData(l[n]);a[1].push(o)}i.push(a)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),a=0;aa;a++){var n=i[a],r=n[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",a=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",a)}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),a=s.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=s[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=i[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("cleared-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=s.length;r>n;n++){var o=u["default"].id(this.fltIds[s[n]]);if(l=this.getFilterValue(s[n]),a!==s[n]||this.paging&&-1!=t.indexOf(s[n])&&a===s[n]||!this.paging&&(-1!=i.indexOf(s[n])||-1!=e.indexOf(s[n]))||l===this.displayAllText){if(-1!=i.indexOf(s[n])?this.Mod.checkList.checkListDiv[s[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[n])?this.Mod.checkList._build(s[n]):this.Mod.dropdown._build(s[n],!0),this.setFilterValue(s[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,a=i[s];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",a="script"==s?"src":"href",l=u["default"].tag(H,s),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var a=s?s:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var a=0;a0){var s=document.cookie,a=s.indexOf(i);if(-1!==a){a+=i.length;var l=s.indexOf(";",a);-1===l&&(l=s.length),e=unescape(s.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,a=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0])}return a}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,a=parseInt(s.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,i,s,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var i=0;i_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,a=this.addTChecks(t,e),l=[],n=s.feature("store"),o=n?n.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),l=a+s.pagingLength-1<=e.nbVisibleRows?a+s.pagingLength-1:e.nbVisibleRows;i=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var a=i.refRow,r=i.nbRows;i.nbPages=Math.ceil((r-a)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo", +value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,i=e.tbl.rows,s=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(s.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=s[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&i&&i.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&i&&i.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":a(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),a=d["default"].id(this.prfxBtnLastSpan+e.id),l=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),a&&(b["default"].remove(a,"click",h.last),d["default"].remove(a)),l&&(b["default"].remove(l,"click",h.first),d["default"].remove(l)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var a=i.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;in;n++){var r=i?n:e[n];this.setRowBg(r,l),l++}this.initialized=!0}}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){if(this.initialized){for(var t=this.tf.refRow;t0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 58cc1966..6bc37a2f 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,2218 +1,8 @@ -webpackJsonp([1],{ +/** + * tablefilter v0.1.1 by Max Guglielmi + * build date: 2015-12-30T05:48:52.421Z + * MIT License + */ -/***/ 26: -/***/ function(module, exports, __webpack_require__) { - - var map = { - "./array": 6, - "./array.js": 6, - "./cookie": 4, - "./cookie.js": 4, - "./date": 7, - "./date.js": 7, - "./dom": 2, - "./dom.js": 2, - "./emitter": 9, - "./emitter.js": 9, - "./event": 1, - "./event.js": 1, - "./extensions/advancedGrid/adapterEzEditTable": 27, - "./extensions/advancedGrid/adapterEzEditTable.js": 27, - "./extensions/advancedGrid/advancedGrid": 28, - "./extensions/advancedGrid/advancedGrid.js": 28, - "./extensions/colOps/colOps": 29, - "./extensions/colOps/colOps.js": 29, - "./extensions/colsVisibility/colsVisibility": 30, - "./extensions/colsVisibility/colsVisibility.js": 30, - "./extensions/filtersVisibility/filtersVisibility": 31, - "./extensions/filtersVisibility/filtersVisibility.js": 31, - "./extensions/sort/adapterSortabletable": 32, - "./extensions/sort/adapterSortabletable.js": 32, - "./extensions/sort/sort": 33, - "./extensions/sort/sort.js": 33, - "./helpers": 8, - "./helpers.js": 8, - "./modules/alternateRows": 24, - "./modules/alternateRows.js": 24, - "./modules/checkList": 18, - "./modules/checkList.js": 18, - "./modules/clearButton": 22, - "./modules/clearButton.js": 22, - "./modules/dropdown": 16, - "./modules/dropdown.js": 16, - "./modules/feature": 12, - "./modules/feature.js": 12, - "./modules/gridLayout": 11, - "./modules/gridLayout.js": 11, - "./modules/help": 23, - "./modules/help.js": 23, - "./modules/highlightKeywords": 14, - "./modules/highlightKeywords.js": 14, - "./modules/loader": 13, - "./modules/loader.js": 13, - "./modules/noResults": 25, - "./modules/noResults.js": 25, - "./modules/paging": 21, - "./modules/paging.js": 21, - "./modules/popupFilter": 15, - "./modules/popupFilter.js": 15, - "./modules/rowsCounter": 19, - "./modules/rowsCounter.js": 19, - "./modules/statusBar": 20, - "./modules/statusBar.js": 20, - "./modules/store": 10, - "./modules/store.js": 10, - "./sort": 17, - "./sort.js": 17, - "./string": 3, - "./string.js": 3, - "./types": 5, - "./types.js": 5 - }; - function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); - }; - function webpackContextResolve(req) { - return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); - }; - webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); - }; - webpackContext.resolve = webpackContextResolve; - module.exports = webpackContext; - webpackContext.id = 26; - - -/***/ }, - -/***/ 27: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterEzEditTable = (function () { - /** - * Adapter module for ezEditTable, an external library providing advanced - * grid features (selection and edition): - * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus - * - * @param {Object} tf TableFilter instance - */ - - function AdapterEzEditTable(tf, cfg) { - _classCallCheck(this, AdapterEzEditTable); - - // ezEditTable config - this.initialized = false; - this.desc = cfg.description || 'ezEditTable adapter'; - this.filename = cfg.filename || 'ezEditTable.js'; - this.vendorPath = cfg.vendor_path; - this.loadStylesheet = Boolean(cfg.load_stylesheet); - this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; - this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; - this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; - // Enable the ezEditTable's scroll into view behaviour if grid layout on - cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; - - this._ezEditTable = null; - this.cfg = cfg; - this.tf = tf; - } - - /** - * Conditionally load ezEditTable library and set advanced grid - * @return {[type]} [description] - */ - - _createClass(AdapterEzEditTable, [{ - key: 'init', - value: function init() { - var _this = this; - - var tf = this.tf; - if (window.EditTable) { - this._setAdvancedGrid(); - } else { - var path = this.vendorPath + this.filename; - tf.import(this.filename, path, function () { - _this._setAdvancedGrid(); - }); - } - if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { - tf.import(this.stylesheetName, this.stylesheet, null, 'link'); - } - } - - /** - * Instantiate ezEditTable component for advanced grid features - */ - - }, { - key: '_setAdvancedGrid', - value: function _setAdvancedGrid() { - var tf = this.tf; - - //start row for EditTable constructor needs to be calculated - var startRow, - cfg = this.cfg, - thead = _dom2.default.tag(tf.tbl, 'thead'); - - //if thead exists and startRow not specified, startRow is calculated - //automatically by EditTable - if (thead.length > 0 && !cfg.startRow) { - startRow = undefined; - } - //otherwise startRow config property if any or TableFilter refRow - else { - startRow = cfg.startRow || tf.refRow; - } - - cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; - var editable = cfg.editable; - var selectable = cfg.selection; - - if (selectable) { - cfg.default_selection = cfg.default_selection || 'row'; - } - //CSS Styles - cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; - - var _lastValidRowIndex = 0; - var _lastRowIndex = 0; - - if (selectable) { - //Row navigation needs to be calculated according to TableFilter's - //validRowsIndex array - var onAfterSelection = function onAfterSelection(et, selectedElm, e) { - var slc = et.Selection; - //Next valid filtered row needs to be selected - var doSelect = function doSelect(nextRowIndex) { - if (et.defaultSelection === 'row') { - slc.SelectRowByIndex(nextRowIndex); - } else { - et.ClearSelections(); - var cellIndex = selectedElm.cellIndex, - row = tf.tbl.rows[nextRowIndex]; - if (et.defaultSelection === 'both') { - slc.SelectRowByIndex(nextRowIndex); - } - if (row) { - slc.SelectCell(row.cells[cellIndex]); - } - } - //Table is filtered - if (tf.validRowsIndex.length !== tf.getRowsNb()) { - var r = tf.tbl.rows[nextRowIndex]; - if (r) { - r.scrollIntoView(false); - } - if (cell) { - if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { - tf.tblCont.scrollLeft = 100000000; - } else if (cell.cellIndex === 0 && tf.gridLayout) { - tf.tblCont.scrollLeft = 0; - } else { - cell.scrollIntoView(false); - } - } - } - }; - - //table is not filtered - if (!tf.validRowsIndex) { - return; - } - var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, - nextRowIndex, - paging = tf.feature('paging'), - - //pgup/pgdown keys - d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { - //last row - if (row.rowIndex >= validIndexes[validIdxLen - 1]) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - var calcRowIndex = _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[_lastValidRowIndex - d]; - nextRowIndex = v ? v : validIndexes[0]; - } - } - _lastRowIndex = row.rowIndex; - doSelect(nextRowIndex); - } else { - //If filtered row is valid, special calculation for - //pgup/pgdown keys - if (keyCode !== 34 && keyCode !== 33) { - _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); - _lastRowIndex = row.rowIndex; - } else { - if (keyCode === 34) { - //pgdown - //last row - if (_lastValidRowIndex + d <= validIdxLen - 1) { - nextRowIndex = validIndexes[_lastValidRowIndex + d]; - } else { - nextRowIndex = [validIdxLen - 1]; - } - } else { - //pgup - //first row - if (_lastValidRowIndex - d <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - nextRowIndex = validIndexes[_lastValidRowIndex - d]; - } - } - _lastRowIndex = nextRowIndex; - _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); - doSelect(nextRowIndex); - } - } - }; - - //Page navigation has to be enforced whenever selected row is out of - //the current page range - var onBeforeSelection = function onBeforeSelection(et, selectedElm) { - var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; - if (tf.paging) { - if (tf.feature('paging').nbPages > 1) { - var paging = tf.feature('paging'); - //page length is re-assigned in case it has changed - et.nbRowsPerPage = paging.pagingLength; - var validIndexes = tf.validRowsIndex, - validIdxLen = validIndexes.length, - pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); - var rowIndex = row.rowIndex; - - if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { - paging.setPage('last'); - } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { - paging.setPage('first'); - } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { - paging.setPage('next'); - } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { - paging.setPage('previous'); - } - } - } - }; - - //Selected row needs to be visible when paging is activated - if (tf.paging) { - tf.feature('paging').onAfterChangePage = function (paging) { - var advGrid = paging.tf.extension('advancedGrid'); - var et = advGrid._ezEditTable; - var slc = et.Selection; - var row = slc.GetActiveRow(); - if (row) { - row.scrollIntoView(false); - } - var cell = slc.GetActiveCell(); - if (cell) { - cell.scrollIntoView(false); - } - }; - } - - //Rows navigation when rows are filtered is performed with the - //EditTable row selection callback events - if (cfg.default_selection === 'row') { - var fnB = cfg.on_before_selected_row; - cfg.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 = cfg.on_after_selected_row; - cfg.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 = cfg.on_before_selected_cell; - cfg.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 = cfg.on_after_selected_cell; - cfg.on_after_selected_cell = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnC) { - fnC.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - } - } - if (editable) { - //Added or removed rows, TF rows number needs to be re-calculated - var fnE = cfg.on_added_dom_row; - cfg.on_added_dom_row = function () { - tf.nbFilterableRows++; - if (!tf.paging) { - tf.emitter.emit('rows-changed', tf, this); - //tf.feature('rowsCounter').refresh(); - } else { - tf.nbRows++; - tf.nbVisibleRows++; - tf.nbFilterableRows++; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnE) { - fnE.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - if (cfg.actions && cfg.actions['delete']) { - var fnF = cfg.actions['delete'].on_after_submit; - cfg.actions['delete'].on_after_submit = function () { - tf.nbFilterableRows--; - if (!tf.paging) { - // tf.feature('rowsCounter').refresh(); - tf.emitter.emit('rows-changed', tf, this); - } else { - tf.nbRows--; - tf.nbVisibleRows--; - tf.nbFilterableRows--; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(false); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnF) { - fnF.call(null, arguments[0], arguments[1]); - } - }; - } - } - - try { - this._ezEditTable = new EditTable(tf.id, cfg, startRow); - this._ezEditTable.Init(); - } catch (e) { - throw new Error(this.err); - } - - this.initialized = true; - } - - /** - * Reset advanced grid when previously removed - */ - - }, { - key: 'reset', - value: function reset() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.Set(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Set(); - } - } - } - - /** - * Remove advanced grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.ClearSelections(); - ezEditTable.Selection.Remove(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Remove(); - } - } - this.initialized = false; - } - }]); - - return AdapterEzEditTable; - })(); - - exports.default = AdapterEzEditTable; - -/***/ }, - -/***/ 28: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterEzEditTable = __webpack_require__(27); - - var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _adapterEzEditTable2.default; - -/***/ }, - -/***/ 29: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColOps = (function () { - - /** - * Column calculations - * @param {Object} tf TableFilter instance - */ - - function ColOps(tf, opts) { - _classCallCheck(this, ColOps); - - //calls function before col operation - this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; - //calls function after col operation - this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; - - this.opts = opts; - this.tf = tf; - } - - _createClass(ColOps, [{ - key: 'init', - value: function init() { - var _this = this; - - // subscribe to events - this.tf.emitter.on('after-filtering', function () { - return _this.calc(); - }); - - this.calc(); - } - - /** - * Calculates columns' values - * Configuration options are stored in 'opts' property - * - 'id' contains ids of elements showing result (array) - * - 'col' contains the columns' indexes (array) - * - 'operation' contains operation type (array, values: 'sum', 'mean', - * 'min', 'max', 'median', 'q1', 'q3') - * - 'write_method' array defines which method to use for displaying the - * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' - * - 'tot_row_index' defines in which row results are displayed - * (integers array) - * - * - changes made by Nuovella: - * (1) optimized the routine (now it will only process each column once), - * (2) added calculations for the median, lower and upper quartile. - */ - - }, { - key: 'calc', - value: function calc() { - var tf = this.tf; - if (!tf.isFirstLoad && !tf.hasGrid()) { - return; - } - - if (this.onBeforeOperation) { - this.onBeforeOperation.call(null, tf); - } - - var opts = this.opts, - labelId = opts.id, - colIndex = opts.col, - operation = opts.operation, - outputType = opts.write_method, - totRowIndex = opts.tot_row_index, - excludeRow = opts.exclude_row, - decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; - - //nuovella: determine unique list of columns to operate on - var ucolIndex = [], - ucolMax = 0; - ucolIndex[ucolMax] = colIndex[0]; - - for (var ii = 1; ii < colIndex.length; ii++) { - var saved = 0; - //see if colIndex[ii] is already in the list of unique indexes - for (var jj = 0; jj <= ucolMax; jj++) { - if (ucolIndex[jj] === colIndex[ii]) { - saved = 1; - } - } - //if not saved then, save the index; - if (saved === 0) { - ucolMax++; - ucolIndex[ucolMax] = colIndex[ii]; - } - } - - if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { - var rows = tf.tbl.rows, - colvalues = []; - - for (var ucol = 0; ucol <= ucolMax; ucol++) { - //this retrieves col values - //use ucolIndex because we only want to pass through this loop - //once for each column get the values in this unique column - colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); - - //next: calculate all operations for this column - 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; - - for (var k = 0; k < colIndex.length; k++) { - if (colIndex[k] === ucolIndex[ucol]) { - mThisCol++; - opsThisCol[mThisCol] = _string2.default.lower(operation[k]); - decThisCol[mThisCol] = decimalPrecision[k]; - labThisCol[mThisCol] = labelId[k]; - oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; - - switch (opsThisCol[mThisCol]) { - case 'mean': - meanFlag = 1; - break; - case 'sum': - sumFlag = 1; - break; - case 'min': - minFlag = 1; - break; - case 'max': - maxFlag = 1; - break; - case 'median': - medFlag = 1; - break; - case 'q1': - q1Flag = 1; - break; - case 'q3': - q3Flag = 1; - break; - } - } - } - - for (var j = 0; j < colvalues[ucol].length; j++) { - //sort the list for calculation of median and quartiles - if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { - if (j < colvalues[ucol].length - 1) { - for (k = j + 1; k < colvalues[ucol].length; k++) { - if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { - temp = colvalues[ucol][j]; - colvalues[ucol][j] = colvalues[ucol][k]; - colvalues[ucol][k] = temp; - } - } - } - } - var cvalue = parseFloat(colvalues[ucol][j]); - theList[j] = parseFloat(cvalue); - - if (!isNaN(cvalue)) { - nbvalues++; - if (sumFlag === 1 || meanFlag === 1) { - sumValue += parseFloat(cvalue); - } - if (minFlag === 1) { - if (minValue === null) { - minValue = parseFloat(cvalue); - } else { - minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; - } - } - if (maxFlag === 1) { - if (maxValue === null) { - maxValue = parseFloat(cvalue); - } else { - maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; - } - } - } - } //for j - if (meanFlag === 1) { - meanValue = sumValue / nbvalues; - } - if (medFlag === 1) { - var aux = 0; - if (nbvalues % 2 === 1) { - aux = Math.floor(nbvalues / 2); - medValue = theList[aux]; - } else { - medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; - } - } - var posa; - if (q1Flag === 1) { - posa = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa == nbvalues) { - q1Value = (theList[posa - 1] + theList[posa]) / 2; - } else { - q1Value = theList[posa]; - } - } - if (q3Flag === 1) { - posa = 0.0; - var posb = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa === nbvalues) { - posb = 3 * posa; - q3Value = (theList[posb] + theList[posb - 1]) / 2; - } else { - q3Value = theList[nbvalues - posa - 1]; - } - } - - for (var i = 0; i <= mThisCol; i++) { - switch (opsThisCol[i]) { - case 'mean': - result = meanValue; - break; - case 'sum': - result = sumValue; - break; - case 'min': - result = minValue; - break; - case 'max': - result = maxValue; - break; - case 'median': - result = medValue; - break; - case 'q1': - result = q1Value; - break; - case 'q3': - result = q3Value; - break; - } - - var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; - - //if outputType is defined - if (oTypeThisCol && result) { - result = result.toFixed(precision); - - if (_dom2.default.id(labThisCol[i])) { - switch (_string2.default.lower(oTypeThisCol)) { - case 'innerhtml': - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result; - } - break; - case 'setvalue': - _dom2.default.id(labThisCol[i]).value = result; - break; - case 'createtextnode': - var oldnode = _dom2.default.id(labThisCol[i]).firstChild; - var txtnode = _dom2.default.text(result); - _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); - break; - } //switch - } - } else { - try { - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); - } - } catch (e) {} //catch - } //else - } //for i - - // row(s) with result are always visible - var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; - if (totRow) { - totRow.style.display = ''; - } - } //for ucol - } //if typeof - - if (this.onAfterOperation) { - this.onAfterOperation.call(null, tf); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - // unsubscribe to events - this.tf.emitter.off('after-filtering', function () { - return _this2.calc(); - }); - } - }]); - - return ColOps; - })(); - - exports.default = ColOps; - -/***/ }, - -/***/ 30: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColsVisibility = (function () { - - /** - * Columns Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function ColsVisibility(tf, f) { - _classCallCheck(this, ColsVisibility); - - // Configuration object - var cfg = tf.config(); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Columns visibility manager'; - - //show/hide cols span element - this.spanEl = null; - //show/hide cols button element - this.btnEl = null; - //show/hide cols container div element - this.contEl = null; - - //tick to hide or show column - this.tickToHide = f.tick_to_hide === false ? false : true; - //enables/disables cols manager generation - this.manager = f.manager === false ? false : true; - //only if external headers - this.headersTbl = f.headers_table || false; - //only if external headers - this.headersIndex = f.headers_index || 1; - //id of container element - this.contElTgtId = f.container_target_id || null; - //alternative headers text - this.headersText = f.headers_text || null; - //id of button container element - this.btnTgtId = f.btn_target_id || null; - //defines show/hide cols text - this.btnText = f.btn_text || 'Columns▼'; - //defines show/hide cols button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for show/hide cols button - this.btnCssClass = f.btn_css_class || 'colVis'; - //defines close link text - this.btnCloseText = f.btn_close_text || 'Close'; - //defines close button innerHtml - this.btnCloseHtml = f.btn_close_html || null; - //defines css class for close button - this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; - this.stylesheet = f.stylesheet || 'colsVisibility.css'; - //span containing show/hide cols button - this.prfx = 'colVis_'; - //defines css class span containing show/hide cols - this.spanCssClass = f.span_css_class || 'colVisSpan'; - this.prfxCont = this.prfx + 'Cont_'; - //defines css class div containing show/hide cols - this.contCssClass = f.cont_css_class || 'colVisCont'; - //defines css class for cols list (ul) - this.listCssClass = cfg.list_css_class || 'cols_checklist'; - //defines css class for list item (li) - this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; - //defines css class for selected list item (li) - this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; - //text preceding columns list - this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); - this.atStart = f.at_start || null; - this.enableHover = Boolean(f.enable_hover); - //enables select all option - this.enableTickAll = Boolean(f.enable_tick_all); - //text preceding columns list - this.tickAllText = f.tick_all_text || 'Select all:'; - - //array containing hidden columns indexes - this.hiddenCols = []; - this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; - - //callback invoked just after cols manager is loaded - this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; - //calls function before cols manager is opened - this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; - //calls function after cols manager is opened - this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; - //calls function before cols manager is closed - this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; - //calls function after cols manager is closed - this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; - - //callback before col is hidden - this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; - //callback after col is hidden - this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; - //callback before col is displayed - this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; - //callback after col is displayed - this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; - - //Grid layout compatibility - if (tf.gridLayout) { - this.headersTbl = tf.feature('gridLayout').headTbl; //headers table - this.headersIndex = 0; //headers index - this.onAfterColDisplayed = function () {}; - this.onAfterColHidden = function () {}; - } - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - _createClass(ColsVisibility, [{ - key: 'toggle', - value: function toggle() { - var contDisplay = this.contEl.style.display; - var onBeforeOpen = this.onBeforeOpen; - var onBeforeClose = this.onBeforeClose; - var onAfterOpen = this.onAfterOpen; - var onAfterClose = this.onAfterClose; - - if (onBeforeOpen && contDisplay !== 'inline') { - onBeforeOpen.call(null, this); - } - if (onBeforeClose && contDisplay === 'inline') { - onBeforeClose.call(null, this); - } - - this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; - - if (onAfterOpen && contDisplay !== 'inline') { - onAfterOpen.call(null, this); - } - if (onAfterClose && contDisplay === 'inline') { - onAfterClose.call(null, this); - } - } - }, { - key: 'checkItem', - value: function checkItem(lbl) { - var li = lbl.parentNode; - if (!li || !lbl) { - return; - } - var isChecked = lbl.firstChild.checked; - var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; - colIndex = parseInt(colIndex, 10); - if (isChecked) { - _dom2.default.addClass(li, this.listSlcItemCssClass); - } else { - _dom2.default.removeClass(li, this.listSlcItemCssClass); - } - - var hide = false; - if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { - hide = true; - } - this.setHidden(colIndex, hide); - } - }, { - key: 'init', - value: function init() { - if (!this.manager) { - return; - } - this.buildBtn(); - this.buildManager(); - - this.initialized = true; - } - - /** - * Build main button UI - */ - - }, { - key: 'buildBtn', - value: function buildBtn() { - var _this = this; - - if (this.btnEl) { - return; - } - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.spanCssClass; - - //Container element (rdiv or custom element) - if (!this.btnTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); - - if (!this.btnTgtId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - if (!this.btnHtml) { - var btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCssClass; - btn.title = this.desc; - - btn.innerHTML = this.btnText; - span.appendChild(btn); - if (!this.enableHover) { - _event2.default.add(btn, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(btn, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } else { - //Custom html - span.innerHTML = this.btnHtml; - var colVisEl = span.firstChild; - if (!this.enableHover) { - _event2.default.add(colVisEl, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(colVisEl, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } - - this.spanEl = span; - this.btnEl = this.spanEl.firstChild; - - if (this.onLoaded) { - this.onLoaded.call(null, this); - } - } - - /** - * Build columns manager UI - */ - - }, { - key: 'buildManager', - value: function buildManager() { - var _this2 = this; - - var tf = this.tf; - - var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); - container.className = this.contCssClass; - - //Extension description - var extNameLabel = _dom2.default.create('p'); - extNameLabel.innerHTML = this.text; - container.appendChild(extNameLabel); - - //Headers list - var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); - ul.className = this.listCssClass; - - var tbl = this.headersTbl ? this.headersTbl : tf.tbl; - var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); - var headerRow = tbl.rows[headerIndex]; - - //Tick all option - if (this.enableTickAll) { - var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); - _dom2.default.addClass(li, this.listItemCssClass); - ul.appendChild(li); - li.check.checked = !this.tickToHide; - - _event2.default.add(li.check, 'click', function () { - for (var h = 0; h < headerRow.cells.length; h++) { - var itm = _dom2.default.id('col_' + h + '_' + tf.id); - if (itm && li.check.checked !== itm.checked) { - itm.click(); - itm.checked = li.check.checked; - } - } - }); - } - - for (var i = 0; i < headerRow.cells.length; i++) { - var cell = headerRow.cells[i]; - var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); - var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); - _dom2.default.addClass(liElm, this.listItemCssClass); - if (!this.tickToHide) { - _dom2.default.addClass(liElm, this.listSlcItemCssClass); - } - ul.appendChild(liElm); - if (!this.tickToHide) { - liElm.check.checked = true; - } - - _event2.default.add(liElm.check, 'click', function (evt) { - var elm = _event2.default.target(evt); - var lbl = elm.parentNode; - _this2.checkItem(lbl); - }); - } - - //separator - var p = _dom2.default.create('p', ['align', 'center']); - var btn; - //Close link - if (!this.btnCloseHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCloseCssClass; - btn.innerHTML = this.btnCloseText; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - p.appendChild(btn); - } else { - p.innerHTML = this.btnCloseHtml; - btn = p.firstChild; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - } - - container.appendChild(ul); - container.appendChild(p); - - this.btnEl.parentNode.insertBefore(container, this.btnEl); - this.contEl = container; - - if (this.atStart) { - var a = this.atStart; - for (var k = 0; k < a.length; k++) { - var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); - if (itm) { - itm.click(); - } - } - } - } - - /** - * Hide or show specified columns - * @param {Numner} colIndex Column index - * @param {Boolean} hide hide column if true or show if false - */ - - }, { - key: 'setHidden', - value: function setHidden(colIndex, hide) { - var tf = this.tf; - var tbl = tf.tbl; - - if (this.onBeforeColHidden && hide) { - this.onBeforeColHidden.call(null, this, colIndex); - } - if (this.onBeforeColDisplayed && !hide) { - this.onBeforeColDisplayed.call(null, this, colIndex); - } - - this._hideCells(tbl, colIndex, hide); - if (this.headersTbl) { - this._hideCells(this.headersTbl, colIndex, hide); - } - - var hiddenCols = this.hiddenCols; - var itemIndex = hiddenCols.indexOf(colIndex); - if (hide) { - if (itemIndex === -1) { - this.hiddenCols.push(colIndex); - } - } else { - if (itemIndex !== -1) { - this.hiddenCols.splice(itemIndex, 1); - } - } - - var gridLayout; - var headTbl; - var gridColElms; - if (this.onAfterColHidden && hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); - - var headTblW = parseInt(headTbl.style.width, 10); - headTbl.style.width = headTblW - hiddenWidth + 'px'; - tbl.style.width = headTbl.style.width; - } - this.onAfterColHidden.call(null, this, colIndex); - } - - if (this.onAfterColDisplayed && !hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var width = parseInt(gridColElms[colIndex].style.width, 10); - headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; - tf.tbl.style.width = headTbl.style.width; - } - this.onAfterColDisplayed.call(null, this, colIndex); - } - } - - /** - * Show specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'showCol', - value: function showCol(colIndex) { - if (colIndex === undefined || !this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, false); - } - } - - /** - * Hide specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'hideCol', - value: function hideCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, true); - } - } - - /** - * Determine if specified column is hidden - * @param {Number} colIndex Column index - */ - - }, { - key: 'isColHidden', - value: function isColHidden(colIndex) { - if (this.hiddenCols.indexOf(colIndex) !== -1) { - return true; - } - return false; - } - - /** - * Toggle visibility of specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggleCol', - value: function toggleCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - this.showCol(colIndex); - } else { - this.hideCol(colIndex); - } - } - - /** - * Returns the indexes of the columns currently hidden - * @return {Array} column indexes - */ - - }, { - key: 'getHiddenCols', - value: function getHiddenCols() { - return this.hiddenCols; - } - - /** - * Remove the columns manager - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - if (_dom2.default.id(this.contElTgtId)) { - _dom2.default.id(this.contElTgtId).innerHTML = ''; - } else { - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - } - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - this.initialized = false; - } - }, { - key: '_getHeaderText', - value: function _getHeaderText(cell) { - if (!cell.hasChildNodes) { - return ''; - } - - for (var i = 0; i < cell.childNodes.length; i++) { - var n = cell.childNodes[i]; - if (n.nodeType === 3) { - return n.nodeValue; - } else if (n.nodeType === 1) { - if (n.id && n.id.indexOf('popUp') !== -1) { - continue; - } else { - return _dom2.default.getText(n); - } - } - continue; - } - return ''; - } - }, { - key: '_hideCells', - value: function _hideCells(tbl, colIndex, hide) { - for (var i = 0; i < tbl.rows.length; i++) { - var row = tbl.rows[i]; - var cell = row.cells[colIndex]; - if (cell) { - cell.style.display = hide ? 'none' : ''; - } - } - } - }]); - - return ColsVisibility; - })(); - - exports.default = ColsVisibility; - -/***/ }, - -/***/ 31: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var FiltersVisibility = (function () { - - /** - * Filters Row Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function FiltersVisibility(tf, f) { - _classCallCheck(this, FiltersVisibility); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Filters row visibility manager'; - - // Path and image filenames - this.stylesheet = f.stylesheet || 'filtersVisibility.css'; - this.icnExpand = f.expand_icon_name || 'icn_exp.png'; - this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; - - //expand/collapse filters span element - this.contEl = null; - //expand/collapse filters btn element - this.btnEl = null; - - this.icnExpandHtml = 'Expand filters'; - this.icnCollapseHtml = 'Collapse filters'; - this.defaultText = 'Toggle filters'; - - //id of container element - this.targetId = f.target_id || null; - //enables/disables expand/collapse icon - this.enableIcon = f.enable_icon === false ? false : true; - this.btnText = f.btn_text || ''; - - //defines expand/collapse filters text - this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; - this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; - - //defines expand/collapse filters button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for expand/collapse filters button - this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; - //defines css class span containing expand/collapse filters - this.contCssClass = f.cont_css_class || 'expClpFlt'; - this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); - - this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; - - // Prefix - this.prfx = 'fltsVis_'; - - //callback before filters row is shown - this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; - //callback after filters row is shown - this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; - //callback before filters row is hidden - this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; - //callback after filters row is hidden - this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - /** - * Initialise extension - */ - - _createClass(FiltersVisibility, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - this.buildUI(); - this.initialized = true; - } - - /** - * Build UI elements - */ - - }, { - key: 'buildUI', - value: function buildUI() { - var _this = this; - - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.contCssClass; - - //Container element (rdiv or custom element) - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); - - if (!this.targetId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - var btn = undefined; - if (!this.btnHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); - btn.className = this.btnCssClass; - btn.title = this.btnText || this.defaultText; - btn.innerHTML = this.collapseBtnHtml; - span.appendChild(btn); - } else { - //Custom html - span.innerHTML = this.btnHtml; - btn = span.firstChild; - } - - _event2.default.add(btn, 'click', function () { - return _this.toggle(); - }); - - this.contEl = span; - this.btnEl = btn; - - if (!this.visibleAtStart) { - this.toggle(); - } - } - - /** - * Toggle filters visibility - */ - - }, { - key: 'toggle', - value: function toggle() { - var tf = this.tf; - var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; - var fltRow = tbl.rows[this.filtersRowIndex]; - var fltRowDisplay = fltRow.style.display; - - if (this.onBeforeShow && fltRowDisplay !== '') { - this.onBeforeShow.call(this, this); - } - if (this.onBeforeHide && fltRowDisplay === '') { - this.onBeforeHide.call(null, this); - } - - fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; - if (this.enableIcon && !this.btnHtml) { - this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; - } - - if (this.onAfterShow && fltRowDisplay !== '') { - this.onAfterShow.call(null, this); - } - if (this.onAfterHide && fltRowDisplay === '') { - this.onAfterHide.call(null, this); - } - } - - /** - * Destroy the UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - this.initialized = false; - } - }]); - - return FiltersVisibility; - })(); - - exports.default = FiltersVisibility; - -/***/ }, - -/***/ 32: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _date = __webpack_require__(7); - - var _date2 = _interopRequireDefault(_date); - - var _helpers = __webpack_require__(8); - - var _helpers2 = _interopRequireDefault(_helpers); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterSortableTable = (function () { - - /** - * SortableTable Adapter module - * @param {Object} tf TableFilter instance - */ - - function AdapterSortableTable(tf, opts) { - _classCallCheck(this, AdapterSortableTable); - - this.initialized = false; - this.name = opts.name; - this.desc = opts.description || 'Sortable table'; - - //indicates if tables was sorted - this.sorted = false; - - this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; - this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; - this.asyncSort = Boolean(opts.async_sort); - this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; - - // edit .sort-arrow.descending / .sort-arrow.ascending in - // tablefilter.css to reflect any path change - this.imgPath = opts.images_path || tf.themesPath; - this.imgBlank = opts.image_blank || 'blank.png'; - this.imgClassName = opts.image_class_name || 'sort-arrow'; - this.imgAscClassName = opts.image_asc_class_name || 'ascending'; - this.imgDescClassName = opts.image_desc_class_name || 'descending'; - //cell attribute storing custom key - this.customKey = opts.custom_key || 'data-tf-sortKey'; - - // callback invoked after sort is loaded and instanciated - this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; - // callback invoked before table is sorted - this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; - // callback invoked after table is sorted - this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; - - this.tf = tf; - } - - _createClass(AdapterSortableTable, [{ - key: 'init', - value: function init() { - var tf = this.tf; - var adpt = this; - - // SortableTable class sanity check (sortabletable.js) - if (_types2.default.isUndef(SortableTable)) { - throw new Error('SortableTable class not found.'); - } - - this.overrideSortableTable(); - this.setSortTypes(); - - //Column sort at start - var sortColAtStart = adpt.sortColAtStart; - if (sortColAtStart) { - this.stt.sort(sortColAtStart[0], sortColAtStart[1]); - } - - if (this.onSortLoaded) { - this.onSortLoaded.call(null, tf, this); - } - - /*** SortableTable callbacks ***/ - this.stt.onbeforesort = function () { - if (adpt.onBeforeSort) { - adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); - } - - /*** sort behaviour for paging ***/ - if (tf.paging) { - tf.feature('paging').disable(); - } - }; - - this.stt.onsort = function () { - adpt.sorted = true; - - //rows alternating bg issue - // TODO: move into AlternateRows component - if (tf.alternateRows) { - var rows = tf.tbl.rows, - c = 0; - - var setClass = function setClass(row, i, removeOnly) { - if (_types2.default.isUndef(removeOnly)) { - removeOnly = false; - } - var altRows = tf.feature('alternateRows'), - oddCls = altRows.oddCss, - evenCls = altRows.evenCss; - _dom2.default.removeClass(row, oddCls); - _dom2.default.removeClass(row, evenCls); - - if (!removeOnly) { - _dom2.default.addClass(row, i % 2 ? oddCls : evenCls); - } - }; - - for (var i = tf.refRow; i < tf.nbRows; i++) { - var isRowValid = rows[i].getAttribute('validRow'); - if (tf.paging && rows[i].style.display === '') { - setClass(rows[i], c); - c++; - } else { - if ((isRowValid === 'true' || isRowValid === null) && rows[i].style.display === '') { - setClass(rows[i], c); - c++; - } else { - setClass(rows[i], c, true); - } - } - } - } - //sort behaviour for paging - if (tf.paging) { - var paginator = tf.feature('paging'); - // recalculate valid rows index as sorting may have change it - tf.getValidRows(true); - paginator.enable(); - paginator.setPage(paginator.getPage()); - } - - if (adpt.onAfterSort) { - adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); - } - }; - - this.initialized = true; - } - - /** - * Sort specified column - * @param {Number} colIdx Column index - * @param {Boolean} desc Optional: descending manner - */ - - }, { - key: 'sortByColumnIndex', - value: function sortByColumnIndex(colIdx, desc) { - this.stt.sort(colIdx, desc); - } - }, { - key: 'overrideSortableTable', - value: function overrideSortableTable() { - var adpt = this, - tf = this.tf; - - /** - * Overrides headerOnclick method in order to handle th event - * @param {Object} e [description] - */ - SortableTable.prototype.headerOnclick = function (evt) { - if (!adpt.initialized) { - return; - } - - // find Header element - var el = evt.target || evt.srcElement; - - while (el.tagName !== 'TD' && el.tagName !== 'TH') { - el = el.parentNode; - } - - this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); - }; - - /** - * Overrides getCellIndex IE returns wrong cellIndex when columns are - * hidden - * @param {Object} oTd TD element - * @return {Number} Cell index - */ - SortableTable.getCellIndex = function (oTd) { - var cells = oTd.parentNode.cells, - l = cells.length, - i = undefined; - for (i = 0; cells[i] != oTd && i < l; i++) {} - return i; - }; - - /** - * Overrides initHeader in order to handle filters row position - * @param {Array} oSortTypes - */ - SortableTable.prototype.initHeader = function (oSortTypes) { - var stt = this; - if (!stt.tHead) { - if (tf.gridLayout) { - stt.tHead = tf.feature('gridLayout').headTbl.tHead; - } else { - return; - } - } - - stt.headersRow = tf.headersRow; - var cells = stt.tHead.rows[stt.headersRow].cells; - stt.sortTypes = oSortTypes || []; - var l = cells.length; - var img = undefined, - c = undefined; - - for (var i = 0; i < l; i++) { - c = cells[i]; - if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { - c.style.cursor = 'pointer'; - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - c.appendChild(img); - if (stt.sortTypes[i] !== null) { - c.setAttribute('_sortType', stt.sortTypes[i]); - } - _event2.default.add(c, 'click', stt._headerOnclick); - } else { - c.setAttribute('_sortType', oSortTypes[i]); - c._sortType = 'None'; - } - } - stt.updateHeaderArrows(); - }; - - /** - * Overrides updateHeaderArrows in order to handle arrows indicators - */ - SortableTable.prototype.updateHeaderArrows = function () { - var stt = this; - var cells = undefined, - l = undefined, - img = undefined; - - // external headers - if (adpt.asyncSort && adpt.triggerIds.length > 0) { - var triggers = adpt.triggerIds; - cells = []; - l = triggers.length; - for (var j = 0; j < triggers.length; j++) { - cells.push(_dom2.default.id(triggers[j])); - } - } else { - if (!this.tHead) { - return; - } - cells = stt.tHead.rows[stt.headersRow].cells; - l = cells.length; - } - for (var i = 0; i < l; i++) { - var cellAttr = cells[i].getAttribute('_sortType'); - if (cellAttr !== null && cellAttr !== 'None') { - img = cells[i].lastChild || cells[i]; - if (img.nodeName.toLowerCase() !== 'img') { - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - cells[i].appendChild(img); - } - if (i === stt.sortColumn) { - img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); - } else { - img.className = adpt.imgClassName; - } - } - } - }; - - /** - * Overrides getRowValue for custom key value feature - * @param {Object} oRow Row element - * @param {String} sType - * @param {Number} nColumn - * @return {String} - */ - SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { - var stt = this; - // if we have defined a custom getRowValue use that - var sortTypeInfo = stt._sortTypeInfo[sType]; - if (sortTypeInfo && sortTypeInfo.getRowValue) { - return sortTypeInfo.getRowValue(oRow, nColumn); - } - var c = oRow.cells[nColumn]; - var s = SortableTable.getInnerText(c); - return stt.getValueFromString(s, sType); - }; - - /** - * Overrides getInnerText in order to avoid Firefox unexpected sorting - * behaviour with untrimmed text elements - * @param {Object} oNode DOM element - * @return {String} DOM element inner text - */ - SortableTable.getInnerText = function (oNode) { - if (!oNode) { - return; - } - if (oNode.getAttribute(adpt.customKey)) { - return oNode.getAttribute(adpt.customKey); - } else { - return _dom2.default.getText(oNode); - } - }; - } - }, { - key: 'addSortType', - value: function addSortType() { - var args = arguments; - SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); - } - }, { - key: 'setSortTypes', - value: function setSortTypes() { - var _this = this; - - var tf = this.tf, - sortTypes = this.sortTypes, - _sortTypes = []; - - for (var i = 0; i < tf.nbCells; i++) { - var colType = undefined; - - if (sortTypes[i]) { - colType = sortTypes[i].toLowerCase(); - if (colType === 'none') { - colType = 'None'; - } - } else { - // resolve column types - if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { - colType = tf.colNbFormat[i].toLowerCase(); - } else if (tf.hasColDateType && tf.colDateType[i] !== null) { - colType = tf.colDateType[i].toLowerCase() + 'date'; - } else { - colType = 'String'; - } - } - _sortTypes.push(colType); - } - - //Public TF method to add sort type - - //Custom sort types - this.addSortType('number', Number); - this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); - this.addSortType('date', SortableTable.toDate); - this.addSortType('string'); - this.addSortType('us', usNumberConverter); - this.addSortType('eu', euNumberConverter); - this.addSortType('dmydate', dmyDateConverter); - this.addSortType('ymddate', ymdDateConverter); - this.addSortType('mdydate', mdyDateConverter); - this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); - this.addSortType('ipaddress', ipAddress, sortIP); - - this.stt = new SortableTable(tf.tbl, _sortTypes); - - /*** external table headers adapter ***/ - if (this.asyncSort && this.triggerIds.length > 0) { - (function () { - var triggers = _this.triggerIds; - for (var j = 0; j < triggers.length; j++) { - if (triggers[j] === null) { - continue; - } - var trigger = _dom2.default.id(triggers[j]); - if (trigger) { - trigger.style.cursor = 'pointer'; - - _event2.default.add(trigger, 'click', function (evt) { - var elm = evt.target; - if (!_this.tf.sort) { - return; - } - _this.stt.asyncSort(triggers.indexOf(elm.id)); - }); - trigger.setAttribute('_sortType', _sortTypes[j]); - } - } - })(); - } - } - - /** - * Destroy sort - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - this.sorted = false; - this.initialized = false; - this.stt.destroy(); - - var ids = tf.getFiltersId(); - for (var idx = 0; idx < ids.length; idx++) { - var header = tf.getHeaderElement(idx); - var img = _dom2.default.tag(header, 'img'); - - if (img.length === 1) { - header.removeChild(img[0]); - } - } - } - }]); - - return AdapterSortableTable; - })(); - - //Converters - - exports.default = AdapterSortableTable; - function usNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'us'); - } - function euNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'eu'); - } - function dateConverter(s, format) { - return _date2.default.format(s, format); - } - function dmyDateConverter(s) { - return dateConverter(s, 'DMY'); - } - function mdyDateConverter(s) { - return dateConverter(s, 'MDY'); - } - function ymdDateConverter(s) { - return dateConverter(s, 'YMD'); - } - function ddmmmyyyyDateConverter(s) { - return dateConverter(s, 'DDMMMYYYY'); - } - - function ipAddress(value) { - var vals = value.split('.'); - for (var x in vals) { - var val = vals[x]; - while (3 > val.length) { - val = '0' + val; - } - vals[x] = val; - } - return vals.join('.'); - } - - function sortIP(a, b) { - var aa = ipAddress(a.value.toLowerCase()); - var bb = ipAddress(b.value.toLowerCase()); - if (aa == bb) { - return 0; - } else if (aa < bb) { - return -1; - } else { - return 1; - } - } - -/***/ }, - -/***/ 33: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterSortabletable = __webpack_require__(32); - - var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - if (!window.SortableTable) { - __webpack_require__(34); - } // import 'script!sortabletable'; - - exports.default = _adapterSortabletable2.default; - -/***/ }, - -/***/ 34: -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") - -/***/ }, - -/***/ 35: -/***/ function(module, exports) { - - /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra - */ - module.exports = function(src) { - if (typeof execScript === "function") - execScript(src); - else - eval.call(null, src); - } - -/***/ }, - -/***/ 36: -/***/ function(module, exports) { - - module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" - -/***/ } - -}); -//# sourceMappingURL=tf-1.js.map \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),g=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+g?d[l+g]:[u-1]:l-g<=d[0]?d[0]:d[l-g],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var m=l+g;o=m>u-1?d[u-1]:d[m]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-g];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var g=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),g&&g.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(m){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off("after-filtering",function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/src/tablefilter.js b/src/tablefilter.js index 195d6e1e..01179301 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -940,7 +940,10 @@ export class TableFilter { this.initExtensions(); } - // Subscribe to event + // Subscribe to events + if(this.markActiveColumns){ + this.emitter.on('before-filtering', ()=> this.clearActiveColumns()); + } if(this.linkedFilters){ this.emitter.on('after-filtering', ()=> this.linkFilters()); } @@ -1205,6 +1208,8 @@ export class TableFilter { } if(this.markActiveColumns){ this.clearActiveColumns(); + this.emitter.off('before-filtering', + ()=> this.clearActiveColumns()); } if(this.hasExtensions){ this.destroyExtensions(); @@ -1522,19 +1527,6 @@ export class TableFilter { hiddenrows = 0; this.validRowsIndex = []; - - // removes keyword highlighting - // if(this.highlightKeywords){ - // Mod.highlightKeyword.unhighlightAll(); - // } - //removes popup filters active icons - // if(this.popupFilters){ - // Mod.popupFilter.buildIcons(); - // } - //removes active column header class - if(this.markActiveColumns){ - this.clearActiveColumns(); - } // search args re-init this.searchArgs = this.getFiltersValue(); @@ -2074,7 +2066,7 @@ export class TableFilter { * @return {String} */ getCellData(cell){ - var idx = cell.cellIndex; + let idx = cell.cellIndex; //Check for customCellData callback if(this.customCellData && this.customCellDataCols.indexOf(idx) != -1){ return this.customCellData.call(null, this, cell, idx); From 8e3416e24c874e13450f826f2bd3720256a2c136 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Wed, 30 Dec 2015 17:59:20 +1100 Subject: [PATCH 08/41] Started row-processed event --- README.md | 4 +- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 7694 ++++++++++++++++- dist/tablefilter/tf-1.js | 2224 ++++- src/modules/alternateRows.js | 16 + src/tablefilter.js | 14 +- 11 files changed, 9934 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 2de55005..c75589d8 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,11 @@ git clone --bare https://github.com/koalyptus/TableFilter.git * Alternatively, install TableFilter files in your npm enabled project using: ```shell -npm install tablefilter +npm install tablefilter --save ``` * or get the future features from the ``next`` release channel: ```shell -npm install tablefilter@next +npm install tablefilter@next --save ``` ## Setup diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index a6e27bac..5a5f4153 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-30T05:48:52.503Z + * build date: 2015-12-30T06:42:09.885Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index b62df92a..fdee1d64 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-30T05:48:52.503Z + * build date: 2015-12-30T06:42:09.885Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 4508f4a0..d8e03c61 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-30T05:48:52.503Z + * build date: 2015-12-30T06:42:09.885Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index a000bda2..df230589 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-30T05:48:52.503Z + * build date: 2015-12-30T06:42:09.885Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 1e715fba..2c78df4e 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-30T05:48:52.503Z + * build date: 2015-12-30T06:42:09.885Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index f1567c4d..9aed0b4b 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-30T05:48:52.503Z + * build date: 2015-12-30T06:42:09.885Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 294063f3..63853663 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,7686 @@ -/** - * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-30T05:48:52.421Z - * MIT License - */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else { + var a = factory(); + for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; + } +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ var parentJsonpFunction = window["webpackJsonp"]; +/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, callbacks = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) +/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); +/******/ while(callbacks.length) +/******/ callbacks.shift().call(null, __webpack_require__); +/******/ +/******/ }; +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // object to store loaded and loading chunks +/******/ // "0" means "already loaded" +/******/ // Array means "loading", array contains callbacks +/******/ var installedChunks = { +/******/ 0:0 +/******/ }; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // This file contains only the entry chunk. +/******/ // The chunk loading function for additional chunks +/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { +/******/ // "0" is the signal for "already loaded" +/******/ if(installedChunks[chunkId] === 0) +/******/ return callback.call(null, __webpack_require__); +/******/ +/******/ // an array means "currently loading". +/******/ if(installedChunks[chunkId] !== undefined) { +/******/ installedChunks[chunkId].push(callback); +/******/ } else { +/******/ // start chunk loading +/******/ installedChunks[chunkId] = [callback]; +/******/ var head = document.getElementsByTagName('head')[0]; +/******/ var script = document.createElement('script'); +/******/ script.type = 'text/javascript'; +/******/ script.charset = 'utf-8'; +/******/ script.async = true; +/******/ +/******/ script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js"; +/******/ head.appendChild(script); +/******/ } +/******/ }; +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var a=s[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var n,r,o=0,h=[];on;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.1",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":a(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),a=s._ezEditTable;s.cfg.editable&&a.Editable.Remove(),s.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,a,l);break;case e.checklist:r.checkList._build(s,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,a=i.slcExternal,l=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,a=t.path,l=void 0;s&&a?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var a=[i(26)("./"+l)];(function(i){var a=new i["default"](e,t);a.init(),e.ExtRegistry[s]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],a=this.ExtRegistry[s.name];a&&(a.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var a=t[i],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],a=u["default"].id(s);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],a=[],l=i.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(a.sort(),s.sort()),[a,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(i)),""!==a&&s.highlightKeyword.highlight(i,a,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=a(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)s=l<=a(t.replace(r,""),n);else if(T)s=l>=a(t.replace(o,""),n);else if(u)s=la(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,a=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.popupFilters&&s.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&F&&(P=!0),P?(this.validateRow(x,!0),this.validRowsIndex.push(x),this.alternateRows&&s.alternateRows.setRowBg(x,this.validRowsIndex.length),this.onRowValidated&&this.onRowValidated.call(null,this,x)):(this.validateRow(x,!1),s.alternateRows&&s.alternateRows.removeRowBg(x),this.hasVisibleRows&&-1!==this.visibleRows.indexOf(x)?this.validRowsIndex.push(x):a++)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]); -for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var a=0,l=i.options.length;l>a;a++)i.options[a].selected&&(e=e.concat(i.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,a=this.fltIds.length;a>s;s++){var l=this.getFilterType(s);if(l===f["default"].lower(t)){var n=e?s:this.fltIds[s];i.push(n)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sn;n++){var o=this.getCellData(l[n]);a[1].push(o)}i.push(a)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),a=0;aa;a++){var n=i[a],r=n[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",a=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",a)}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),a=s.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=s[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=i[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("cleared-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=s.length;r>n;n++){var o=u["default"].id(this.fltIds[s[n]]);if(l=this.getFilterValue(s[n]),a!==s[n]||this.paging&&-1!=t.indexOf(s[n])&&a===s[n]||!this.paging&&(-1!=i.indexOf(s[n])||-1!=e.indexOf(s[n]))||l===this.displayAllText){if(-1!=i.indexOf(s[n])?this.Mod.checkList.checkListDiv[s[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[n])?this.Mod.checkList._build(s[n]):this.Mod.dropdown._build(s[n],!0),this.setFilterValue(s[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,a=i[s];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",a="script"==s?"src":"href",l=u["default"].tag(H,s),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var a=s?s:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var a=0;a0){var s=document.cookie,a=s.indexOf(i);if(-1!==a){a+=i.length;var l=s.indexOf(";",a);-1===l&&(l=s.length),e=unescape(s.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,a=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0])}return a}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,a=parseInt(s.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,i,s,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var i=0;i_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,a=this.addTChecks(t,e),l=[],n=s.feature("store"),o=n?n.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),l=a+s.pagingLength-1<=e.nbVisibleRows?a+s.pagingLength-1:e.nbVisibleRows;i=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var a=i.refRow,r=i.nbRows;i.nbPages=Math.ceil((r-a)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo", -value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,i=e.tbl.rows,s=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(s.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=s[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&i&&i.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&i&&i.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":a(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),a=d["default"].id(this.prfxBtnLastSpan+e.id),l=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),a&&(b["default"].remove(a,"click",h.last),d["default"].remove(a)),l&&(b["default"].remove(l,"click",h.first),d["default"].remove(l)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var a=i.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;in;n++){var r=i?n:e[n];this.setRowBg(r,l),l++}this.initialized=!0}}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){if(this.initialized){for(var t=this.tf.refRow;t0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + // Features + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.TableFilter = undefined; + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + var _emitter = __webpack_require__(9); + + var _store = __webpack_require__(10); + + var _gridLayout = __webpack_require__(11); + + var _loader = __webpack_require__(13); + + var _highlightKeywords = __webpack_require__(14); + + var _popupFilter = __webpack_require__(15); + + var _dropdown = __webpack_require__(16); + + var _checkList = __webpack_require__(18); + + var _rowsCounter = __webpack_require__(19); + + var _statusBar = __webpack_require__(20); + + var _paging = __webpack_require__(21); + + var _clearButton = __webpack_require__(22); + + var _help = __webpack_require__(23); + + var _alternateRows = __webpack_require__(24); + + var _noResults = __webpack_require__(25); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var global = window, + doc = global.document; + + var TableFilter = exports.TableFilter = (function () { + + /** + * TableFilter object constructor + * requires `table` or `id` arguments, `row` and `configuration` optional + * @param {DOMElement} table Table DOM element + * @param {String} id Table id + * @param {Number} row index indicating the 1st row + * @param {Object} configuration object + */ + + function TableFilter() { + var _this = this; + + _classCallCheck(this, TableFilter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (args.length === 0) { + return; + } + + this.id = null; + this.version = '0.1.1'; + this.year = new Date().getFullYear(); + this.tbl = null; + this.startRow = null; + this.refRow = null; + this.headersRow = null; + this.cfg = {}; + this.nbFilterableRows = null; + this.nbRows = null; + this.nbCells = null; + this._hasGrid = false; + + // TODO: use for-of with babel plug-in + args.forEach(function (arg) { + // for (let arg of args) { + var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); + if (argtype === 'object' && arg && arg.nodeName === 'TABLE') { + _this.tbl = arg; + _this.id = arg.id || 'tf_' + new Date().getTime() + '_'; + } else if (argtype === 'string') { + _this.id = arg; + _this.tbl = _dom2.default.id(arg); + } else if (argtype === 'number') { + _this.startRow = arg; + } else if (argtype === 'object') { + _this.cfg = arg; + } + // } + }); + + if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) { + throw new Error('Could not instantiate TableFilter: HTML table not found.'); + } + + // configuration object + var f = this.cfg; + + this.emitter = new _emitter.Emitter(); + + //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 || 'tablefilter/'; + + /*** filter types ***/ + this.fltTypeInp = 'input'; + this.fltTypeSlc = 'select'; + this.fltTypeMulti = 'multiple'; + this.fltTypeCheckList = 'checklist'; + this.fltTypeNone = 'none'; + + /*** filters' grid properties ***/ + + //enables/disables filter grid + this.fltGrid = f.grid === false ? false : true; + + //enables/disables grid layout (fixed headers) + this.gridLayout = Boolean(f.grid_layout); + + this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index; + this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index; + + 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 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; + + //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.stylePath = f.style_path || this.basePath + 'style/'; + this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows); + //defines widths of columns + this.hasColWidths = _types2.default.isArray(f.col_widths); + this.colWidths = this.hasColWidths ? f.col_widths : null; + //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'; + + /*** filters' grid behaviours ***/ + //enables/disables enter key + this.enterKey = f.enter_key === false ? false : true; + //calls function before filtering starts + this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null; + //calls function after filtering + this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null; + //enables/disables case sensitivity + this.caseSensitive = Boolean(f.case_sensitive); + //has exact match per column + this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match); + this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : []; + //enables/disbles exact match for search + this.exactMatch = Boolean(f.exact_match); + //refreshes drop-down lists upon validation + this.linkedFilters = Boolean(f.linked_filters); + //wheter excluded options are disabled + this.disableExcludedOptions = Boolean(f.disable_excluded_options); + //stores active filter element + this.activeFlt = null; + //id of active filter + this.activeFilterId = null; + //enables always visible rows + this.hasVisibleRows = Boolean(f.rows_always_visible); + //array containing always visible rows + this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; + //enables/disables external filters generation + this.isExternalFlt = Boolean(f.external_flt_grid); + //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null; + //enables/disables single filter search + this.singleSearchFlt = Boolean(f.single_filter); + //calls function after row is validated + this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null; + //input watermark text array + this.watermark = f.watermark || ''; + this.isWatermarkArray = _types2.default.isArray(this.watermark); + //id of toolbar container element + this.toolBarTgtId = f.toolbar_target_id || null; + //enables/disables help div + this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions); + //popup filters + this.popupFilters = Boolean(f.popup_filters); + //active columns color + this.markActiveColumns = Boolean(f.mark_active_columns); + //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null; + //calls function after active column header is marked + this.onAfterActiveColumn = _types2.default.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 || 'Clear'; + //enables/disables empty option in combo-box filters + this.enableEmptyOption = Boolean(f.enable_empty_option); + //defines empty option text + this.emptyText = f.empty_text || '(Empty)'; + //enables/disables non empty option in combo-box filters + this.enableNonEmptyOption = Boolean(f.enable_non_empty_option); + //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 = Boolean(f.sort_num_asc); + this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null; + //enables/disables descending numeric options sorting + this.isSortNumDesc = Boolean(f.sort_num_desc); + this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null; + //Select filters are populated on demand + this.loadFltOnDemand = Boolean(f.load_filters_on_demand); + this.hasCustomOptions = _types2.default.isObj(f.custom_options); + this.customOptions = f.custom_options; + + /*** 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 || '^[¥£€$]'; + this.separator = f.separator || ','; + + /*** rows counter ***/ + //show/hides rows counter + this.rowsCounter = Boolean(f.rows_counter); + + /*** status bar ***/ + //show/hides status bar + this.statusBar = Boolean(f.status_bar); + + /*** loader ***/ + //enables/disables loader/spinner indicator + this.loader = Boolean(f.loader); + + /*** validation - reset buttons/links ***/ + //show/hides filter's validation button + this.displayBtn = Boolean(f.btn); + //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 = Boolean(f.btn_reset); + //defines css class for reset button + this.btnResetCssClass = f.btn_reset_css_class || 'reset'; + //callback function before filters are cleared + this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null; + //callback function after filters are cleared + this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null; + + /*** paging ***/ + //enables/disables table paging + this.paging = Boolean(f.paging); + this.nbVisibleRows = 0; //nb visible rows + this.nbHiddenRows = 0; //nb hidden rows + + /*** autofilter on typing ***/ + //enables/disables auto filtering, table is filtered when user stops + //typing + this.autoFilter = Boolean(f.auto_filter); + //onkeyup delay timer (msecs) + this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900; + //typing indicator + this.isUserTyping = null; + this.autoFilterTimer = null; + + /*** keyword highlighting ***/ + //enables/disables keyword highlighting + this.highlightKeywords = Boolean(f.highlight_keywords); + + /*** No results feature ***/ + this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message); + + /*** 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 = _types2.default.isArray(f.col_number_format); + //array containing columns nb formats + this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null; + //enables date type per column + this.hasColDateType = _types2.default.isArray(f.col_date_type); + //array containing columns date type + this.colDateType = 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_'; + //filter values cookie + this.prfxCookieFltsValues = 'tf_flts_'; + //page nb cookie + this.prfxCookiePageNb = 'tf_pgnb_'; + //page length cookie + this.prfxCookiePageLen = 'tf_pglen_'; + + /*** cookies ***/ + this.hasStoredValues = false; + //remembers filters values on page load + this.rememberGridValues = Boolean(f.remember_grid_values); + //cookie storing filter values + this.fltsValuesCookie = this.prfxCookieFltsValues + this.id; + //remembers page nb on page load + this.rememberPageNb = this.paging && f.remember_page_number; + //cookie storing page nb + this.pgNbCookie = this.prfxCookiePageNb + this.id; + //remembers page length on page load + this.rememberPageLen = this.paging && f.remember_page_length; + //cookie storing page length + this.pgLenCookie = this.prfxCookiePageLen + this.id; + + /*** extensions ***/ + //imports external script + this.extensions = f.extensions; + this.hasExtensions = _types2.default.isArray(this.extensions); + + /*** themes ***/ + this.enableDefaultTheme = Boolean(f.enable_default_theme); + //imports themes + this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes); + this.themes = f.themes || []; + //themes path + this.themesPath = f.themes_path || this.stylePath + 'themes/'; + + // Features registry + this.Mod = {}; + + // Extensions registry + this.ExtRegistry = {}; + + /*** TF events ***/ + this.Evt = { + name: { + filter: 'Filter', + dropdown: 'DropDown', + checklist: 'CheckList', + changepage: 'ChangePage', + clear: 'Clear', + changeresultsperpage: 'ChangeResults', + resetvalues: 'ResetValues', + resetpage: 'ResetPage', + resetpagelength: 'ResetPageLength', + loadextensions: 'LoadExtensions', + loadthemes: 'LoadThemes' + }, + + // Detect key + detectKey: function detectKey(e) { + if (!this.enterKey) { + return; + } + var _ev = e || global.event; + if (_ev) { + var key = _event2.default.keyCode(_ev); + if (key === 13) { + this.filter(); + _event2.default.cancel(_ev); + _event2.default.stop(_ev); + } else { + this.isUserTyping = true; + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + } + }, + + // if auto-filter on, detect user is typing and filter columns + onKeyUp: function onKeyUp(e) { + if (!this.autoFilter) { + return; + } + var _ev = e || global.event; + var key = _event2.default.keyCode(_ev); + this.isUserTyping = false; + + function filter() { + /*jshint validthis:true */ + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + if (!this.isUserTyping) { + this.filter(); + this.isUserTyping = null; + } + } + + if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) { + if (this.autoFilterTimer === null) { + this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay); + } + } else { + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + }, + + // if auto-filter on, detect user is typing + onKeyDown: function onKeyDown() { + if (!this.autoFilter) { + return; + } + this.isUserTyping = true; + }, + + // if auto-filter on, clear interval on filter blur + onInpBlur: function onInpBlur() { + if (this.autoFilter) { + this.isUserTyping = false; + global.clearInterval(this.autoFilterTimer); + } + // TODO: hack to prevent ezEditTable enter key event hijaking. + // Needs to be fixed in the vendor's library + if (this.hasExtension('advancedGrid')) { + var advGrid = this.extension('advancedGrid'); + var ezEditTable = advGrid._ezEditTable; + if (advGrid.cfg.editable) { + ezEditTable.Editable.Set(); + } + if (advGrid.cfg.selection) { + ezEditTable.Selection.Set(); + } + } + }, + + // set focused text-box filter as active + onInpFocus: function onInpFocus(e) { + var _ev = e || global.event; + var elm = _event2.default.target(_ev); + this.activeFilterId = elm.getAttribute('id'); + this.activeFlt = _dom2.default.id(this.activeFilterId); + if (this.popupFilters) { + _event2.default.cancel(_ev); + _event2.default.stop(_ev); + } + // TODO: hack to prevent ezEditTable enter key event hijaking. + // Needs to be fixed in the vendor's library + if (this.hasExtension('advancedGrid')) { + var advGrid = this.extension('advancedGrid'); + var ezEditTable = advGrid._ezEditTable; + if (advGrid.cfg.editable) { + ezEditTable.Editable.Remove(); + } + if (advGrid.cfg.selection) { + ezEditTable.Selection.Remove(); + } + } + }, + + // set focused drop-down filter as active + onSlcFocus: function onSlcFocus(e) { + var _ev = e || global.event; + var elm = _event2.default.target(_ev); + this.activeFilterId = elm.getAttribute('id'); + this.activeFlt = _dom2.default.id(this.activeFilterId); + // select is populated when element has focus + if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + this.Mod.dropdown._build(ct); + } + if (this.popupFilters) { + _event2.default.cancel(_ev); + _event2.default.stop(_ev); + } + }, + + // filter columns on drop-down filter change + onSlcChange: function onSlcChange(e) { + if (!this.activeFlt) { + return; + } + var _ev = e || global.event; + if (this.popupFilters) { + _event2.default.stop(_ev); + } + if (this.onSlcChange) { + this.filter(); + } + }, + + // fill checklist filter on click if required + onCheckListClick: function onCheckListClick(e) { + var _ev = e || global.event; + var elm = _event2.default.target(_ev); + if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + this.Mod.checkList._build(ct); + this.Mod.checkList.checkListDiv[ct].onclick = null; + this.Mod.checkList.checkListDiv[ct].title = ''; + } + } + }; + } + + /** + * Initialise filtering grid bar behaviours and layout + * + * TODO: decompose in smaller methods + */ + + _createClass(TableFilter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this._hasGrid) { + return; + } + if (!this.tbl) { + this.tbl = _dom2.default.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 Mod = this.Mod; + var n = this.singleSearchFlt ? 1 : this.nbCells, + inpclass = undefined; + + //loads stylesheet if not imported + this.import(this.stylesheetId, this.stylesheet, null, 'link'); + + //loads theme + if (this.hasThemes) { + this._loadThemes(); + } + + if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { + Mod.store = new _store.Store(this); + Mod.store.init(); + } + + if (this.gridLayout) { + Mod.gridLayout = new _gridLayout.GridLayout(this); + Mod.gridLayout.init(); + } + + if (this.loader) { + if (!Mod.loader) { + Mod.loader = new _loader.Loader(this); + } + Mod.loader.init(); + } + + if (this.highlightKeywords) { + Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this); + Mod.highlightKeyword.init(); + } + + if (this.popupFilters) { + if (!Mod.popupFilter) { + Mod.popupFilter = new _popupFilter.PopupFilter(this); + } + Mod.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 = undefined; + if (!this.gridLayout) { + var thead = _dom2.default.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.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) { + Mod.popupFilter.build(i); + } + + var fltcell = _dom2.default.create(this.fltCellTag), + col = this.getFilterType(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; + + //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 (!Mod.dropdown) { + Mod.dropdown = new _dropdown.Dropdown(this); + } + var dropdown = Mod.dropdown; + + var slc = _dom2.default.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 = _string2.default.lower(col) === this.fltTypeSlc ? inpclass : this.fltMultiCssClass; + + //filter is appended in desired external element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(slc); + this.externalFltEls.push(slc); + } else { + fltcell.appendChild(slc); + } + + this.fltIds.push(this.prfxFlt + i + '_' + this.id); + + if (!this.loadFltOnDemand) { + dropdown._build(i); + } + + _event2.default.add(slc, 'keypress', this.Evt.detectKey.bind(this)); + _event2.default.add(slc, 'change', this.Evt.onSlcChange.bind(this)); + _event2.default.add(slc, 'focus', this.Evt.onSlcFocus.bind(this)); + + //1st option is created here since dropdown.build isn't + //invoked + if (this.loadFltOnDemand) { + var opt0 = _dom2.default.createOpt(this.displayAllText, ''); + slc.appendChild(opt0); + } + } + // checklist + else if (col === this.fltTypeCheckList) { + var checkList = undefined; + Mod.checkList = new _checkList.CheckList(this); + checkList = Mod.checkList; + + var divCont = _dom2.default.create('div', ['id', checkList.prfxCheckListDiv + i + '_' + this.id], ['ct', i], ['filled', '0']); + divCont.className = checkList.checkListDivCssClass; + + //filter is appended in desired element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(divCont); + this.externalFltEls.push(divCont); + } else { + fltcell.appendChild(divCont); + } + + checkList.checkListDiv[i] = divCont; + this.fltIds.push(this.prfxFlt + i + '_' + this.id); + if (!this.loadFltOnDemand) { + checkList._build(i); + } + + if (this.loadFltOnDemand) { + _event2.default.add(divCont, 'click', this.Evt.onCheckListClick.bind(this)); + divCont.appendChild(_dom2.default.text(checkList.activateCheckListTxt)); + } + } else { + //show/hide input + var inptype = col === this.fltTypeInp ? 'text' : 'hidden'; + var inp = _dom2.default.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; + _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this)); + + //filter is appended in desired element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(inp); + this.externalFltEls.push(inp); + } else { + fltcell.appendChild(inp); + } + + this.fltIds.push(this.prfxFlt + i + '_' + this.id); + + _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this)); + _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this)); + _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this)); + _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this)); + + if (this.rememberGridValues) { + var flts_values = this.Mod.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 = _dom2.default.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) { + _dom2.default.id(externalFltTgtId).appendChild(btn); + } else { + fltcell.appendChild(btn); + } + + _event2.default.add(btn, 'click', function () { + return _this2.filter(); + }); + } //if + } // for i + } else { + this._resetGrid(); + } //if isFirstLoad + } //if this.fltGrid + + /* Features */ + if (this.hasVisibleRows) { + this.emitter.on('after-filtering', function () { + return _this2.enforceVisibility(); + }); + this.enforceVisibility(); + } + if (this.rowsCounter) { + Mod.rowsCounter = new _rowsCounter.RowsCounter(this); + Mod.rowsCounter.init(); + } + if (this.statusBar) { + Mod.statusBar = new _statusBar.StatusBar(this); + Mod.statusBar.init(); + } + if (this.paging || Mod.paging) { + if (!Mod.paging) { + Mod.paging = new _paging.Paging(this); + Mod.paging.init(); + } + Mod.paging.reset(); + } + if (this.btnReset) { + Mod.clearButton = new _clearButton.ClearButton(this); + Mod.clearButton.init(); + } + if (this.help) { + if (!Mod.help) { + Mod.help = new _help.Help(this); + } + Mod.help.init(); + } + if (this.hasColWidths && !this.gridLayout) { + this.setColWidths(); + } + if (this.alternateRows) { + Mod.alternateRows = new _alternateRows.AlternateRows(this); + Mod.alternateRows.init(); + } + if (this.noResults) { + if (!Mod.noResults) { + Mod.noResults = new _noResults.NoResults(this); + } + Mod.noResults.init(); + } + + 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) { + _dom2.default.addClass(this.tbl, this.prfxTf); + } + + if (this.loader) { + Mod.loader.show('none'); + } + + /* Loads extensions */ + if (this.hasExtensions) { + this.initExtensions(); + } + + // Subscribe to events + if (this.markActiveColumns) { + this.emitter.on('before-filtering', function () { + return _this2.clearActiveColumns(); + }); + } + if (this.linkedFilters) { + this.emitter.on('after-filtering', function () { + return _this2.linkFilters(); + }); + } + + if (this.onFiltersLoaded) { + this.onFiltersLoaded.call(null, this); + } + + this.emitter.emit('initialized', this); + } + + /** + * Manages state messages + * @param {String} evt Event name + * @param {Object} cfg Config object + */ + + }, { + key: 'EvtManager', + value: function EvtManager(evt) { + var cfg = arguments.length <= 1 || arguments[1] === undefined ? { slcIndex: null, slcExternal: false, slcId: null, pgIndex: null } : arguments[1]; + + var slcIndex = cfg.slcIndex; + var slcExternal = cfg.slcExternal; + var slcId = cfg.slcId; + var pgIndex = cfg.pgIndex; + var cpt = this.Mod; + + function efx() { + /*jshint validthis:true */ + var ev = this.Evt.name; + + switch (evt) { + case ev.filter: + this._filter(); + break; + case ev.dropdown: + if (this.linkedFilters) { + cpt.dropdown._build(slcIndex, true); + } else { + cpt.dropdown._build(slcIndex, false, slcExternal, slcId); + } + break; + case ev.checklist: + cpt.checkList._build(slcIndex, slcExternal, slcId); + break; + case ev.changepage: + cpt.paging._changePage(pgIndex); + break; + case ev.clear: + this._clearFilters(); + this._filter(); + break; + case ev.changeresultsperpage: + cpt.paging._changeResultsPerPage(); + break; + case ev.resetvalues: + this._resetValues(); + this._filter(); + break; + case ev.resetpage: + cpt.paging._resetPage(this.pgNbCookie); + break; + case ev.resetpagelength: + cpt.paging._resetPageLength(this.pgLenCookie); + break; + case ev.loadextensions: + this._loadExtensions(); + break; + case ev.loadthemes: + this._loadThemes(); + break; + } + if (this.statusBar) { + cpt.statusBar.message(''); + } + if (this.loader) { + cpt.loader.show('none'); + } + } + + if (!this.loader && !this.statusBar && !this.linkedFilters) { + efx.call(this); + } else { + if (this.loader) { + cpt.loader.show(''); + } + if (this.statusBar) { + cpt.statusBar.message(this['msg' + evt]); + } + global.setTimeout(efx.bind(this), this.execDelay); + } + } + + /** + * Return a feature instance for a given name + * @param {String} name Name of the feature + * @return {Object} + */ + + }, { + key: 'feature', + value: function feature(name) { + return this.Mod[name]; + } + + /** + * Initialise all the extensions defined in the configuration object + */ + + }, { + key: 'initExtensions', + value: function initExtensions() { + var exts = this.extensions; + + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + if (!this.ExtRegistry[ext.name]) { + this.loadExtension(ext); + } + } + } + + /** + * Load an extension module + * @param {Object} ext Extension config object + */ + + }, { + key: 'loadExtension', + value: function loadExtension(ext) { + var _this3 = this; + + if (!ext || !ext.name) { + return; + } + + var name = ext.name; + var path = ext.path; + var modulePath = undefined; + + if (name && path) { + modulePath = ext.path + name; + } else { + name = name.replace('.js', ''); + modulePath = 'extensions/{}/{}'.replace(/{}/g, name); + } + + // Trick to set config's publicPath dynamically for Webpack... + __webpack_require__.p = this.basePath; + + __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) { + var inst = new mod.default(_this3, ext); + inst.init(); + _this3.ExtRegistry[name] = inst; + }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}); + } + + /** + * Get an extension instance + * @param {String} name Name of the extension + * @return {Object} Extension instance + */ + + }, { + key: 'extension', + value: function extension(name) { + return this.ExtRegistry[name]; + } + + /** + * Check passed extension name exists + * @param {String} name Name of the extension + * @return {Boolean} + */ + + }, { + key: 'hasExtension', + value: function hasExtension(name) { + return !_types2.default.isEmpty(this.ExtRegistry[name]); + } + + /** + * Destroy all the extensions defined in the configuration object + */ + + }, { + key: 'destroyExtensions', + value: function destroyExtensions() { + var exts = this.extensions; + + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + var extInstance = this.ExtRegistry[ext.name]; + if (extInstance) { + extInstance.destroy(); + this.ExtRegistry[ext.name] = null; + } + } + } + }, { + key: 'loadThemes', + value: function loadThemes() { + this.EvtManager(this.Evt.name.loadthemes); + } + + /** + * Load themes defined in the configuration object + */ + + }, { + key: '_loadThemes', + value: function _loadThemes() { + var themes = this.themes; + //Default theme config + if (this.enableDefaultTheme) { + var defaultTheme = { name: 'default' }; + this.themes.push(defaultTheme); + } + if (_types2.default.isArray(themes)) { + for (var i = 0, len = themes.length; i < len; i++) { + var theme = themes[i]; + var name = theme.name; + var path = theme.path; + var styleId = this.prfxTf + name; + if (name && !path) { + path = this.themesPath + name + '/' + name + '.css'; + } else if (!name && theme.path) { + name = 'theme{0}'.replace('{0}', i); + } + + if (!this.isImported(path, 'link')) { + this.import(styleId, path, null, 'link'); + } + } + } + + //Some elements need to be overriden for default 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; + } + + /** + * Return stylesheet DOM element for a given theme name + * @return {DOMElement} stylesheet element + */ + + }, { + key: 'getStylesheet', + value: function getStylesheet() { + var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; + + return _dom2.default.id(this.prfxTf + name); + } + + /** + * Destroy filter grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + if (!this._hasGrid) { + return; + } + var rows = this.tbl.rows, + Mod = this.Mod; + + this._clearFilters(); + + if (this.isExternalFlt && !this.popupFilters) { + this.removeExternalFlts(); + } + if (this.infDiv) { + this.removeToolbar(); + } + if (this.highlightKeywords) { + Mod.highlightKeyword.unhighlightAll(); + } + if (this.markActiveColumns) { + this.clearActiveColumns(); + this.emitter.off('before-filtering', function () { + return _this4.clearActiveColumns(); + }); + } + if (this.hasExtensions) { + this.destroyExtensions(); + } + + for (var j = this.refRow; j < this.nbRows; j++) { + // validate row + this.validateRow(j, true); + + //removes alternating colors + if (this.alternateRows) { + Mod.alternateRows.removeRowBg(j); + } + } //for j + + if (this.fltGrid && !this.gridLayout) { + this.fltGridEl = rows[this.filtersRowIndex]; + this.tbl.deleteRow(this.filtersRowIndex); + } + + // Destroy modules + Object.keys(Mod).forEach(function (key) { + var feature = Mod[key]; + if (feature && _types2.default.isFn(feature.destroy)) { + feature.destroy(); + } + }); + + // unsubscribe to events + if (this.hasVisibleRows) { + this.emitter.off('after-filtering', function () { + return _this4.enforceVisibility(); + }); + } + if (this.linkedFilters) { + this.emitter.off('after-filtering', function () { + return _this4.linkFilters(); + }); + } + + _dom2.default.removeClass(this.tbl, this.prfxTf); + this.nbHiddenRows = 0; + this.validRowsIndex = null; + this.activeFlt = null; + this._hasGrid = false; + this.tbl = null; + } + + /** + * Generate container element for paging, reset button, rows counter etc. + */ + + }, { + key: 'setToolbar', + value: function setToolbar() { + if (this.infDiv) { + return; + } + + /*** container div ***/ + var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); + infdiv.className = this.infDivCssClass; + + //custom container + if (this.toolBarTgtId) { + _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); + } + //grid-layout + else if (this.gridLayout) { + var gridLayout = this.Mod.gridLayout; + gridLayout.tblMainCont.appendChild(infdiv); + infdiv.className = gridLayout.gridInfDivCssClass; + } + //default location: just above the table + else { + var cont = _dom2.default.create('caption'); + cont.appendChild(infdiv); + this.tbl.insertBefore(cont, this.tbl.firstChild); + } + this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); + + /*** left div containing rows # displayer ***/ + var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); + ldiv.className = this.lDivCssClass; + infdiv.appendChild(ldiv); + this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); + + /*** right div containing reset button + + nb results per page select ***/ + var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); + rdiv.className = this.rDivCssClass; + infdiv.appendChild(rdiv); + this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); + + /*** mid div containing paging elements ***/ + var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); + mdiv.className = this.mDivCssClass; + infdiv.appendChild(mdiv); + this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); + + // Enable help instructions by default if topbar is generated and not + // explicitely set to false + if (_types2.default.isUndef(this.help)) { + if (!this.Mod.help) { + this.Mod.help = new _help.Help(this); + } + this.Mod.help.init(); + this.help = true; + } + } + + /** + * Remove toolbar container element + */ + + }, { + key: 'removeToolbar', + value: function removeToolbar() { + if (!this.infDiv) { + return; + } + _dom2.default.remove(this.infDiv); + this.infDiv = null; + + var tbl = this.tbl; + var captions = _dom2.default.tag(tbl, 'caption'); + if (captions.length > 0) { + [].forEach.call(captions, function (elm) { + tbl.removeChild(elm); + }); + } + } + + /** + * Remove all the external column filters + */ + + }, { + key: 'removeExternalFlts', + value: function removeExternalFlts() { + if (!this.isExternalFlt || !this.externalFltTgtIds) { + return; + } + var ids = this.externalFltTgtIds, + len = ids.length; + for (var ct = 0; ct < len; ct++) { + var externalFltTgtId = ids[ct], + externalFlt = _dom2.default.id(externalFltTgtId); + if (externalFlt) { + externalFlt.innerHTML = ''; + } + } + } + + /** + * Check if given column implements a filter with custom options + * @param {Number} colIndex Column's index + * @return {Boolean} + */ + + }, { + key: 'isCustomOptions', + value: function isCustomOptions(colIndex) { + return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; + } + + /** + * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the + * custom options values and texts + * @param {Number} colIndex Column's index + * @return {Array} + */ + + }, { + key: 'getCustomOptions', + value: function getCustomOptions(colIndex) { + if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { + return; + } + + var customOptions = this.customOptions; + var cols = customOptions.cols; + var optTxt = [], + optArray = []; + var index = cols.indexOf(colIndex); + var slcValues = customOptions.values[index]; + var slcTexts = customOptions.texts[index]; + var slcSort = customOptions.sorts[index]; + + for (var r = 0, len = slcValues.length; r < len; r++) { + optArray.push(slcValues[r]); + if (slcTexts[r]) { + optTxt.push(slcTexts[r]); + } else { + optTxt.push(slcValues[r]); + } + } + if (slcSort) { + optArray.sort(); + optTxt.sort(); + } + return [optArray, optTxt]; + } + }, { + key: 'resetValues', + value: function resetValues() { + this.EvtManager(this.Evt.name.resetvalues); + } + + /** + * Reset persisted filter values + */ + + }, { + key: '_resetValues', + value: function _resetValues() { + //only loadFltOnDemand + if (this.rememberGridValues && this.loadFltOnDemand) { + this._resetGridValues(this.fltsValuesCookie); + } + if (this.rememberPageLen && this.Mod.paging) { + this.Mod.paging.resetPageLength(this.pgLenCookie); + } + if (this.rememberPageNb && this.Mod.paging) { + this.Mod.paging.resetPage(this.pgNbCookie); + } + } + + /** + * Reset persisted filter values when load filters on demand feature is + * enabled + * @param {String} name cookie name storing filter values + */ + + }, { + key: '_resetGridValues', + value: function _resetGridValues(name) { + if (!this.loadFltOnDemand) { + return; + } + var fltsValues = this.Mod.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 = undefined, + opt = undefined; + var fltType = this.getFilterType(i); + // if loadFltOnDemand, drop-down needs to contain stored + // value(s) for filtering + if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { + var slc = _dom2.default.id(this.fltIds[i]); + slc.options[0].selected = false; + + //selects + if (slcFltsIndex.indexOf(i) != -1) { + opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + //multiple select + if (multiFltsIndex.indexOf(i) != -1) { + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + opt = _dom2.default.createOpt(s[j], s[j], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + } // if multiFltsIndex + } else if (fltType === this.fltTypeCheckList) { + var checkList = this.Mod.checkList; + var divChk = checkList.checkListDiv[i]; + divChk.title = divChk.innerHTML; + divChk.innerHTML = ''; + + var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); + ul.className = checkList.checkListCssClass; + + var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); + li0.className = checkList.checkListItemCssClass; + ul.appendChild(li0); + + divChk.appendChild(ul); + + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + var li = _dom2.default.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.Mod.paging.setPagingInfo(); + } + } //end if + } + }, { + key: 'filter', + value: function filter() { + this.EvtManager(this.Evt.name.filter); + } + + /** + * Filter the table by retrieving the data from each cell in every single + * row and comparing it to the search term for current column. A row is + * hidden when all the search terms are not found in inspected row. + * + * TODO: Reduce complexity of this massive method + */ + + }, { + key: '_filter', + value: function _filter() { + if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { + return; + } + //invoke onbefore callback + if (this.onBeforeFilter) { + this.onBeforeFilter.call(null, this); + } + this.emitter.emit('before-filtering', this); + + var row = this.tbl.rows, + Mod = this.Mod, + hiddenrows = 0; + + this.validRowsIndex = []; + // search args re-init + this.searchArgs = this.getFiltersValue(); + + var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); + + //keyword highlighting + function highlight(str, ok, cell) { + /*jshint validthis:true */ + if (this.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 = _dom2.default.getText(cell); + } + if (w !== '') { + Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); + } + } + } + + //looks for search argument in current row + function hasArg(sA, cellData, j) { + /*jshint validthis:true */ + var occurence = undefined, + removeNbFormat = _helpers2.default.removeNbFormat; + + //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); + var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); + var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); + var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); + var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); + var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); + + var dte1 = undefined, + dte2 = undefined; + //dates + if (_date2.default.isValid(cellData, dtType)) { + dte1 = _date2.default.format(cellData, dtType); + // lower date + if (isLDate) { + dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); + occurence = dte1 < dte2; + } + // lower equal date + else if (isLEDate) { + dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); + occurence = dte1 <= dte2; + } + // greater equal date + else if (isGEDate) { + dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); + occurence = dte1 >= dte2; + } + // greater date + else if (isGDate) { + dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); + occurence = dte1 > dte2; + } + // different date + else if (isDFDate) { + dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); + occurence = dte1.toString() != dte2.toString(); + } + // equal date + else if (isEQDate) { + dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } else if (_date2.default.isValid(sA, dtType)) { + dte2 = _date2.default.format(sA, dtType); + occurence = dte1.toString() === dte2.toString(); + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } else { + //first numbers need to be formated + if (this.hasColNbFormat && this.colNbFormat[j]) { + numCellData = removeNbFormat(cellData, this.colNbFormat[j]); + nbFormat = this.colNbFormat[j]; + } else { + if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { + numCellData = removeNbFormat(cellData, 'us'); + nbFormat = 'us'; + } else { + numCellData = removeNbFormat(cellData, 'eu'); + nbFormat = 'eu'; + } + } + + // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, + // rgx:) + // lower equal + if (hasLE) { + occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); + } + //greater equal + else if (hasGE) { + occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); + } + //lower + else if (hasLO) { + occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); + } + //greater + else if (hasGR) { + occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); + } + //different + else if (hasDF) { + occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; + } + //like + else if (hasLK) { + occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } + //equal + else if (hasEQ) { + occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); + } + //starts with + else if (hasST) { + occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; + } + //ends with + else if (hasEN) { + var searchArg = sA.replace(re_en, ''); + occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } + //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(cellData); + } catch (e) { + occurence = false; + } + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } //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 = true, + + //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]; + var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; + if (sA === '') { + continue; + } + + var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); + + //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 = undefined, + occur = false, + s = hasMultiOrSA ? sAOrSplit : sAAndSplit; + for (var w = 0, len = s.length; w < len; w++) { + cS = _string2.default.trim(s[w]); + occur = hasArg.call(this, cS, cellData, j); + highlight.call(this, cS, occur, cell[j]); + if (hasMultiOrSA && occur) { + break; + } + if (hasMultiAndSA && !occur) { + break; + } + } + occurence[j] = occur; + } + //single search parameter + else { + occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); + highlight.call(this, sA, occurence[j], cell[j]); + } //else single param + + if (!occurence[j]) { + isRowValid = false; + } + if (this.singleSearchFlt && occurence[j]) { + singleFltRowValid = true; + } + if (this.popupFilters) { + Mod.popupFilter.buildIcon(j, true); + } + if (this.markActiveColumns) { + if (k === this.refRow) { + if (this.onBeforeActiveColumn) { + this.onBeforeActiveColumn.call(null, this, j); + } + _dom2.default.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); + // if(Mod.alternateRows){ + // Mod.alternateRows.removeRowBg(k); + // } + // always visible rows need to be counted as valid + if (this.hasVisibleRows && this.visibleRows.indexOf(k) !== -1) { + this.validRowsIndex.push(k); + } else { + hiddenrows++; + } + } else { + this.validateRow(k, true); + this.validRowsIndex.push(k); + // if(this.alternateRows){ + // Mod.alternateRows.setRowBg(k, this.validRowsIndex.length); + // } + if (this.onRowValidated) { + this.onRowValidated.call(null, this, k); + } + this.emitter.emit('row-validated', this, k); + } + this.emitter.emit('row-processed', this, k, isRowValid); + } // for k + + this.nbVisibleRows = this.validRowsIndex.length; + this.nbHiddenRows = hiddenrows; + + //invokes onafterfilter callback + if (this.onAfterFilter) { + this.onAfterFilter.call(null, this); + } + + this.emitter.emit('after-filtering', this); + } + + /** + * Return the data of a specified colum + * @param {Number} colIndex Column index + * @param {Boolean} includeHeaders Optional: include headers row + * @param {Boolean} num Optional: return unformatted number + * @param {Array} exclude Optional: list of row indexes to be excluded + * @return {Array} Flat list of data for a column + */ + + }, { + key: 'getColValues', + value: function getColValues(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; + + if (!this.fltGrid) { + return; + } + var row = this.tbl.rows, + colValues = []; + + if (includeHeaders) { + colValues.push(this.getHeadersText()[colIndex]); + } + + for (var i = this.refRow; i < this.nbRows; i++) { + var isExludedRow = false; + // checks if current row index appears in exclude array + if (exclude.length > 0) { + isExludedRow = exclude.indexOf(i) != -1; + } + 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 !== '') { + continue; + } + var cellData = this.getCellData(cell[j]), + nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, + data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; + colValues.push(data); + } + } + } + return colValues; + } + + /** + * Return the filter's value of a specified column + * @param {Number} index Column index + * @return {String} Filter value + */ + + }, { + key: 'getFilterValue', + value: function getFilterValue(index) { + if (!this.fltGrid) { + return; + } + var fltValue = undefined, + flt = this.getFilterElement(index); + if (!flt) { + return ''; + } + + var fltColType = this.getFilterType(index); + if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { + fltValue = flt.value; + } + //mutiple select + else if (fltColType === this.fltTypeMulti) { + fltValue = ''; + for (var j = 0, len = flt.options.length; j < len; 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; + } + + /** + * Return the filters' values + * @return {Array} List of filters' values + */ + + }, { + key: 'getFiltersValue', + value: function getFiltersValue() { + if (!this.fltGrid) { + return; + } + var searchArgs = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); + } + return searchArgs; + } + + /** + * Return the ID of the filter of a specified column + * @param {Number} index Column's index + * @return {String} ID of the filter element + */ + + }, { + key: 'getFilterId', + value: function getFilterId(index) { + if (!this.fltGrid) { + return; + } + return this.fltIds[index]; + } + + /** + * Return the list of ids of filters matching a specified type. + * Note: hidden filters are also returned + * + * @param {String} type Filter type string ('input', 'select', 'multiple', + * 'checklist') + * @param {Boolean} bool If true returns columns indexes instead of IDs + * @return {[type]} List of element IDs or column indexes + */ + + }, { + key: 'getFiltersByType', + value: function getFiltersByType(type, bool) { + if (!this.fltGrid) { + return; + } + var arr = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + var fltType = this.getFilterType(i); + if (fltType === _string2.default.lower(type)) { + var a = bool ? i : this.fltIds[i]; + arr.push(a); + } + } + return arr; + } + + /** + * Return the filter's DOM element for a given column + * @param {Number} index Column's index + * @return {DOMElement} + */ + + }, { + key: 'getFilterElement', + value: function getFilterElement(index) { + var fltId = this.fltIds[index]; + return _dom2.default.id(fltId); + } + + /** + * Return the number of cells for a given row index + * @param {Number} rowIndex Index of the row + * @return {Number} Number of cells + */ + + }, { + key: 'getCellsNb', + value: function getCellsNb() { + var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; + + var tr = this.tbl.rows[rowIndex]; + return tr.cells.length; + } + + /** + * Return the number of filterable rows starting from reference row if + * defined + * @param {Boolean} includeHeaders Include the headers row + * @return {Number} Number of filterable rows + */ + + }, { + key: 'getRowsNb', + value: function getRowsNb(includeHeaders) { + var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, + ntrs = this.tbl.rows.length; + if (includeHeaders) { + s = 0; + } + return parseInt(ntrs - s, 10); + } + + /** + * Return the data of a given cell + * @param {DOMElement} cell Cell's DOM object + * @return {String} + */ + + }, { + key: 'getCellData', + value: function getCellData(cell) { + var idx = cell.cellIndex; + //Check for customCellData callback + if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { + return this.customCellData.call(null, this, cell, idx); + } else { + return _dom2.default.getText(cell); + } + } + + /** + * Return the table data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getTableData', + value: function getTableData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var rows = this.tbl.rows; + var tblData = []; + if (includeHeaders) { + tblData.push([this.getHeadersRowIndex(), this.getHeadersText()]); + } + for (var k = this.refRow; k < this.nbRows; k++) { + var rowData = [k, []]; + var cells = rows[k].cells; + for (var j = 0, len = cells.length; j < len; j++) { + var cellData = this.getCellData(cells[j]); + rowData[1].push(cellData); + } + tblData.push(rowData); + } + return tblData; + } + + /** + * Return the filtered data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredData', + value: function getFilteredData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + if (!this.validRowsIndex) { + return []; + } + var rows = this.tbl.rows, + filteredData = []; + if (includeHeaders) { + filteredData.push([this.getHeadersRowIndex(), this.getHeadersText()]); + } + + var validRows = this.getValidRows(true); + for (var i = 0; i < validRows.length; i++) { + var rData = [this.validRowsIndex[i], []], + cells = rows[this.validRowsIndex[i]].cells; + for (var k = 0; k < cells.length; k++) { + var cellData = this.getCellData(cells[k]); + rData[1].push(cellData); + } + filteredData.push(rData); + } + return filteredData; + } + + /** + * Return the filtered data for a given column index + * @param {Number} colIndex Colmun's index + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} Flat list of values ['val0','val1','val2'...] + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredDataCol', + value: function getFilteredDataCol(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + + if (_types2.default.isUndef(colIndex)) { + return []; + } + var data = this.getFilteredData(), + colData = []; + if (includeHeaders) { + colData.push(this.getHeadersText()[colIndex]); + } + for (var i = 0, len = data.length; i < len; 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; + } + + /** + * Get the display value of a row + * @param {RowElement} DOM element of the row + * @return {String} Usually 'none' or '' + */ + + }, { + key: 'getRowDisplay', + value: function getRowDisplay(row) { + if (!_types2.default.isObj(row)) { + return null; + } + return row.style.display; + } + + /** + * Validate/invalidate row by setting the 'validRow' attribute on the row + * @param {Number} rowIndex Index of the row + * @param {Boolean} isValid + */ + + }, { + key: 'validateRow', + value: function validateRow(rowIndex, isValid) { + var row = this.tbl.rows[rowIndex]; + if (!row || typeof isValid !== 'boolean') { + return; + } + + // always visible rows are valid + if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { + isValid = true; + } + + var displayFlag = isValid ? '' : 'none', + validFlag = isValid ? 'true' : 'false'; + row.style.display = displayFlag; + + if (this.paging) { + row.setAttribute('validRow', validFlag); + } + } + + /** + * Validate all filterable rows + */ + + }, { + key: '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); + } + } + + /** + * Set search value to a given filter + * @param {Number} index Column's index + * @param {String} searcharg Search term + */ + + }, { + key: 'setFilterValue', + value: function setFilterValue(index) { + var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; + + if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { + return; + } + var slc = this.getFilterElement(index), + fltColType = this.getFilterType(index); + + if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { + slc.value = searcharg; + } + //multiple selects + else if (fltColType === this.fltTypeMulti) { + var s = searcharg.split(' ' + this.orOperator + ' '); + // let ct = 0; //keywords counter + for (var j = 0, len = slc.options.length; j < len; j++) { + var option = slc.options[j]; + if (s === '' || s[0] === '') { + option.selected = false; + } + if (option.value === '') { + option.selected = false; + } + if (option.value !== '' && _array2.default.has(s, option.value, true)) { + option.selected = true; + } //if + } //for j + } + //checklist + else if (fltColType === this.fltTypeCheckList) { + searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); + var sarg = searcharg.split(' ' + this.orOperator + ' '); + var lisNb = _dom2.default.tag(slc, 'li').length; + + slc.setAttribute('value', ''); + slc.setAttribute('indexes', ''); + + for (var k = 0; k < lisNb; k++) { + var li = _dom2.default.tag(slc, 'li')[k], + lbl = _dom2.default.tag(li, 'label')[0], + chk = _dom2.default.tag(li, 'input')[0], + lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); + if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { + chk.checked = true; + this.Mod.checkList.setCheckListValues(chk); + } else { + chk.checked = false; + this.Mod.checkList.setCheckListValues(chk); + } + } + } + } + + /** + * Set them columns' widths as per configuration + * @param {Number} rowIndex Optional row index to apply the widths to + * @param {Element} tbl DOM element + */ + + }, { + key: 'setColWidths', + value: function setColWidths(rowIndex, tbl) { + if (!this.fltGrid || !this.hasColWidths) { + return; + } + tbl = tbl || this.tbl; + var rIndex = undefined; + if (rowIndex === undefined) { + rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; + } else { + rIndex = rowIndex; + } + + setWidths.call(this); + + function setWidths() { + /*jshint validthis:true */ + var nbCols = this.nbCells; + var colWidths = this.colWidths; + var colTags = _dom2.default.tag(tbl, 'col'); + var tblHasColTag = colTags.length > 0; + var frag = !tblHasColTag ? doc.createDocumentFragment() : null; + for (var k = 0; k < nbCols; k++) { + var col = undefined; + if (tblHasColTag) { + col = colTags[k]; + } else { + col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); + frag.appendChild(col); + } + col.style.width = colWidths[k]; + } + if (!tblHasColTag) { + tbl.insertBefore(frag, tbl.firstChild); + } + } + } + + /** + * Makes defined rows always visible + */ + + }, { + key: 'enforceVisibility', + value: function enforceVisibility() { + if (!this.hasVisibleRows) { + return; + } + for (var i = 0, len = this.visibleRows.length; i < len; i++) { + var row = this.visibleRows[i]; + //row index cannot be > nrows + if (row <= this.nbRows) { + this.validateRow(row, true); + } + } + } + }, { + key: 'clearFilters', + value: function clearFilters() { + this.EvtManager(this.Evt.name.clear); + } + + /** + * Clear all the filters' values + */ + + }, { + key: '_clearFilters', + value: function _clearFilters() { + if (!this.fltGrid) { + return; + } + if (this.onBeforeReset) { + this.onBeforeReset.call(null, this, this.getFiltersValue()); + } + for (var i = 0, len = this.fltIds.length; i < len; i++) { + this.setFilterValue(i, ''); + } + // if(this.linkedFilters){ + // this.linkFilters(); + // } + if (this.rememberPageLen) { + _cookie2.default.remove(this.pgLenCookie); + } + if (this.rememberPageNb) { + _cookie2.default.remove(this.pgNbCookie); + } + if (this.onAfterReset) { + this.onAfterReset.call(null, this); + } + + this.emitter.emit('cleared-filters', this); + } + + /** + * Clears filtered columns visual indicator (background color) + */ + + }, { + key: 'clearActiveColumns', + value: function clearActiveColumns() { + for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { + _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); + } + } + + /** + * Refresh the filters subject to linking ('select', 'multiple', + * 'checklist' type) + */ + + }, { + key: 'linkFilters', + value: function linkFilters() { + if (!this.linkedFilters || !this.activeFilterId) { + return; + } + 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); + + var activeFlt = this.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(this.prfxFlt)[1]; + var slcSelectedValue = undefined; + for (var i = 0, len = slcIndex.length; i < len; i++) { + var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); + slcSelectedValue = this.getFilterValue(slcIndex[i]); + + // Welcome to cyclomatic complexity hell :) + // TODO: simplify/refactor if statement + if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; + } else { + curSlc.innerHTML = ''; + } + + //1st option needs to be inserted + if (this.loadFltOnDemand) { + var opt0 = _dom2.default.createOpt(this.displayAllText, ''); + if (curSlc) { + curSlc.appendChild(opt0); + } + } + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList._build(slcIndex[i]); + } else { + this.Mod.dropdown._build(slcIndex[i], true); + } + + this.setFilterValue(slcIndex[i], slcSelectedValue); + } + } // for i + } + + /** + * Re-generate the filters grid bar when previously removed + */ + + }, { + key: '_resetGrid', + value: function _resetGrid() { + if (this.isFirstLoad) { + return; + } + + var Mod = this.Mod; + var tbl = this.tbl; + var rows = tbl.rows; + var filtersRowIndex = this.filtersRowIndex; + var filtersRow = rows[filtersRowIndex]; + + // grid was removed, grid row element is stored in fltGridEl property + if (!this.gridLayout) { + // If table has a thead ensure the filters row is appended in the + // thead element + if (tbl.tHead) { + var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); + tbl.tHead.replaceChild(this.fltGridEl, tempRow); + } else { + filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); + } + } + + // filters are appended in external placeholders elements + if (this.isExternalFlt) { + var externalFltTgtIds = this.externalFltTgtIds; + for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { + var extFlt = _dom2.default.id(externalFltTgtIds[ct]); + + if (!extFlt) { + continue; + } + + var externalFltEl = this.externalFltEls[ct]; + extFlt.appendChild(externalFltEl); + var colFltType = this.getFilterType(ct); + //IE special treatment for gridLayout, appended filters are + //empty + if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { + if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { + Mod.dropdown.build(ct); + } + if (colFltType === this.fltTypeCheckList) { + Mod.checkList.build(ct); + } + } + } + } + + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = rows.length; + + if (this.popupFilters) { + this.headersRow++; + Mod.popupFilter.reset(); + } + + if (!this.gridLayout) { + _dom2.default.addClass(this.tbl, this.prfxTf); + } + this._hasGrid = true; + } + + /** + * Determines if passed filter column implements exact query match + * @param {Number} colIndex [description] + * @return {Boolean} [description] + */ + + }, { + key: 'isExactMatch', + value: function isExactMatch(colIndex) { + var fltType = this.getFilterType(colIndex); + return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; + } + + /** + * Check if passed script or stylesheet is already imported + * @param {String} filePath Ressource path + * @param {String} type Possible values: 'script' or 'link' + * @return {Boolean} + */ + + }, { + key: 'isImported', + value: function isImported(filePath, type) { + var imported = false, + importType = !type ? 'script' : type, + attr = importType == 'script' ? 'src' : 'href', + files = _dom2.default.tag(doc, importType); + for (var i = 0, len = files.length; i < len; i++) { + if (files[i][attr] === undefined) { + continue; + } + if (files[i][attr].match(filePath)) { + imported = true; + break; + } + } + return imported; + } + + /** + * Import script or stylesheet + * @param {String} fileId Ressource ID + * @param {String} filePath Ressource path + * @param {Function} callback Callback + * @param {String} type Possible values: 'script' or 'link' + */ + + }, { + key: 'import', + value: function _import(fileId, filePath, callback, type) { + var ftype = !type ? 'script' : type, + imported = this.isImported(filePath, ftype); + if (imported) { + return; + } + var o = this, + isLoaded = false, + file = undefined, + head = _dom2.default.tag(doc, 'head')[0]; + + if (_string2.default.lower(ftype) === 'link') { + file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); + } else { + file = _dom2.default.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: ' + filePath); + }; + head.appendChild(file); + } + + /** + * Check if table has filters grid + * @return {Boolean} + */ + + }, { + key: 'hasGrid', + value: function hasGrid() { + return this._hasGrid; + } + + /** + * Get list of filter IDs + * @return {[type]} [description] + */ + + }, { + key: 'getFiltersId', + value: function getFiltersId() { + return this.fltIds || []; + } + + /** + * Get filtered (valid) rows indexes + * @param {Boolean} reCalc Force calculation of filtered rows list + * @return {Array} List of row indexes + */ + + }, { + key: 'getValidRows', + value: function getValidRows(reCalc) { + 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; + } + + /** + * Get the index of the row containing the filters + * @return {Number} + */ + + }, { + key: 'getFiltersRowIndex', + value: function getFiltersRowIndex() { + return this.filtersRowIndex; + } + + /** + * Get the index of the headers row + * @return {Number} + */ + + }, { + key: 'getHeadersRowIndex', + value: function getHeadersRowIndex() { + return this.headersRow; + } + + /** + * Get the row index from where the filtering process start (1st filterable + * row) + * @return {Number} + */ + + }, { + key: 'getStartRowIndex', + value: function getStartRowIndex() { + return this.refRow; + } + + /** + * Get the index of the last row + * @return {Number} + */ + + }, { + key: 'getLastRowIndex', + value: function getLastRowIndex() { + if (!this._hasGrid) { + return; + } + return this.nbRows - 1; + } + + /** + * Get the header DOM element for a given column index + * @param {Number} colIndex Column index + * @return {Object} + */ + + }, { + key: 'getHeaderElement', + value: function getHeaderElement(colIndex) { + var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; + var tHead = _dom2.default.tag(table, 'thead'); + var headersRow = this.headersRow; + var header = undefined; + for (var i = 0; i < this.nbCells; i++) { + if (i !== colIndex) { + continue; + } + if (tHead.length === 0) { + header = table.rows[headersRow].cells[i]; + } + if (tHead.length === 1) { + header = tHead[0].rows[headersRow].cells[i]; + } + break; + } + return header; + } + + /** + * Return the list of headers' text + * @return {Array} list of headers' text + */ + + }, { + key: 'getHeadersText', + value: function getHeadersText() { + var headers = []; + for (var j = 0; j < this.nbCells; j++) { + var header = this.getHeaderElement(j); + var headerText = _dom2.default.getText(header); + headers.push(headerText); + } + return headers; + } + + /** + * Return the filter type for a specified column + * @param {Number} colIndex Column's index + * @return {String} + */ + + }, { + key: 'getFilterType', + value: function getFilterType(colIndex) { + var colType = this.cfg['col_' + colIndex]; + return !colType ? this.fltTypeInp : _string2.default.lower(colType); + } + + /** + * Get the total number of filterable rows + * @return {Number} + */ + + }, { + key: 'getFilterableRowsNb', + value: function getFilterableRowsNb() { + return this.getRowsNb(false); + } + + /** + * Get the configuration object (literal object) + * @return {Object} + */ + + }, { + key: 'config', + value: function config() { + return this.cfg; + } + }]); + + return TableFilter; + })(); + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * DOM event utilities + */ + + exports.default = { + 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; + } + }, + target: function target(evt) { + return evt && evt.target || window.event && window.event.srcElement; + }, + keyCode: function keyCode(evt) { + return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; + } + }; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * DOM utilities + */ + + exports.default = { + + /** + * Returns text + text of children of given node + * @param {NodeElement} node + * @return {String} + */ + + getText: function getText(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 + */ + create: function create(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]); + } + } + } + return el; + }, + + /** + * Removes passed node from DOM + * @param {DOMElement} node + * @return {DOMElement} old node reference + */ + remove: function remove(node) { + return node.parentNode.removeChild(node); + }, + + /** + * Returns a text node with given text + * @param {String} txt + * @return {Object} + */ + text: function text(txt) { + return document.createTextNode(txt); + }, + hasClass: function hasClass(ele, cls) { + if (!ele) { + return false; + } + + if (supportsClassList()) { + return ele.classList.contains(cls); + } + return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); + }, + addClass: function addClass(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; + } + }, + removeClass: function removeClass(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 + */ + createOpt: function createOpt(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 + */ + createCheckItem: function createCheckItem(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; + }, + id: function id(key) { + return document.getElementById(key); + }, + tag: function tag(o, tagname) { + return o.getElementsByTagName(tagname); + } + }; + + // HTML5 classList API + + function supportsClassList() { + return document.documentElement.classList; + } + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * String utilities + */ + + exports.default = { + lower: function lower(text) { + return text.toLowerCase(); + }, + upper: function upper(text) { + return text.toUpperCase(); + }, + trim: function trim(text) { + if (text.trim) { + return text.trim(); + } + return text.replace(/^\s*|\s*$/g, ''); + }, + isEmpty: function isEmpty(text) { + return this.trim(text) === ''; + }, + rgxEsc: function rgxEsc(text) { + var chars = /[-\/\\^$*+?.()|[\]{}]/g; + var escMatch = '\\$&'; + return String(text).replace(chars, escMatch); + }, + matchCase: function matchCase(text, caseSensitive) { + if (!caseSensitive) { + return this.lower(text); + } + return text; + }, + + /** + * Checks if passed data contains the searched term + * @param {String} term Searched term + * @param {String} data Data string + * @param {Boolean} exactMatch Exact match + * @param {Boolean} caseSensitive Case sensitive + * @return {Boolean} + */ + contains: function contains(term, data) { + var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; + + // Improved by Cedric Wartel (cwl) automatic exact match for selects and + // special characters are now filtered + var regexp = undefined, + modifier = caseSensitive ? 'g' : 'gi'; + if (exactMatch) { + regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); + } else { + regexp = new RegExp(this.rgxEsc(term), modifier); + } + return regexp.test(data); + } + }; + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Cookie utilities + */ + + exports.default = { + write: function write(name, value, hours) { + var expire = ''; + if (hours) { + expire = new Date(new Date().getTime() + hours * 3600000); + expire = '; expires=' + expire.toGMTString(); + } + document.cookie = name + '=' + escape(value) + expire; + }, + read: function read(name) { + var cookieValue = '', + search = name + '='; + if (document.cookie.length > 0) { + var cookie = document.cookie, + offset = cookie.indexOf(search); + if (offset !== -1) { + offset += search.length; + var end = cookie.indexOf(';', offset); + if (end === -1) { + end = cookie.length; + } + cookieValue = unescape(cookie.substring(offset, end)); + } + } + return cookieValue; + }, + remove: function remove(name) { + this.write(name, '', -1); + }, + valueToArray: function valueToArray(name, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.read(name); + //creates an array with filters' values + var arr = val.split(separator); + return arr; + }, + getValueByIndex: function getValueByIndex(name, index, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.valueToArray(name, separator); + return val[index]; + } + }; + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * Types utilities + */ + + var UNDEFINED = void 0; + + exports.default = { + /** + * Check if argument is an object or a global object + * @param {String or Object} v + * @return {Boolean} + */ + + isObj: function isObj(v) { + var isO = false; + if (typeof v === 'string') { + if (window[v] && _typeof(window[v]) === 'object') { + isO = true; + } + } else { + if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { + isO = true; + } + } + return isO; + }, + + /** + * Check if argument is a function + * @param {Function} fn + * @return {Boolean} + */ + isFn: function isFn(fn) { + return fn && fn.constructor == Function; + }, + + /** + * Check if argument is an array + * @param {Array} obj + * @return {Boolean} + */ + isArray: function isArray(obj) { + return obj && obj.constructor == Array; + }, + + /** + * Determine if argument is undefined + * @param {Any} o + * @return {Boolean} + */ + isUndef: function isUndef(o) { + return o === UNDEFINED; + }, + + /** + * Determine if argument is null + * @param {Any} o + * @return {Boolean} + */ + isNull: function isNull(o) { + return o === null; + }, + + /** + * Determine if argument is empty (undefined, null or empty string) + * @param {Any} o + * @return {Boolean} + */ + isEmpty: function isEmpty(o) { + return this.isUndef(o) || this.isNull(o) || o.length === 0; + } + }; + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + has: function has(arr, val, caseSensitive) { + var sCase = caseSensitive === undefined ? false : caseSensitive; + for (var i = 0; i < arr.length; i++) { + if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { + return true; + } + } + return false; + } + }; /** + * Array utilities + */ + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Date utilities + */ + + exports.default = { + 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 = undefined, + reg2 = undefined; + // 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 = undefined, + dd = undefined, + yy = undefined; + // 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(dateStr, formatStr) { + if (!formatStr) { + formatStr = 'DMY'; + } + if (!dateStr || dateStr === '') { + return new Date(1001, 0, 1); + } + var oDate = undefined; + var parts = undefined; + + switch (formatStr.toUpperCase()) { + case 'DDMMMYYYY': + parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); + oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); + break; + case 'DMY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'MDY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'YMD': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + default: + //in case format is not correct + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + } + return oDate; + } + }; + + function y2kDate(yr) { + if (yr === undefined) { + return 0; + } + if (yr.length > 2) { + return yr; + } + var y = undefined; + //>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; + } + + function mmm2mm(mmm) { + if (mmm === undefined) { + return 0; + } + var mondigit = undefined; + 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; + } + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + removeNbFormat: function removeNbFormat(data, format) { + if (!data) { + return; + } + if (!format) { + format = 'us'; + } + var n = data; + if (_string2.default.lower(format) === 'us') { + n = +n.replace(/[^\d\.-]/g, ''); + } else { + n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); + } + return n; + } + }; /** + * Misc helpers + */ + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + "use strict"; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Event emitter class + */ + + var Emitter = exports.Emitter = (function () { + function Emitter() { + _classCallCheck(this, Emitter); + + /** + * Events object + * @type {Object} + */ + this.events = {}; + } + + /** + * Subscribe to an event + * @param {String} evt Event name + * @param {Function} fn Function invoked when event is emitted + */ + + _createClass(Emitter, [{ + key: "on", + value: function on(evt, fn) { + this.events[evt] = this.events[evt] || []; + this.events[evt].push(fn); + } + + /** + * Unsubscribe to an event + * @param {String} evt Event name + * @param {Function} fn Function invoked when event is emitted + */ + + }, { + key: "off", + value: function off(evt, fn) { + if (evt in this.events) { + this.events[evt].splice(this.events[evt].indexOf(fn), 1); + } + } + + /** + * Emit an event + * @param {String} evt Event name followed by any other argument passed to + * the invoked function + */ + + }, { + key: "emit", + value: function emit(evt /*, args...*/) { + if (evt in this.events === false) { + return; + } + for (var i = 0; i < this.events[evt].length; i++) { + this.events[evt][i].apply(this, [].slice.call(arguments, 1)); + } + } + }]); + + return Emitter; + })(); + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Store = undefined; + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Store = exports.Store = (function () { + + /** + * Store, persistence manager + * @param {Object} tf TableFilter instance + * + * TODO: use localStorage and fallback to cookie persistence + */ + + function Store(tf) { + _classCallCheck(this, Store); + + var f = tf.config(); + + this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(Store, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on('after-filtering', function () { + return _this.saveFilterValues(_this.tf.fltsValuesCookie); + }); + } + + /** + * Store filters' values in cookie + * @param {String} cookie name + */ + + }, { + key: 'saveFilterValues', + value: function saveFilterValues(name) { + var tf = this.tf; + var fltValues = []; + //store filters' values + for (var i = 0; i < tf.fltIds.length; i++) { + var value = tf.getFilterValue(i); + if (value === '') { + value = ' '; + } + fltValues.push(value); + } + //adds array size + fltValues.push(tf.fltIds.length); + + //writes cookie + _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); + } + + /** + * Retrieve filters' values from cookie + * @param {String} cookie name + * @return {Array} + */ + + }, { + key: 'getFilterValues', + value: function getFilterValues(name) { + var flts = _cookie2.default.read(name); + var rgx = new RegExp(this.tf.separator, 'g'); + // filters' values array + return flts.split(rgx); + } + + /** + * Store page number in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageNb', + value: function savePageNb(name) { + _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); + } + + /** + * Retrieve page number from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageNb', + value: function getPageNb(name) { + return _cookie2.default.read(name); + } + + /** + * Store page length in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageLength', + value: function savePageLength(name) { + _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); + } + + /** + * Retrieve page length from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageLength', + value: function getPageLength(name) { + return _cookie2.default.read(name); + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off('after-filtering', function () { + return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); + }); + } + }]); + + return Store; + })(); + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.GridLayout = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var GridLayout = exports.GridLayout = (function (_Feature) { + _inherits(GridLayout, _Feature); + + /** + * Grid layout, table with fixed headers + * @param {Object} tf TableFilter instance + */ + + function GridLayout(tf) { + _classCallCheck(this, GridLayout); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); + + var f = _this.config; + + //defines grid width + _this.gridWidth = f.grid_width || null; + //defines grid height + _this.gridHeight = f.grid_height || null; + //defines css class for main container + _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; + //defines css class for div containing table + _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; + //defines css class for div containing headers' table + _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; + //defines css class for div containing rows counter, paging etc. + _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; + //defines which row contains column headers + _this.gridHeadRowIndex = f.grid_headers_row_index || 0; + //array of headers row indexes to be placed in header table + _this.gridHeadRows = f.grid_headers_rows || [0]; + //generate filters in table headers + _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; + //default col width + _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; + + _this.gridColElms = []; + + //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_'; + + _this.sourceTblHtml = tf.tbl.outerHTML; + return _this; + } + + /** + * Generates a grid with fixed headers + */ + + _createClass(GridLayout, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + var f = this.config; + var tbl = tf.tbl; + + if (this.initialized) { + return; + } + + tf.isExternalFlt = true; + + // default width of 100px if column widths not set + if (!tf.hasColWidths) { + tf.colWidths = []; + for (var k = 0; k < tf.nbCells; k++) { + var colW, + cell = tbl.rows[this.gridHeadRowIndex].cells[k]; + if (cell.width !== '') { + colW = cell.width; + } else if (cell.style.width !== '') { + colW = parseInt(cell.style.width, 10); + } else { + colW = this.gridDefaultColWidth; + } + tf.colWidths[k] = colW; + } + tf.hasColWidths = true; + } + tf.setColWidths(this.gridHeadRowIndex); + + var tblW; //initial table width + if (tbl.width !== '') { + tblW = tbl.width; + } else if (tbl.style.width !== '') { + tblW = parseInt(tbl.style.width, 10); + } else { + tblW = tbl.clientWidth; + } + + //Main container: it will contain all the elements + this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); + this.tblMainCont.className = this.gridMainContCssClass; + if (this.gridWidth) { + this.tblMainCont.style.width = this.gridWidth; + } + tbl.parentNode.insertBefore(this.tblMainCont, tbl); + + //Table container: div wrapping content table + this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); + this.tblCont.className = this.gridContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.tblCont.style.width = '100%'; + } else { + this.tblCont.style.width = this.gridWidth; + } + } + if (this.gridHeight) { + this.tblCont.style.height = this.gridHeight; + } + tbl.parentNode.insertBefore(this.tblCont, tbl); + var t = _dom2.default.remove(tbl); + this.tblCont.appendChild(t); + + //In case table width is expressed in % + if (tbl.style.width === '') { + tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; + } + + var d = _dom2.default.remove(this.tblCont); + this.tblMainCont.appendChild(d); + + //Headers table container: div wrapping headers table + this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); + this.headTblCont.className = this.gridHeadContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.headTblCont.style.width = '100%'; + } else { + this.headTblCont.style.width = this.gridWidth; + } + } + + //Headers table + this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); + var tH = _dom2.default.create('tHead'); + + //1st row should be headers row, ids are added if not set + //Those ids are used by the sort feature + var hRow = tbl.rows[this.gridHeadRowIndex]; + var sortTriggers = []; + for (var n = 0; n < tf.nbCells; n++) { + var c = hRow.cells[n]; + var thId = c.getAttribute('id'); + if (!thId || thId === '') { + thId = this.prfxGridTh + n + '_' + tf.id; + c.setAttribute('id', thId); + } + sortTriggers.push(thId); + } + + //Filters row is created + var filtersRow = _dom2.default.create('tr'); + if (this.gridEnableFilters && tf.fltGrid) { + tf.externalFltTgtIds = []; + for (var j = 0; j < tf.nbCells; j++) { + var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; + var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); + filtersRow.appendChild(cl); + tf.externalFltTgtIds[j] = fltTdId; + } + } + //Headers row are moved from content table to headers table + for (var i = 0; i < this.gridHeadRows.length; i++) { + var headRow = tbl.rows[this.gridHeadRows[0]]; + tH.appendChild(headRow); + } + this.headTbl.appendChild(tH); + if (tf.filtersRowIndex === 0) { + tH.insertBefore(filtersRow, hRow); + } else { + tH.appendChild(filtersRow); + } + + this.headTblCont.appendChild(this.headTbl); + this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); + + //THead needs to be removed in content table for sort feature + var thead = _dom2.default.tag(tbl, 'thead'); + if (thead.length > 0) { + tbl.removeChild(thead[0]); + } + + //Headers table style + this.headTbl.style.tableLayout = 'fixed'; + tbl.style.tableLayout = 'fixed'; + this.headTbl.cellPadding = tbl.cellPadding; + this.headTbl.cellSpacing = tbl.cellSpacing; + // this.headTbl.style.width = tbl.style.width; + + //content table without headers needs col widths to be reset + tf.setColWidths(0, this.headTbl); + + //Headers container width + // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; + + tbl.style.width = ''; + // + this.headTbl.style.width = tbl.clientWidth + 'px'; + // + + //scroll synchronisation + _event2.default.add(this.tblCont, 'scroll', function (evt) { + var elm = _event2.default.target(evt); + var scrollLeft = elm.scrollLeft; + _this2.headTblCont.scrollLeft = scrollLeft; + //New pointerX calc taking into account scrollLeft + // if(!o.isPointerXOverwritten){ + // try{ + // o.Evt.pointerX = function(evt){ + // var e = evt || global.event; + // var bdScrollLeft = tf_StandardBody().scrollLeft + + // scrollLeft; + // return (e.pageX + scrollLeft) || + // (e.clientX + bdScrollLeft); + // }; + // o.isPointerXOverwritten = true; + // } catch(err) { + // o.isPointerXOverwritten = false; + // } + // } + }); + + //Configure sort extension if any + var sort = (f.extensions || []).filter(function (itm) { + return itm.name === 'sort'; + }); + if (sort.length === 1) { + sort[0].async_sort = true; + sort[0].trigger_ids = sortTriggers; + } + + //Cols generation for all browsers excepted IE<=7 + this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; + + //Col elements are enough to keep column widths after sorting and + //filtering + var createColTags = function createColTags() { + for (var k = tf.nbCells - 1; k >= 0; k--) { + var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); + tbl.insertBefore(col, tbl.firstChild); + col.style.width = tf.colWidths[k]; + this.gridColElms[k] = col; + } + this.tblHasColTag = true; + }; + + if (!this.tblHasColTag) { + createColTags.call(this); + } else { + var cols = _dom2.default.tag(tbl, 'col'); + for (var ii = 0; ii < tf.nbCells; ii++) { + cols[ii].setAttribute('id', tf.id + '_col_' + ii); + cols[ii].style.width = tf.colWidths[ii]; + this.gridColElms.push(cols[ii]); + } + } + + var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; + f.on_after_col_resized = function (o, colIndex) { + if (!colIndex) { + return; + } + var w = o.crWColsRow.cells[colIndex].style.width; + var col = o.gridColElms[colIndex]; + col.style.width = w; + + var thCW = o.crWColsRow.cells[colIndex].clientWidth; + var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; + + if (thCW != tdCW) { + o.headTbl.style.width = tbl.clientWidth + 'px'; + } + + if (afterColResizedFn) { + afterColResizedFn.call(null, o, colIndex); + } + }; + + if (tf.popupFilters) { + filtersRow.style.display = 'none'; + } + + if (tbl.clientWidth !== this.headTbl.clientWidth) { + tbl.style.width = this.headTbl.clientWidth + 'px'; + } + + this.initialized = true; + } + + /** + * Removes the grid layout + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + var tbl = tf.tbl; + + if (!this.initialized) { + return; + } + var t = _dom2.default.remove(tbl); + this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); + _dom2.default.remove(this.tblMainCont); + + this.tblMainCont = null; + this.headTblCont = null; + this.headTbl = null; + this.tblCont = null; + + tbl.outerHTML = this.sourceTblHtml; + //needed to keep reference of table element for future usage + this.tf.tbl = t; + + this.initialized = false; + } + }]); + + return GridLayout; + })(_feature.Feature); + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var NOTIMPLEMENTED = 'Not implemented.'; + + var Feature = exports.Feature = (function () { + function Feature(tf, feature) { + _classCallCheck(this, Feature); + + this.tf = tf; + this.feature = feature; + this.enabled = tf[feature]; + this.config = tf.config(); + this.emitter = tf.emitter; + this.initialized = false; + } + + _createClass(Feature, [{ + key: 'init', + value: function init() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + } + }, { + key: 'destroy', + value: function destroy() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'enable', + value: function enable() { + this.enabled = true; + } + }, { + key: 'disable', + value: function disable() { + this.enabled = false; + } + }, { + key: 'isEnabled', + value: function isEnabled() { + return this.enabled; + } + }]); + + return Feature; + })(); + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Loader = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var Loader = exports.Loader = (function (_Feature) { + _inherits(Loader, _Feature); + + /** + * Loading message/spinner + * @param {Object} tf TableFilter instance + */ + + function Loader(tf) { + _classCallCheck(this, Loader); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); + + var f = _this.config; + + //id of container element + _this.loaderTgtId = f.loader_target_id || null; + //div containing loader + _this.loaderDiv = null; + //defines loader text + _this.loaderText = f.loader_text || 'Loading...'; + //defines loader innerHtml + _this.loaderHtml = f.loader_html || null; + //defines css class for loader div + _this.loaderCssClass = f.loader_css_class || 'loader'; + //delay for hiding loader + _this.loaderCloseDelay = 200; + //callback function before loader is displayed + _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; + //callback function after loader is closed + _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; + //loader div + _this.prfxLoader = 'load_'; + return _this; + } + + _createClass(Loader, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + var tf = this.tf; + + var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); + containerDiv.className = this.loaderCssClass; + + var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); + if (!this.loaderTgtId) { + targetEl.insertBefore(containerDiv, tf.tbl); + } else { + targetEl.appendChild(containerDiv); + } + this.loaderDiv = containerDiv; + if (!this.loaderHtml) { + this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); + } else { + this.loaderDiv.innerHTML = this.loaderHtml; + } + + this.show('none'); + this.initialized = true; + } + }, { + key: 'show', + value: function show(p) { + var _this2 = this; + + if (!this.isEnabled() || this.loaderDiv.style.display === p) { + return; + } + + var displayLoader = function displayLoader() { + if (!_this2.loaderDiv) { + return; + } + if (_this2.onShowLoader && p !== 'none') { + _this2.onShowLoader.call(null, _this2); + } + _this2.loaderDiv.style.display = p; + if (_this2.onHideLoader && p === 'none') { + _this2.onHideLoader.call(null, _this2); + } + }; + + var t = p === 'none' ? this.loaderCloseDelay : 1; + global.setTimeout(displayLoader, t); + } + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + + _dom2.default.remove(this.loaderDiv); + this.loaderDiv = null; + this.initialized = false; + } + }]); + + return Loader; + })(_feature.Feature); + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.HighlightKeyword = undefined; + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var HighlightKeyword = exports.HighlightKeyword = (function () { + + /** + * HighlightKeyword, highlight matched keyword + * @param {Object} tf TableFilter instance + */ + + function HighlightKeyword(tf) { + _classCallCheck(this, HighlightKeyword); + + var f = tf.config(); + //defines css class for highlighting + this.highlightCssClass = f.highlight_css_class || 'keyword'; + this.highlightedNodes = []; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(HighlightKeyword, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on('before-filtering', function () { + return _this.unhighlightAll(); + }); + } + + /** + * highlight occurences of searched term in passed node + * @param {Node} node + * @param {String} word Searched term + * @param {String} cssClass Css class name + */ + + }, { + key: 'highlight', + value: function highlight(node, word, cssClass) { + // Iterate into this nodes childNodes + if (node.hasChildNodes) { + var children = node.childNodes; + for (var i = 0; i < children.length; i++) { + this.highlight(children[i], word, cssClass); + } + } + + if (node.nodeType === 3) { + var tempNodeVal = _string2.default.lower(node.nodeValue); + var tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) != -1) { + var pn = node.parentNode; + if (pn && pn.className != cssClass) { + // word not highlighted yet + var nv = node.nodeValue, + ni = tempNodeVal.indexOf(tempWordVal), + + // Create a load of replacement nodes + before = _dom2.default.text(nv.substr(0, ni)), + docWordVal = nv.substr(ni, word.length), + after = _dom2.default.text(nv.substr(ni + word.length)), + hiwordtext = _dom2.default.text(docWordVal), + hiword = _dom2.default.create('span'); + hiword.className = cssClass; + hiword.appendChild(hiwordtext); + pn.insertBefore(before, node); + pn.insertBefore(hiword, node); + pn.insertBefore(after, node); + pn.removeChild(node); + this.highlightedNodes.push(hiword.firstChild); + } + } + } + } + + /** + * Removes highlight to nodes matching passed string + * @param {String} word + * @param {String} cssClass Css class to remove + */ + + }, { + key: 'unhighlight', + value: function unhighlight(word, cssClass) { + var arrRemove = []; + var highlightedNodes = this.highlightedNodes; + for (var i = 0; i < highlightedNodes.length; i++) { + var n = highlightedNodes[i]; + if (!n) { + continue; + } + var tempNodeVal = _string2.default.lower(n.nodeValue), + tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) !== -1) { + var pn = n.parentNode; + if (pn && pn.className === cssClass) { + var prevSib = pn.previousSibling, + nextSib = pn.nextSibling; + if (!prevSib || !nextSib) { + continue; + } + nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; + prevSib.nodeValue = ''; + n.nodeValue = ''; + arrRemove.push(i); + } + } + } + for (var k = 0; k < arrRemove.length; k++) { + highlightedNodes.splice(arrRemove[k], 1); + } + } + + /** + * Clear all occurrences of highlighted nodes + */ + + }, { + key: 'unhighlightAll', + value: function unhighlightAll() { + if (!this.tf.highlightKeywords || !this.tf.searchArgs) { + return; + } + for (var y = 0; y < this.tf.searchArgs.length; y++) { + this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); + } + this.highlightedNodes = []; + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off('before-filtering', function () { + return _this2.unhighlightAll(); + }); + } + }]); + + return HighlightKeyword; + })(); + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.PopupFilter = undefined; + + var _feature = __webpack_require__(12); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var PopupFilter = exports.PopupFilter = (function (_Feature) { + _inherits(PopupFilter, _Feature); + + /** + * Pop-up filter component + * @param {Object} tf TableFilter instance + */ + + function PopupFilter(tf) { + _classCallCheck(this, PopupFilter); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); + + var f = _this.config; + + // Enable external filters behaviour + tf.isExternalFlt = true; + tf.externalFltTgtIds = []; + + //filter icon path + _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; + //active filter icon path + _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; + _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; + //defines css class for popup div containing filter + _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; + //callback function before popup filtes is opened + _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; + //callback function after popup filtes is opened + _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; + //callback function before popup filtes is closed + _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; + //callback function after popup filtes is closed + _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; + + //stores filters spans + _this.popUpFltSpans = []; + //stores filters icons + _this.popUpFltImgs = []; + //stores filters containers + _this.popUpFltElms = _this.popUpFltElmCache || []; + _this.popUpFltAdjustToContainer = true; + + //id prefix for pop-up filter span + _this.prfxPopUpSpan = 'popUpSpan_'; + //id prefix for pop-up div containing filter + _this.prfxPopUpDiv = 'popUpDiv_'; + return _this; + } + + _createClass(PopupFilter, [{ + key: 'onClick', + value: function onClick(e) { + var evt = e || global.event, + elm = evt.target.parentNode, + colIndex = parseInt(elm.getAttribute('ci'), 10); + + this.closeAll(colIndex); + this.toggle(colIndex); + + if (this.popUpFltAdjustToContainer) { + var popUpDiv = this.popUpFltElms[colIndex], + header = this.tf.getHeaderElement(colIndex), + headerWidth = header.clientWidth * 0.95; + popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; + } + _event2.default.cancel(evt); + _event2.default.stop(evt); + } + + /** + * Initialize DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + for (var i = 0; i < tf.nbCells; i++) { + if (tf.getFilterType(i) === tf.fltTypeNone) { + continue; + } + var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); + popUpSpan.innerHTML = this.popUpImgFltHtml; + var header = tf.getHeaderElement(i); + header.appendChild(popUpSpan); + _event2.default.add(popUpSpan, 'click', function (evt) { + _this2.onClick(evt); + }); + this.popUpFltSpans[i] = popUpSpan; + this.popUpFltImgs[i] = popUpSpan.firstChild; + } + + // subscribe to events + this.emitter.on('before-filtering', function () { + return _this2.buildIcons(); + }); + this.emitter.on('after-filtering', function () { + return _this2.closeAll(); + }); + + this.initialized = true; + } + + /** + * Reset previously destroyed feature + */ + + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + this.buildAll(); + } + + /** + * Build all pop-up filters elements + */ + + }, { + key: 'buildAll', + value: function buildAll() { + for (var i = 0; i < this.popUpFltElmCache.length; i++) { + this.build(i, this.popUpFltElmCache[i]); + } + } + + /** + * Build a specified pop-up filter elements + * @param {Number} colIndex Column index + * @param {Object} div Optional container DOM element + */ + + }, { + key: 'build', + value: function build(colIndex, div) { + var tf = this.tf; + var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; + popUpDiv.className = this.popUpDivCssClass; + tf.externalFltTgtIds.push(popUpDiv.id); + var header = tf.getHeaderElement(colIndex); + header.insertBefore(popUpDiv, header.firstChild); + _event2.default.add(popUpDiv, 'click', function (evt) { + _event2.default.stop(evt); + }); + this.popUpFltElms[colIndex] = popUpDiv; + } + + /** + * Toogle visibility of specified filter + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggle', + value: function toggle(colIndex) { + var tf = this.tf, + popUpFltElm = this.popUpFltElms[colIndex]; + + if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { + if (this.onBeforePopUpOpen) { + this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'block'; + if (tf.getFilterType(colIndex) === tf.fltTypeInp) { + var flt = tf.getFilterElement(colIndex); + if (flt) { + flt.focus(); + } + } + if (this.onAfterPopUpOpen) { + this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } else { + if (this.onBeforePopUpClose) { + this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'none'; + if (this.onAfterPopUpClose) { + this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } + } + + /** + * Close all filters excepted for the specified one if any + * @param {Number} exceptIdx Column index of the filter to not close + */ + + }, { + key: 'closeAll', + value: function closeAll(exceptIdx) { + for (var i = 0; i < this.popUpFltElms.length; i++) { + if (i === exceptIdx) { + continue; + } + var popUpFltElm = this.popUpFltElms[i]; + if (popUpFltElm) { + popUpFltElm.style.display = 'none'; + } + } + } + + /** + * Build all the icons representing the pop-up filters + */ + + }, { + key: 'buildIcons', + value: function buildIcons() { + for (var i = 0; i < this.popUpFltImgs.length; i++) { + this.buildIcon(i, false); + } + } + + /** + * Build specified icon + * @param {Number} colIndex Column index + * @param {Boolean} active Apply active state + */ + + }, { + key: 'buildIcon', + value: function buildIcon(colIndex, active) { + if (this.popUpFltImgs[colIndex]) { + this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; + } + } + + /** + * Remove pop-up filters + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + this.popUpFltElmCache = []; + for (var i = 0; i < this.popUpFltElms.length; i++) { + var popUpFltElm = this.popUpFltElms[i], + popUpFltSpan = this.popUpFltSpans[i], + popUpFltImg = this.popUpFltImgs[i]; + if (popUpFltElm) { + _dom2.default.remove(popUpFltElm); + this.popUpFltElmCache[i] = popUpFltElm; + } + popUpFltElm = null; + if (popUpFltSpan) { + _dom2.default.remove(popUpFltSpan); + } + popUpFltSpan = null; + if (popUpFltImg) { + _dom2.default.remove(popUpFltImg); + } + popUpFltImg = null; + } + this.popUpFltElms = []; + this.popUpFltSpans = []; + this.popUpFltImgs = []; + + // unsubscribe to events + this.emitter.off('before-filtering', function () { + return _this3.buildIcons(); + }); + this.emitter.off('after-filtering', function () { + return _this3.closeAll(); + }); + + this.initialized = false; + } + }]); + + return PopupFilter; + })(_feature.Feature); + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Dropdown = undefined; + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Dropdown = exports.Dropdown = (function () { + + /** + * Dropdown UI component + * @param {Object} tf TableFilter instance + */ + + function Dropdown(tf) { + _classCallCheck(this, Dropdown); + + // Configuration object + var f = tf.config(); + + this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; + //defines empty option text + this.nonEmptyText = f.non_empty_text || '(Non empty)'; + //sets select filling method: 'innerHTML' or 'createElement' + this.slcFillingMethod = f.slc_filling_method || 'createElement'; + //IE only, tooltip text appearing on select before it is populated + this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; + //tooltip text appearing on multiple select + this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; + + this.isCustom = null; + this.opts = null; + this.optsTxt = null; + this.slcInnerHtml = null; + + this.tf = tf; + } + + /** + * Build drop-down filter UI asynchronously + * @param {Number} colIndex Column index + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Boolean} isExternal Render in external container + * @param {String} extSlcId External container id + */ + + _createClass(Dropdown, [{ + key: 'build', + value: function build(colIndex, isLinked, isExternal, extSlcId) { + var tf = this.tf; + tf.EvtManager(tf.Evt.name.dropdown, { + slcIndex: colIndex, + slcRefreshed: isLinked, + slcExternal: isExternal, + slcId: extSlcId + }); + } + + /** + * Build drop-down filter UI + * @param {Number} colIndex Column index + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Boolean} isExternal Render in external container + * @param {String} extSlcId External container id + */ + + }, { + key: '_build', + value: function _build(colIndex) { + var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.opts = []; + this.optsTxt = []; + this.slcInnerHtml = ''; + + var slcId = tf.fltIds[colIndex]; + if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { + return; + } + var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), + rows = tf.tbl.rows, + matchCase = tf.matchCase; + + //custom select test + this.isCustom = tf.isCustomOptions(colIndex); + + //custom selects text + var activeFlt; + if (isLinked && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + /*** remember grid values ***/ + var fltsValues = [], + fltArr = []; + if (tf.rememberGridValues) { + fltsValues = tf.feature('store').getFilterValues(tf.fltsValuesCookie); + if (fltsValues && !_string2.default.isEmpty(fltsValues.toString())) { + if (this.isCustom) { + fltArr.push(fltsValues[colIndex]); + } else { + fltArr = fltsValues[colIndex].split(' ' + tf.orOperator + ' '); + } + } + } + + var excludedOpts = null, + filteredDataCol = null; + if (isLinked && tf.disableExcludedOptions) { + excludedOpts = []; + filteredDataCol = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cell = rows[k].cells, + nchilds = cell.length; + + // checks if row has exact cell # + if (nchilds !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < nchilds; j++) { + // WTF: cyclomatic complexity hell + if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cell[j]), + + //Vary Peter's patch + cell_string = _string2.default.matchCase(cell_data, matchCase); + + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, matchCase)) { + this.opts.push(cell_data); + } + + if (isLinked && tf.disableExcludedOptions) { + var filteredCol = filteredDataCol[j]; + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { + excludedOpts.push(cell_data); + } + } + } //if colIndex==j + } //for j + } //for k + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (excludedOpts) { + excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + } + } + + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (excludedOpts) { + excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (excludedOpts) { + excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + //populates drop-down + this.addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr); + } + + /** + * Add drop-down options + * @param {Number} colIndex Column index + * @param {Object} slc Select Dom element + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Array} excludedOpts Array of excluded options + * @param {Array} fltsValues Collection of persisted filter values + * @param {Array} fltArr Collection of persisted filter values + */ + + }, { + key: 'addOptions', + value: function addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod), + slcValue = slc.value; + + slc.innerHTML = ''; + slc = this.addFirstOption(slc); + + for (var y = 0; y < this.opts.length; y++) { + if (this.opts[y] === '') { + continue; + } + var val = this.opts[y]; //option value + var lbl = this.isCustom ? this.optsTxt[y] : val; //option text + var isDisabled = false; + if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + isDisabled = true; + } + + if (fillMethod === 'innerhtml') { + var slcAttr = ''; + if (tf.loadFltOnDemand && slcValue === this.opts[y]) { + slcAttr = 'selected="selected"'; + } + this.slcInnerHtml += ''; + } else { + var opt; + //fill select on demand + if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { + opt = _dom2.default.createOpt(lbl, val, true); + } else { + if (tf.getFilterType(colIndex) !== tf.fltTypeMulti) { + opt = _dom2.default.createOpt(lbl, val, fltsValues[colIndex] !== ' ' && val === fltsValues[colIndex] ? true : false); + } else { + opt = _dom2.default.createOpt(lbl, val, _array2.default.has(fltArr, _string2.default.matchCase(this.opts[y], tf.matchCase), tf.matchCase) || fltArr.toString().indexOf(val) !== -1 ? true : false); + } + } + if (isDisabled) { + opt.disabled = true; + } + slc.appendChild(opt); + } + } // for y + + if (fillMethod === 'innerhtml') { + slc.innerHTML += this.slcInnerHtml; + } + slc.setAttribute('filled', '1'); + } + + /** + * Add drop-down header option + * @param {Object} slc Select DOM element + */ + + }, { + key: 'addFirstOption', + value: function addFirstOption(slc) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod); + + if (fillMethod === 'innerhtml') { + this.slcInnerHtml += ''; + } else { + var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); + if (!this.enableSlcResetFilter) { + opt0.style.display = 'none'; + } + slc.appendChild(opt0); + if (tf.enableEmptyOption) { + var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); + slc.appendChild(opt1); + } + if (tf.enableNonEmptyOption) { + var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); + slc.appendChild(opt2); + } + } + return slc; + } + }]); + + return Dropdown; + })(); + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + ignoreCase: function ignoreCase(a, b) { + var x = _string2.default.lower(a); + var y = _string2.default.lower(b); + return x < y ? -1 : x > y ? 1 : 0; + } + }; + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.CheckList = undefined; + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var CheckList = exports.CheckList = (function () { + + /** + * Checklist UI component + * @param {Object} tf TableFilter instance + */ + + function CheckList(tf) { + _classCallCheck(this, CheckList); + + // Configuration object + var f = tf.config(); + + this.checkListDiv = []; //checklist container div + //defines css class for div containing checklist filter + this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; + //defines css class for checklist filters + this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; + //defines css class for checklist item (li) + this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; + //defines css class for selected checklist item (li) + this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; + //Load on demand text + this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; + //defines css class for checklist filters + this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; + this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; + //checklist filter container div + this.prfxCheckListDiv = 'chkdiv_'; + + this.isCustom = null; + this.opts = null; + this.optsTxt = null; + this.excludedOpts = null; + + this.tf = tf; + } + + // TODO: move event here + + _createClass(CheckList, [{ + key: 'onChange', + value: function onChange(evt) { + var elm = evt.target; + this.tf.activeFilterId = elm.getAttribute('id'); + this.tf.activeFlt = _dom2.default.id(this.tf.activeFilterId); + this.tf.Evt.onSlcChange.call(this.tf, evt); + } + }, { + key: 'optionClick', + value: function optionClick(evt) { + this.setCheckListValues(evt.target); + this.onChange(evt); + } + + /** + * Build checklist UI asynchronously + * @param {Number} colIndex Column index + * @param {Boolean} isExternal Render in external container + * @param {String} extFltId External container id + */ + + }, { + key: 'build', + value: function build(colIndex, isExternal, extFltId) { + var tf = this.tf; + tf.EvtManager(tf.Evt.name.checklist, { slcIndex: colIndex, slcExternal: isExternal, slcId: extFltId }); + } + + /** + * Build checklist UI + * @param {Number} colIndex Column index + * @param {Boolean} isExternal Render in external container + * @param {String} extFltId External container id + */ + + }, { + key: '_build', + value: function _build(colIndex) { + var _this = this; + + var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.opts = []; + this.optsTxt = []; + + var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; + if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { + return; + } + + var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); + var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); + ul.className = this.checkListCssClass; + _event2.default.add(ul, 'change', function (evt) { + _this.onChange(evt); + }); + + var rows = tf.tbl.rows; + this.isCustom = tf.isCustomOptions(colIndex); + + var activeFlt; + if (tf.linkedFilters && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + var filteredDataCol = []; + if (tf.linkedFilters && tf.disableExcludedOptions) { + this.excludedOpts = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cells = rows[k].cells; + var ncells = cells.length; + + // checks if row has exact cell # + if (ncells !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < ncells; j++) { + // WTF: cyclomatic complexity hell :) + if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cells[j]); + //Vary Peter's patch + var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { + this.opts.push(cell_data); + } + var filteredCol = filteredDataCol[j]; + if (tf.linkedFilters && tf.disableExcludedOptions) { + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { + this.excludedOpts.push(cell_data); + } + } + } + } + } + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!tf.matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (this.excludedOpts) { + this.excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + } + } + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + this.addChecks(colIndex, ul, tf.separator); + + if (tf.loadFltOnDemand) { + flt.innerHTML = ''; + } + flt.appendChild(ul); + flt.setAttribute('filled', '1'); + } + + /** + * Add checklist options + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addChecks', + value: function addChecks(colIndex, ul) { + var _this2 = this; + + var tf = this.tf; + var chkCt = this.addTChecks(colIndex, ul); + var fltArr = []; //remember grid values + var store = tf.feature('store'); + var tmpVal = store ? store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null; + if (tmpVal && _string2.default.trim(tmpVal).length > 0) { + if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1) { + fltArr.push(tmpVal); + } else { + fltArr = tmpVal.split(' ' + tf.orOperator + ' '); + } + } + + for (var y = 0; y < this.opts.length; y++) { + var val = this.opts[y]; //item value + var lbl = this.isCustom ? this.optsTxt[y] : val; //item text + var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); + li.className = this.checkListItemCssClass; + if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + _dom2.default.addClass(li, this.checkListItemDisabledCssClass); + li.check.disabled = true; + li.disabled = true; + } else { + _event2.default.add(li.check, 'click', function (evt) { + _this2.optionClick(evt); + }); + } + ul.appendChild(li); + + if (val === '') { + //item is hidden + li.style.display = 'none'; + } + + /*** remember grid values ***/ + if (tf.rememberGridValues) { + if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1 && fltArr.toString().indexOf(val) != -1 || _array2.default.has(fltArr, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + li.check.checked = true; + this.setCheckListValues(li.check); + } + } + } + } + + /** + * Add checklist header option + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addTChecks', + value: function addTChecks(colIndex, ul) { + var _this3 = this; + + var tf = this.tf; + var chkCt = 1; + var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); + li0.className = this.checkListItemCssClass; + ul.appendChild(li0); + + _event2.default.add(li0.check, 'click', function (evt) { + _this3.optionClick(evt); + }); + + if (!this.enableCheckListResetFilter) { + li0.style.display = 'none'; + } + + if (tf.enableEmptyOption) { + var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); + li1.className = this.checkListItemCssClass; + ul.appendChild(li1); + _event2.default.add(li1.check, 'click', function (evt) { + _this3.optionClick(evt); + }); + chkCt++; + } + + if (tf.enableNonEmptyOption) { + var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); + li2.className = this.checkListItemCssClass; + ul.appendChild(li2); + _event2.default.add(li2.check, 'click', function (evt) { + _this3.optionClick(evt); + }); + chkCt++; + } + return chkCt; + } + + /** + * Store checked options in DOM element attribute + * @param {Object} o checklist option DOM element + */ + + }, { + key: 'setCheckListValues', + value: function setCheckListValues(o) { + if (!o) { + return; + } + var tf = this.tf; + var chkValue = o.value; //checked item value + var chkIndex = parseInt(o.id.split('_')[2], 10); + var filterTag = 'ul', + itemTag = 'li'; + var n = o; + + //ul tag search + while (_string2.default.lower(n.nodeName) !== filterTag) { + n = n.parentNode; + } + + var li = n.childNodes[chkIndex]; + var colIndex = n.getAttribute('colIndex'); + var fltValue = n.getAttribute('value'); //filter value (ul tag) + var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) + + if (o.checked) { + //show all item + if (chkValue === '') { + if (fltIndexes && fltIndexes !== '') { + //items indexes + var indSplit = fltIndexes.split(tf.separator); + //checked items loop + for (var u = 0; u < indSplit.length; u++) { + //checked item + var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); + if (cChk) { + cChk.checked = false; + _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); + } + } + } + n.setAttribute('value', ''); + n.setAttribute('indexes', ''); + } else { + fltValue = fltValue ? fltValue : ''; + chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); + chkIndex = fltIndexes + chkIndex + tf.separator; + n.setAttribute('value', chkValue); + n.setAttribute('indexes', chkIndex); + //1st option unchecked + if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { + _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; + } + } + + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); + _dom2.default.addClass(li, this.checkListSlcItemCssClass); + } + } else { + //removes values and indexes + if (chkValue !== '') { + var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); + fltValue = fltValue.replace(replaceValue, ''); + n.setAttribute('value', _string2.default.trim(fltValue)); + + var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); + fltIndexes = fltIndexes.replace(replaceIndex, ''); + n.setAttribute('indexes', fltIndexes); + } + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(li, this.checkListSlcItemCssClass); + } + } + } + }]); + + return CheckList; + })(); + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.RowsCounter = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var RowsCounter = exports.RowsCounter = (function (_Feature) { + _inherits(RowsCounter, _Feature); + + /** + * Rows counter + * @param {Object} tf TableFilter instance + */ + + function RowsCounter(tf) { + _classCallCheck(this, RowsCounter); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); + + var f = _this.config; + + //id of custom container element + _this.rowsCounterTgtId = f.rows_counter_target_id || null; + //element containing tot nb rows + _this.rowsCounterDiv = null; + //element containing tot nb rows label + _this.rowsCounterSpan = null; + //defines rows counter text + _this.rowsCounterText = f.rows_counter_text || 'Rows: '; + _this.fromToTextSeparator = f.from_to_text_separator || '-'; + _this.overText = f.over_text || ' / '; + //defines css class rows counter + _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; + //rows counter div + _this.prfxCounter = 'counter_'; + //nb displayed rows label + _this.prfxTotRows = 'totrows_span_'; + //label preceding nb rows label + _this.prfxTotRowsTxt = 'totRowsTextSpan_'; + //callback raised before counter is refreshed + _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; + //callback raised after counter is refreshed + _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; + return _this; + } + + _createClass(RowsCounter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + //rows counter container + var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); + countDiv.className = this.totRowsCssClass; + //rows counter label + var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); + var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); + countText.appendChild(_dom2.default.text(this.rowsCounterText)); + + // counter is added to defined element + if (!this.rowsCounterTgtId) { + tf.setToolbar(); + } + var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); + + //default container: 'lDiv' + if (!this.rowsCounterTgtId) { + countDiv.appendChild(countText); + countDiv.appendChild(countSpan); + targetEl.appendChild(countDiv); + } else { + //custom container, no need to append statusDiv + targetEl.appendChild(countText); + targetEl.appendChild(countSpan); + } + this.rowsCounterDiv = countDiv; + this.rowsCounterSpan = countSpan; + + // subscribe to after-filtering event + this.emitter.on('after-filtering', function () { + return _this2.refresh(tf.nbVisibleRows); + }); + // subscribe to grouped-by-page event + this.emitter.on('grouped-by-page', function () { + return _this2.refresh(tf.nbVisibleRows); + }); + // subscribe to rows-changed event + this.emitter.on('rows-changed', function () { + return _this2.refresh(); + }); + + this.initialized = true; + this.refresh(); + } + }, { + key: 'refresh', + value: function refresh(p) { + if (!this.initialized || !this.isEnabled()) { + return; + } + + var tf = this.tf; + + if (this.onBeforeRefreshCounter) { + this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); + } + + var totTxt; + if (!tf.paging) { + if (p && p !== '') { + totTxt = p; + } else { + totTxt = tf.nbFilterableRows - tf.nbHiddenRows; + } + } else { + var paging = tf.feature('paging'); + if (paging) { + //paging start row + var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); + var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; + totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; + } + } + + this.rowsCounterSpan.innerHTML = totTxt; + if (this.onAfterRefreshCounter) { + this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + if (!this.rowsCounterTgtId && this.rowsCounterDiv) { + _dom2.default.remove(this.rowsCounterDiv); + } else { + _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; + } + this.rowsCounterSpan = null; + this.rowsCounterDiv = null; + + // unsubscribe to events + this.emitter.off('after-filtering', function () { + return _this3.refresh(tf.nbVisibleRows); + }); + this.emitter.off('grouped-by-page', function () { + return _this3.refresh(tf.nbVisibleRows); + }); + this.emitter.off('rows-changed', function () { + return _this3.refresh(); + }); + + this.initialized = false; + } + }]); + + return RowsCounter; + })(_feature.Feature); + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.StatusBar = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var StatusBar = exports.StatusBar = (function (_Feature) { + _inherits(StatusBar, _Feature); + + /** + * Status bar UI component + * @param {Object} tf TableFilter instance + */ + + function StatusBar(tf) { + _classCallCheck(this, StatusBar); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); + + var f = _this.config; + + //id of custom container element + _this.statusBarTgtId = f.status_bar_target_id || null; + //element containing status bar label + _this.statusBarDiv = null; + //status bar + _this.statusBarSpan = null; + //status bar label + _this.statusBarSpanText = null; + //defines status bar text + _this.statusBarText = f.status_bar_text || ''; + //defines css class status bar + _this.statusBarCssClass = f.status_bar_css_class || 'status'; + //delay for status bar clearing + _this.statusBarCloseDelay = 250; + + //calls function before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //calls function after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + + // status bar div + _this.prfxStatus = 'status_'; + // status bar label + _this.prfxStatusSpan = 'statusSpan_'; + // text preceding status bar label + _this.prfxStatusTxt = 'statusText_'; + return _this; + } + + _createClass(StatusBar, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + var tf = this.tf; + + //status bar container + var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); + statusDiv.className = this.statusBarCssClass; + + //status bar label + var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); + //preceding text + var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); + statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); + + // target element container + if (!this.statusBarTgtId) { + tf.setToolbar(); + } + var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); + + //default container: 'lDiv' + if (!this.statusBarTgtId) { + statusDiv.appendChild(statusSpanText); + statusDiv.appendChild(statusSpan); + targetEl.appendChild(statusDiv); + } else { + // custom container, no need to append statusDiv + targetEl.appendChild(statusSpanText); + targetEl.appendChild(statusSpan); + } + + this.statusBarDiv = statusDiv; + this.statusBarSpan = statusSpan; + this.statusBarSpanText = statusSpanText; + + this.initialized = true; + } + }, { + key: 'message', + value: function message() { + var _this2 = this; + + var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; + + if (!this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, t); + } + + var d = t === '' ? this.statusBarCloseDelay : 1; + global.setTimeout(function () { + _this2.statusBarSpan.innerHTML = t; + if (_this2.onAfterShowMsg) { + _this2.onAfterShowMsg.call(null, _this2.tf, t); + } + }, d); + } + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + + this.statusBarDiv.innerHTML = ''; + _dom2.default.remove(this.statusBarDiv); + this.statusBarSpan = null; + this.statusBarSpanText = null; + this.statusBarDiv = null; + this.initialized = false; + } + }]); + + return StatusBar; + })(_feature.Feature); + +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Paging = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Paging = exports.Paging = (function (_Feature) { + _inherits(Paging, _Feature); + + /** + * Pagination component + * @param {Object} tf TableFilter instance + */ + + function Paging(tf) { + _classCallCheck(this, Paging); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); + + var f = _this.config; + + //css class for paging buttons (previous,next,etc.) + _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; + //stores paging select element + _this.pagingSlc = null; + //results per page select element + _this.resultsPerPageSlc = null; + //id of container element + _this.pagingTgtId = f.paging_target_id || null; + //defines table paging length + _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; + //id of container element + _this.resultsPerPageTgtId = f.results_per_page_target_id || null; + //css class for paging select element + _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; + //css class for paging input element + _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; + //stores results per page text and values + _this.resultsPerPage = f.results_per_page || null; + //enables/disables results per page drop-down + _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); + //defines css class for results per page select + _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; + //css class for label preceding results per page select + _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; + //1st row index of current page + _this.startPagingRow = 0; + //total nb of pages + _this.nbPages = 0; + //current page nb + _this.currentPageNb = 1; + //defines next page button text + _this.btnNextPageText = f.btn_next_page_text || '>'; + //defines previous page button text + _this.btnPrevPageText = f.btn_prev_page_text || '<'; + //defines last page button text + _this.btnLastPageText = f.btn_last_page_text || '>|'; + //defines first page button text + _this.btnFirstPageText = f.btn_first_page_text || '|<'; + //defines next page button html + _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); + //defines last page button html + _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); + //defines text preceeding page selector drop-down + _this.pageText = f.page_text || ' Page '; + //defines text after page selector drop-down + _this.ofText = f.of_text || ' of '; + //css class for span containing tot nb of pages + _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; + //enables/disables paging buttons + _this.hasPagingBtns = f.paging_btns === false ? false : true; + //defines previous page button html + _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; + //calls function before page is changed + _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; + //calls function before page is changed + _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; + + //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_'; + + var start_row = _this.refRow; + var nrows = _this.nbRows; + //calculates page nb + _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); + + //Paging elements events + var o = _this; + // Paging DOM events + _this.evt = { + slcIndex: function slcIndex() { + return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; + }, + nbOpts: function nbOpts() { + return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; + }, + next: function next() { + var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; + o.changePage(nextIndex); + }, + prev: function prev() { + var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); + o.changePage(prevIndex); + }, + last: function last() { + o.changePage(o.evt.nbOpts()); + }, + first: function first() { + o.changePage(0); + }, + _detectKey: function _detectKey(e) { + var key = _event2.default.keyCode(e); + if (key === 13) { + if (tf.sorted) { + tf.filter(); + o.changePage(o.evt.slcIndex()); + } else { + o.changePage(); + } + this.blur(); + } + }, + + slcPagesChange: null, + nextEvt: null, + prevEvt: null, + lastEvt: null, + firstEvt: null + }; + return _this; + } + + /** + * Initialize DOM elements + */ + + _createClass(Paging, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var slcPages; + var tf = this.tf; + var evt = this.evt; + + if (this.initialized) { + return; + } + + // Check resultsPerPage is in expected format and initialise the + // results per page component + if (this.hasResultsPerPage) { + if (this.resultsPerPage.length < 2) { + this.hasResultsPerPage = false; + } else { + this.pagingLength = this.resultsPerPage[1][0]; + this.setResultsPerPage(); + } + } + + evt.slcPagesChange = function (event) { + var slc = event.target; + _this2.changePage(slc.selectedIndex); + }; + + // Paging drop-down list selector + if (this.pageSelectorType === tf.fltTypeSlc) { + slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); + slcPages.className = this.pgSlcCssClass; + _event2.default.add(slcPages, 'change', evt.slcPagesChange); + } + + // Paging input selector + if (this.pageSelectorType === tf.fltTypeInp) { + slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); + slcPages.className = this.pgInpCssClass; + _event2.default.add(slcPages, 'keypress', evt._detectKey); + } + + // btns containers + var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); + var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); + var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); + var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); + + if (this.hasPagingBtns) { + // Next button + if (!this.btnNextPageHtml) { + var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); + btn_next.className = this.btnPageCssClass; + _event2.default.add(btn_next, 'click', evt.next); + btnNextSpan.appendChild(btn_next); + } else { + btnNextSpan.innerHTML = this.btnNextPageHtml; + _event2.default.add(btnNextSpan, 'click', evt.next); + } + // Previous button + if (!this.btnPrevPageHtml) { + var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); + btn_prev.className = this.btnPageCssClass; + _event2.default.add(btn_prev, 'click', evt.prev); + btnPrevSpan.appendChild(btn_prev); + } else { + btnPrevSpan.innerHTML = this.btnPrevPageHtml; + _event2.default.add(btnPrevSpan, 'click', evt.prev); + } + // Last button + if (!this.btnLastPageHtml) { + var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); + btn_last.className = this.btnPageCssClass; + _event2.default.add(btn_last, 'click', evt.last); + btnLastSpan.appendChild(btn_last); + } else { + btnLastSpan.innerHTML = this.btnLastPageHtml; + _event2.default.add(btnLastSpan, 'click', evt.last); + } + // First button + if (!this.btnFirstPageHtml) { + var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); + btn_first.className = this.btnPageCssClass; + _event2.default.add(btn_first, 'click', evt.first); + btnFirstSpan.appendChild(btn_first); + } else { + btnFirstSpan.innerHTML = this.btnFirstPageHtml; + _event2.default.add(btnFirstSpan, 'click', evt.first); + } + } + + // paging elements (buttons+drop-down list) are added to defined element + if (!this.pagingTgtId) { + tf.setToolbar(); + } + var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + targetEl.appendChild(btnFirstSpan); + targetEl.appendChild(btnPrevSpan); + + var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); + pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); + pgBeforeSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgBeforeSpan); + targetEl.appendChild(slcPages); + var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); + pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); + pgAfterSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgAfterSpan); + var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); + pgspan.className = this.nbPgSpanCssClass; + pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); + targetEl.appendChild(pgspan); + targetEl.appendChild(btnNextSpan); + targetEl.appendChild(btnLastSpan); + this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); + + if (!tf.rememberGridValues) { + this.setPagingInfo(); + } + if (!tf.fltGrid) { + tf.validateAllRows(); + this.setPagingInfo(tf.validRowsIndex); + } + + this.emitter.on('after-filtering', function () { + return _this2.resetPagingInfo(); + }); + + this.initialized = true; + } + + /** + * Reset paging when filters are already instantiated + * @param {Boolean} filterTable Execute filtering once paging instanciated + */ + + }, { + key: 'reset', + value: function reset() { + var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var tf = this.tf; + if (!tf.hasGrid() || this.isEnabled()) { + return; + } + this.enable(); + this.init(); + tf.resetValues(); + if (filterTable) { + tf.filter(); + } + } + + /** + * Reset paging info from scratch after a filtering process + */ + + }, { + key: 'resetPagingInfo', + value: function resetPagingInfo() { + this.startPagingRow = 0; + this.currentPageNb = 1; + this.setPagingInfo(this.tf.validRowsIndex); + } + + /** + * Calculate number of pages based on valid rows + * Refresh paging select according to number of pages + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'setPagingInfo', + value: function setPagingInfo() { + var validRows = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0]; + + var tf = this.tf; + var rows = tf.tbl.rows; + var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + //store valid rows indexes + tf.validRowsIndex = validRows; + + if (validRows.length === 0) { + //counts rows to be grouped + for (var j = tf.refRow; j < tf.nbRows; j++) { + var row = rows[j]; + if (!row) { + continue; + } + + var isRowValid = row.getAttribute('validRow'); + if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { + tf.validRowsIndex.push(j); + } + } + } + + //calculate nb of pages + this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); + //refresh page nb span + pgspan.innerHTML = this.nbPages; + //select clearing shortcut + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.innerHTML = ''; + } + + if (this.nbPages > 0) { + mdiv.style.visibility = 'visible'; + if (this.pageSelectorType === tf.fltTypeSlc) { + for (var z = 0; z < this.nbPages; z++) { + var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); + this.pagingSlc.options[z] = opt; + } + } else { + //input type + this.pagingSlc.value = this.currentPageNb; + } + } else { + /*** if no results paging select and buttons are hidden ***/ + mdiv.style.visibility = 'hidden'; + } + this.groupByPage(tf.validRowsIndex); + } + + /** + * Group table rows by page and display valid rows + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'groupByPage', + value: function groupByPage(validRows) { + var tf = this.tf; + var alternateRows = tf.feature('alternateRows'); + var rows = tf.tbl.rows; + var startPagingRow = parseInt(this.startPagingRow, 10); + var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); + + //store valid rows indexes + if (validRows) { + tf.validRowsIndex = validRows; + } + + //this loop shows valid rows of current page + for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { + var validRowIdx = tf.validRowsIndex[h]; + var r = rows[validRowIdx]; + var isRowValid = r.getAttribute('validRow'); + + if (h >= startPagingRow && h < endPagingRow) { + if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { + r.style.display = ''; + } + if (tf.alternateRows && alternateRows) { + alternateRows.setRowBg(validRowIdx, h); + } + } else { + r.style.display = 'none'; + if (tf.alternateRows && alternateRows) { + alternateRows.removeRowBg(validRowIdx); + } + } + } + + tf.nbVisibleRows = tf.validRowsIndex.length; + + // broadcast grouping by page + this.emitter.emit('grouped-by-page', tf, this); + } + + /** + * Return the current page number + * @return {Number} Page number + */ + + }, { + key: 'getPage', + value: function getPage() { + return this.currentPageNb; + } + + /** + * Show page based on passed param value (string or number): + * @param {String} or {Number} cmd possible string values: 'next', + * 'previous', 'last', 'first' or page number as per param + */ + + }, { + key: 'setPage', + value: function setPage(cmd) { + var tf = this.tf; + if (!tf.hasGrid() || !this.isEnabled()) { + return; + } + var btnEvt = this.evt, + cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); + if (cmdtype === 'string') { + switch (_string2.default.lower(cmd)) { + case 'next': + btnEvt.next(); + break; + case 'previous': + btnEvt.prev(); + break; + case 'last': + btnEvt.last(); + break; + case 'first': + btnEvt.first(); + break; + default: + btnEvt.next(); + break; + } + } else if (cmdtype === 'number') { + this.changePage(cmd - 1); + } + } + + /** + * Generates UI elements for the number of results per page drop-down + */ + + }, { + key: 'setResultsPerPage', + value: function setResultsPerPage() { + var _this3 = this; + + var tf = this.tf; + var evt = this.evt; + + if (!tf.hasGrid() && !tf.isFirstLoad) { + return; + } + if (this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + + evt.slcResultsChange = function (ev) { + _this3.changeResultsPerPage(); + ev.target.blur(); + }; + + var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); + slcR.className = this.resultsSlcCssClass; + var slcRText = this.resultsPerPage[0], + slcROpts = this.resultsPerPage[1]; + var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); + slcRSpan.className = this.resultsSpanCssClass; + + // results per page select is added to external element + if (!this.resultsPerPageTgtId) { + tf.setToolbar(); + } + var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); + slcRSpan.appendChild(_dom2.default.text(slcRText)); + + var help = tf.feature('help'); + if (help && help.btn) { + help.btn.parentNode.insertBefore(slcRSpan, help.btn); + help.btn.parentNode.insertBefore(slcR, help.btn); + } else { + targetEl.appendChild(slcRSpan); + targetEl.appendChild(slcR); + } + + for (var r = 0; r < slcROpts.length; r++) { + var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); + slcR.options[r] = currOpt; + } + _event2.default.add(slcR, 'change', evt.slcResultsChange); + this.resultsPerPageSlc = slcR; + } + + /** + * Remove number of results per page UI elements + */ + + }, { + key: 'removeResultsPerPage', + value: function removeResultsPerPage() { + var tf = this.tf; + if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + var slcR = this.resultsPerPageSlc, + slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); + if (slcR) { + _dom2.default.remove(slcR); + } + if (slcRSpan) { + _dom2.default.remove(slcRSpan); + } + this.resultsPerPageSlc = null; + } + + /** + * Change the page asynchronously according to passed index + * @param {Number} index Index of the page (0-n) + */ + + }, { + key: 'changePage', + value: function changePage(index) { + var tf = this.tf; + var evt = tf.Evt; + tf.EvtManager(evt.name.changepage, { pgIndex: index }); + } + + /** + * Change rows asynchronously according to page results + */ + + }, { + key: 'changeResultsPerPage', + value: function changeResultsPerPage() { + var tf = this.tf; + var evt = tf.Evt; + tf.EvtManager(evt.name.changeresultsperpage); + } + + /** + * Re-set asynchronously page nb at page re-load + */ + + }, { + key: 'resetPage', + value: function resetPage() { + var tf = this.tf; + var evt = tf.Evt; + tf.EvtManager(evt.name.resetpage); + } + + /** + * Re-set asynchronously page length at page re-load + */ + + }, { + key: 'resetPageLength', + value: function resetPageLength() { + var tf = this.tf; + var evt = tf.Evt; + tf.EvtManager(evt.name.resetpagelength); + } + + /** + * Change the page according to passed index + * @param {Number} index Index of the page (0-n) + */ + + }, { + key: '_changePage', + value: function _changePage(index) { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + if (index === null) { + index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; + } + if (index >= 0 && index <= this.nbPages - 1) { + if (this.onBeforeChangePage) { + this.onBeforeChangePage.call(null, this, index); + } + this.currentPageNb = parseInt(index, 10) + 1; + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.options[index].selected = true; + } else { + this.pagingSlc.value = this.currentPageNb; + } + + if (tf.rememberPageNb) { + tf.feature('store').savePageNb(tf.pgNbCookie); + } + this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; + + this.groupByPage(); + + if (this.onAfterChangePage) { + this.onAfterChangePage.call(null, this, index); + } + } + } + + /** + * Change rows according to page results drop-down + * TODO: accept a parameter setting the results per page length + */ + + }, { + key: '_changeResultsPerPage', + value: function _changeResultsPerPage() { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + var slcR = this.resultsPerPageSlc; + var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); + this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); + this.startPagingRow = this.pagingLength * slcPagesSelIndex; + + if (!isNaN(this.pagingLength)) { + if (this.startPagingRow >= tf.nbFilterableRows) { + this.startPagingRow = tf.nbFilterableRows - this.pagingLength; + } + this.setPagingInfo(); + + if (this.pageSelectorType === tf.fltTypeSlc) { + var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; + this.pagingSlc.options[slcIndex].selected = true; + } + if (tf.rememberPageLen) { + tf.feature('store').savePageLength(tf.pgLenCookie); + } + } + } + + /** + * Re-set page nb at page re-load + */ + + }, { + key: '_resetPage', + value: function _resetPage(name) { + var tf = this.tf; + var pgnb = tf.feature('store').getPageNb(name); + if (pgnb !== '') { + this.changePage(pgnb - 1); + } + } + + /** + * Re-set page length value at page re-load + */ + + }, { + key: '_resetPageLength', + value: function _resetPageLength(name) { + var tf = this.tf; + if (!this.isEnabled()) { + return; + } + var pglenIndex = tf.feature('store').getPageLength(name); + + if (pglenIndex !== '') { + this.resultsPerPageSlc.options[pglenIndex].selected = true; + this.changeResultsPerPage(); + } + } + + /** + * Remove paging feature + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + var tf = this.tf; + + if (!this.initialized) { + return; + } + // btns containers + var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); + var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); + var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); + var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); + //span containing 'Page' text + var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); + //span containing 'of' text + var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); + //span containing nb of pages + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + var evt = this.evt; + + if (this.pagingSlc) { + if (this.pageSelectorType === tf.fltTypeSlc) { + _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); + } else if (this.pageSelectorType === tf.fltTypeInp) { + _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); + } + _dom2.default.remove(this.pagingSlc); + } + + if (btnNextSpan) { + _event2.default.remove(btnNextSpan, 'click', evt.next); + _dom2.default.remove(btnNextSpan); + } + + if (btnPrevSpan) { + _event2.default.remove(btnPrevSpan, 'click', evt.prev); + _dom2.default.remove(btnPrevSpan); + } + + if (btnLastSpan) { + _event2.default.remove(btnLastSpan, 'click', evt.last); + _dom2.default.remove(btnLastSpan); + } + + if (btnFirstSpan) { + _event2.default.remove(btnFirstSpan, 'click', evt.first); + _dom2.default.remove(btnFirstSpan); + } + + if (pgBeforeSpan) { + _dom2.default.remove(pgBeforeSpan); + } + + if (pgAfterSpan) { + _dom2.default.remove(pgAfterSpan); + } + + if (pgspan) { + _dom2.default.remove(pgspan); + } + + if (this.hasResultsPerPage) { + this.removeResultsPerPage(); + } + + this.emitter.off('after-filtering', function () { + return _this4.resetPagingInfo(); + }); + + this.pagingSlc = null; + this.nbPages = 0; + this.disable(); + this.initialized = false; + } + }]); + + return Paging; + })(_feature.Feature); + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.ClearButton = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var ClearButton = exports.ClearButton = (function (_Feature) { + _inherits(ClearButton, _Feature); + + /** + * Clear button component + * @param {Object} tf TableFilter instance + */ + + function ClearButton(tf) { + _classCallCheck(this, ClearButton); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); + + var f = _this.config; + + //id of container element + _this.btnResetTgtId = f.btn_reset_target_id || null; + //reset button element + _this.btnResetEl = null; + //defines reset text + _this.btnResetText = f.btn_reset_text || 'Reset'; + //defines reset button tooltip + _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; + //defines reset button innerHtml + _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); + //span containing reset button + _this.prfxResetSpan = 'resetspan_'; + return _this; + } + + _createClass(ClearButton, [{ + key: 'onClick', + value: function onClick() { + if (!this.isEnabled()) { + return; + } + this.tf.clearFilters(); + } + + /** + * Build DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + + if (this.initialized) { + return; + } + + var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); + + // reset button is added to defined element + if (!this.btnResetTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); + targetEl.appendChild(resetspan); + + if (!this.btnResetHtml) { + var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); + fltreset.className = tf.btnResetCssClass; + fltreset.appendChild(_dom2.default.text(this.btnResetText)); + resetspan.appendChild(fltreset); + _event2.default.add(fltreset, 'click', function () { + _this2.onClick(); + }); + } else { + resetspan.innerHTML = this.btnResetHtml; + var resetEl = resetspan.firstChild; + _event2.default.add(resetEl, 'click', function () { + _this2.onClick(); + }); + } + this.btnResetEl = resetspan.firstChild; + + this.initialized = true; + } + + /** + * Remove clear button UI + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + + if (!this.initialized) { + return; + } + + var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); + if (resetspan) { + _dom2.default.remove(resetspan); + } + this.btnResetEl = null; + this.initialized = false; + } + }]); + + return ClearButton; + })(_feature.Feature); + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Help = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; + var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; + + var Help = exports.Help = (function (_Feature) { + _inherits(Help, _Feature); + + /** + * Help UI component + * @param {Object} tf TableFilter instance + */ + + function Help(tf) { + _classCallCheck(this, Help); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); + + var f = _this.config; + + //id of custom container element for instructions + _this.tgtId = f.help_instructions_target_id || null; + //id of custom container element for instructions + _this.contTgtId = f.help_instructions_container_target_id || null; + //defines help text + _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; + //defines help innerHtml + _this.instrHtml = f.help_instructions_html || null; + //defines reset button text + _this.btnText = f.help_instructions_btn_text || '?'; + //defines reset button innerHtml + _this.btnHtml = f.help_instructions_btn_html || null; + //defines css class for help button + _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; + //defines css class for help container + _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; + //help button element + _this.btn = null; + //help content div + _this.cont = null; + _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; + + //id prefix for help elements + _this.prfxHelpSpan = 'helpSpan_'; + //id prefix for help elements + _this.prfxHelpDiv = 'helpDiv_'; + return _this; + } + + _createClass(Help, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); + var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); + + //help button is added to defined element + if (!this.tgtId) { + tf.setToolbar(); + } + var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); + targetEl.appendChild(helpspan); + + var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); + + if (!this.btnHtml) { + divContainer.appendChild(helpdiv); + var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); + helplink.className = this.btnCssClass; + helplink.appendChild(_dom2.default.text(this.btnText)); + helpspan.appendChild(helplink); + _event2.default.add(helplink, 'click', function () { + _this2.toggle(); + }); + } else { + helpspan.innerHTML = this.btnHtml; + var helpEl = helpspan.firstChild; + _event2.default.add(helpEl, 'click', function () { + _this2.toggle(); + }); + divContainer.appendChild(helpdiv); + } + + if (!this.instrHtml) { + helpdiv.innerHTML = this.instrText; + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } else { + if (this.contTgtId) { + divContainer.appendChild(helpdiv); + } + helpdiv.innerHTML = this.instrHtml; + if (!this.contTgtId) { + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } + } + helpdiv.innerHTML += this.defaultHtml; + _event2.default.add(helpdiv, 'click', function () { + _this2.toggle(); + }); + + this.cont = helpdiv; + this.btn = helpspan; + this.initialized = true; + } + + /** + * Toggle help pop-up + */ + + }, { + key: 'toggle', + value: function toggle() { + // check only if explicitily set to false as in this case undefined + // signifies the help feature is enabled by default + if (this.enabled === false) { + return; + } + var divDisplay = this.cont.style.display; + if (divDisplay === '' || divDisplay === 'none') { + this.cont.style.display = 'inline'; + } else { + this.cont.style.display = 'none'; + } + } + + /** + * Remove help UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + _dom2.default.remove(this.btn); + this.btn = null; + if (!this.cont) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + this.initialized = false; + } + }]); + + return Help; + })(_feature.Feature); + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.AlternateRows = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var AlternateRows = exports.AlternateRows = (function (_Feature) { + _inherits(AlternateRows, _Feature); + + /** + * Alternating rows color + * @param {Object} tf TableFilter instance + */ + + function AlternateRows(tf) { + _classCallCheck(this, AlternateRows); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); + + var config = _this.config; + //defines css class for even rows + _this.evenCss = config.even_row_css_class || 'even'; + //defines css class for odd rows + _this.oddCss = config.odd_row_css_class || 'odd'; + return _this; + } + + /** + * Sets alternating rows color + */ + + _createClass(AlternateRows, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + var validRowsIndex = tf.validRowsIndex; + var noValidRowsIndex = validRowsIndex === null; + //1st index + var beginIndex = noValidRowsIndex ? tf.refRow : 0; + // nb indexes + var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; + var idx = 0; + + //alternates bg color + for (var j = beginIndex; j < indexLen; j++) { + var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; + this.setRowBg(rowIdx, idx); + idx++; + } + + this.emitter.on('row-processed', function (tf, rowIndex, isValid) { + return _this2.processRow(tf, rowIndex, isValid); + }); + + this.initialized = true; + } + }, { + key: 'processRow', + value: function processRow(tf, rowIdx, isValid) { + console.log(arguments); + if (isValid) { + this.setRowBg(rowIdx, tf.validRowsIndex.length); + } else { + this.removeRowBg(rowIdx); + } + } + + /** + * Sets row background color + * @param {Number} rowIdx Row index + * @param {Number} idx Valid rows collection index needed to calculate bg + * color + */ + + }, { + key: 'setRowBg', + value: function setRowBg(rowIdx, idx) { + if (!this.isEnabled() || isNaN(rowIdx)) { + return; + } + var rows = this.tf.tbl.rows; + var i = isNaN(idx) ? rowIdx : idx; + this.removeRowBg(rowIdx); + + _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); + } + + /** + * Removes row background color + * @param {Number} idx Row index + */ + + }, { + key: 'removeRowBg', + value: function removeRowBg(idx) { + if (isNaN(idx)) { + return; + } + var rows = this.tf.tbl.rows; + _dom2.default.removeClass(rows[idx], this.oddCss); + _dom2.default.removeClass(rows[idx], this.evenCss); + } + + /** + * Removes all alternating backgrounds + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { + this.removeRowBg(i); + } + + this.emitter.off('row-processed', function (tf, rowIndex, isValid) { + return _this3.processRow(tf, rowIndex, isValid); + }); + + this.initialized = false; + } + }]); + + return AlternateRows; + })(_feature.Feature); + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.NoResults = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var NoResults = exports.NoResults = (function (_Feature) { + _inherits(NoResults, _Feature); + + /** + * No results message UI component + * @param {Object} tf TableFilter instance + */ + + function NoResults(tf) { + _classCallCheck(this, NoResults); + + //configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); + + var f = _this.config.no_results_message; + + _this.content = f.content || 'No results'; + _this.customContainer = f.custom_container || null; + _this.customContainerId = f.custom_container_id || null; + _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); + _this.cssClass = f.css_class || 'no-results'; + + _this.cont = null; + + //callback before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //callback after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + //callback before message is hidden + _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; + //callback after message is hidden + _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; + + _this.prfxNoResults = 'nores_'; + return _this; + } + + _createClass(NoResults, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + var tf = this.tf; + var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; + + //container + var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); + cont.className = this.cssClass; + cont.innerHTML = this.content; + + if (this.isExternal) { + target.appendChild(cont); + } else { + target.parentNode.insertBefore(cont, target.nextSibling); + } + + this.cont = cont; + + // subscribe to after-filtering event + this.emitter.on('after-filtering', function () { + return _this2.toggle(); + }); + + this.initialized = true; + this.hide(); + } + }, { + key: 'toggle', + value: function toggle() { + if (this.tf.nbVisibleRows > 0) { + this.hide(); + } else { + this.show(); + } + } + }, { + key: 'show', + value: function show() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, this); + } + + this.setWidth(); + this.cont.style.display = 'block'; + + if (this.onAfterShowMsg) { + this.onAfterShowMsg.call(null, this.tf, this); + } + } + }, { + key: 'hide', + value: function hide() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + + this.cont.style.display = 'none'; + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + } + }, { + key: 'setWidth', + value: function setWidth() { + if (!this.initialized || this.isExternal || !this.isEnabled()) { + return; + } + if (this.tf.gridLayout) { + var gridLayout = this.tf.feature('gridLayout'); + this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; + } else { + this.cont.style.width = this.tf.tbl.clientWidth + 'px'; + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + // unsubscribe to after-filtering event + this.emitter.off('after-filtering', function () { + return _this3.toggle(); + }); + this.initialized = false; + } + }]); + + return NoResults; + })(_feature.Feature); + +/***/ } +/******/ ]) +}); +; +//# sourceMappingURL=tablefilter.js.map \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 6bc37a2f..58cc1966 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,8 +1,2218 @@ -/** - * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-30T05:48:52.421Z - * MIT License - */ +webpackJsonp([1],{ -webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),g=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+g?d[l+g]:[u-1]:l-g<=d[0]?d[0]:d[l-g],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var m=l+g;o=m>u-1?d[u-1]:d[m]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-g];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var g=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),g&&g.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(m){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off("after-filtering",function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file +/***/ 26: +/***/ function(module, exports, __webpack_require__) { + + var map = { + "./array": 6, + "./array.js": 6, + "./cookie": 4, + "./cookie.js": 4, + "./date": 7, + "./date.js": 7, + "./dom": 2, + "./dom.js": 2, + "./emitter": 9, + "./emitter.js": 9, + "./event": 1, + "./event.js": 1, + "./extensions/advancedGrid/adapterEzEditTable": 27, + "./extensions/advancedGrid/adapterEzEditTable.js": 27, + "./extensions/advancedGrid/advancedGrid": 28, + "./extensions/advancedGrid/advancedGrid.js": 28, + "./extensions/colOps/colOps": 29, + "./extensions/colOps/colOps.js": 29, + "./extensions/colsVisibility/colsVisibility": 30, + "./extensions/colsVisibility/colsVisibility.js": 30, + "./extensions/filtersVisibility/filtersVisibility": 31, + "./extensions/filtersVisibility/filtersVisibility.js": 31, + "./extensions/sort/adapterSortabletable": 32, + "./extensions/sort/adapterSortabletable.js": 32, + "./extensions/sort/sort": 33, + "./extensions/sort/sort.js": 33, + "./helpers": 8, + "./helpers.js": 8, + "./modules/alternateRows": 24, + "./modules/alternateRows.js": 24, + "./modules/checkList": 18, + "./modules/checkList.js": 18, + "./modules/clearButton": 22, + "./modules/clearButton.js": 22, + "./modules/dropdown": 16, + "./modules/dropdown.js": 16, + "./modules/feature": 12, + "./modules/feature.js": 12, + "./modules/gridLayout": 11, + "./modules/gridLayout.js": 11, + "./modules/help": 23, + "./modules/help.js": 23, + "./modules/highlightKeywords": 14, + "./modules/highlightKeywords.js": 14, + "./modules/loader": 13, + "./modules/loader.js": 13, + "./modules/noResults": 25, + "./modules/noResults.js": 25, + "./modules/paging": 21, + "./modules/paging.js": 21, + "./modules/popupFilter": 15, + "./modules/popupFilter.js": 15, + "./modules/rowsCounter": 19, + "./modules/rowsCounter.js": 19, + "./modules/statusBar": 20, + "./modules/statusBar.js": 20, + "./modules/store": 10, + "./modules/store.js": 10, + "./sort": 17, + "./sort.js": 17, + "./string": 3, + "./string.js": 3, + "./types": 5, + "./types.js": 5 + }; + function webpackContext(req) { + return __webpack_require__(webpackContextResolve(req)); + }; + function webpackContextResolve(req) { + return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); + }; + webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); + }; + webpackContext.resolve = webpackContextResolve; + module.exports = webpackContext; + webpackContext.id = 26; + + +/***/ }, + +/***/ 27: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterEzEditTable = (function () { + /** + * Adapter module for ezEditTable, an external library providing advanced + * grid features (selection and edition): + * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus + * + * @param {Object} tf TableFilter instance + */ + + function AdapterEzEditTable(tf, cfg) { + _classCallCheck(this, AdapterEzEditTable); + + // ezEditTable config + this.initialized = false; + this.desc = cfg.description || 'ezEditTable adapter'; + this.filename = cfg.filename || 'ezEditTable.js'; + this.vendorPath = cfg.vendor_path; + this.loadStylesheet = Boolean(cfg.load_stylesheet); + this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; + this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; + this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; + // Enable the ezEditTable's scroll into view behaviour if grid layout on + cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; + + this._ezEditTable = null; + this.cfg = cfg; + this.tf = tf; + } + + /** + * Conditionally load ezEditTable library and set advanced grid + * @return {[type]} [description] + */ + + _createClass(AdapterEzEditTable, [{ + key: 'init', + value: function init() { + var _this = this; + + var tf = this.tf; + if (window.EditTable) { + this._setAdvancedGrid(); + } else { + var path = this.vendorPath + this.filename; + tf.import(this.filename, path, function () { + _this._setAdvancedGrid(); + }); + } + if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { + tf.import(this.stylesheetName, this.stylesheet, null, 'link'); + } + } + + /** + * Instantiate ezEditTable component for advanced grid features + */ + + }, { + key: '_setAdvancedGrid', + value: function _setAdvancedGrid() { + var tf = this.tf; + + //start row for EditTable constructor needs to be calculated + var startRow, + cfg = this.cfg, + thead = _dom2.default.tag(tf.tbl, 'thead'); + + //if thead exists and startRow not specified, startRow is calculated + //automatically by EditTable + if (thead.length > 0 && !cfg.startRow) { + startRow = undefined; + } + //otherwise startRow config property if any or TableFilter refRow + else { + startRow = cfg.startRow || tf.refRow; + } + + cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; + var editable = cfg.editable; + var selectable = cfg.selection; + + if (selectable) { + cfg.default_selection = cfg.default_selection || 'row'; + } + //CSS Styles + cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; + + var _lastValidRowIndex = 0; + var _lastRowIndex = 0; + + if (selectable) { + //Row navigation needs to be calculated according to TableFilter's + //validRowsIndex array + var onAfterSelection = function onAfterSelection(et, selectedElm, e) { + var slc = et.Selection; + //Next valid filtered row needs to be selected + var doSelect = function doSelect(nextRowIndex) { + if (et.defaultSelection === 'row') { + slc.SelectRowByIndex(nextRowIndex); + } else { + et.ClearSelections(); + var cellIndex = selectedElm.cellIndex, + row = tf.tbl.rows[nextRowIndex]; + if (et.defaultSelection === 'both') { + slc.SelectRowByIndex(nextRowIndex); + } + if (row) { + slc.SelectCell(row.cells[cellIndex]); + } + } + //Table is filtered + if (tf.validRowsIndex.length !== tf.getRowsNb()) { + var r = tf.tbl.rows[nextRowIndex]; + if (r) { + r.scrollIntoView(false); + } + if (cell) { + if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { + tf.tblCont.scrollLeft = 100000000; + } else if (cell.cellIndex === 0 && tf.gridLayout) { + tf.tblCont.scrollLeft = 0; + } else { + cell.scrollIntoView(false); + } + } + } + }; + + //table is not filtered + if (!tf.validRowsIndex) { + return; + } + var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, + nextRowIndex, + paging = tf.feature('paging'), + + //pgup/pgdown keys + d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { + //last row + if (row.rowIndex >= validIndexes[validIdxLen - 1]) { + nextRowIndex = validIndexes[validIdxLen - 1]; + } else { + var calcRowIndex = _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[_lastValidRowIndex - d]; + nextRowIndex = v ? v : validIndexes[0]; + } + } + _lastRowIndex = row.rowIndex; + doSelect(nextRowIndex); + } else { + //If filtered row is valid, special calculation for + //pgup/pgdown keys + if (keyCode !== 34 && keyCode !== 33) { + _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); + _lastRowIndex = row.rowIndex; + } else { + if (keyCode === 34) { + //pgdown + //last row + if (_lastValidRowIndex + d <= validIdxLen - 1) { + nextRowIndex = validIndexes[_lastValidRowIndex + d]; + } else { + nextRowIndex = [validIdxLen - 1]; + } + } else { + //pgup + //first row + if (_lastValidRowIndex - d <= validIndexes[0]) { + nextRowIndex = validIndexes[0]; + } else { + nextRowIndex = validIndexes[_lastValidRowIndex - d]; + } + } + _lastRowIndex = nextRowIndex; + _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); + doSelect(nextRowIndex); + } + } + }; + + //Page navigation has to be enforced whenever selected row is out of + //the current page range + var onBeforeSelection = function onBeforeSelection(et, selectedElm) { + var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; + if (tf.paging) { + if (tf.feature('paging').nbPages > 1) { + var paging = tf.feature('paging'); + //page length is re-assigned in case it has changed + et.nbRowsPerPage = paging.pagingLength; + var validIndexes = tf.validRowsIndex, + validIdxLen = validIndexes.length, + pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); + var rowIndex = row.rowIndex; + + if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { + paging.setPage('last'); + } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { + paging.setPage('first'); + } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { + paging.setPage('next'); + } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { + paging.setPage('previous'); + } + } + } + }; + + //Selected row needs to be visible when paging is activated + if (tf.paging) { + tf.feature('paging').onAfterChangePage = function (paging) { + var advGrid = paging.tf.extension('advancedGrid'); + var et = advGrid._ezEditTable; + var slc = et.Selection; + var row = slc.GetActiveRow(); + if (row) { + row.scrollIntoView(false); + } + var cell = slc.GetActiveCell(); + if (cell) { + cell.scrollIntoView(false); + } + }; + } + + //Rows navigation when rows are filtered is performed with the + //EditTable row selection callback events + if (cfg.default_selection === 'row') { + var fnB = cfg.on_before_selected_row; + cfg.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 = cfg.on_after_selected_row; + cfg.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 = cfg.on_before_selected_cell; + cfg.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 = cfg.on_after_selected_cell; + cfg.on_after_selected_cell = function () { + onAfterSelection(arguments[0], arguments[1], arguments[2]); + if (fnC) { + fnC.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + } + } + if (editable) { + //Added or removed rows, TF rows number needs to be re-calculated + var fnE = cfg.on_added_dom_row; + cfg.on_added_dom_row = function () { + tf.nbFilterableRows++; + if (!tf.paging) { + tf.emitter.emit('rows-changed', tf, this); + //tf.feature('rowsCounter').refresh(); + } else { + tf.nbRows++; + tf.nbVisibleRows++; + tf.nbFilterableRows++; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnE) { + fnE.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + if (cfg.actions && cfg.actions['delete']) { + var fnF = cfg.actions['delete'].on_after_submit; + cfg.actions['delete'].on_after_submit = function () { + tf.nbFilterableRows--; + if (!tf.paging) { + // tf.feature('rowsCounter').refresh(); + tf.emitter.emit('rows-changed', tf, this); + } else { + tf.nbRows--; + tf.nbVisibleRows--; + tf.nbFilterableRows--; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(false); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnF) { + fnF.call(null, arguments[0], arguments[1]); + } + }; + } + } + + try { + this._ezEditTable = new EditTable(tf.id, cfg, startRow); + this._ezEditTable.Init(); + } catch (e) { + throw new Error(this.err); + } + + this.initialized = true; + } + + /** + * Reset advanced grid when previously removed + */ + + }, { + key: 'reset', + value: function reset() { + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.Set(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Set(); + } + } + } + + /** + * Remove advanced grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.ClearSelections(); + ezEditTable.Selection.Remove(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Remove(); + } + } + this.initialized = false; + } + }]); + + return AdapterEzEditTable; + })(); + + exports.default = AdapterEzEditTable; + +/***/ }, + +/***/ 28: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterEzEditTable = __webpack_require__(27); + + var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = _adapterEzEditTable2.default; + +/***/ }, + +/***/ 29: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColOps = (function () { + + /** + * Column calculations + * @param {Object} tf TableFilter instance + */ + + function ColOps(tf, opts) { + _classCallCheck(this, ColOps); + + //calls function before col operation + this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; + //calls function after col operation + this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; + + this.opts = opts; + this.tf = tf; + } + + _createClass(ColOps, [{ + key: 'init', + value: function init() { + var _this = this; + + // subscribe to events + this.tf.emitter.on('after-filtering', function () { + return _this.calc(); + }); + + this.calc(); + } + + /** + * Calculates columns' values + * Configuration options are stored in 'opts' property + * - 'id' contains ids of elements showing result (array) + * - 'col' contains the columns' indexes (array) + * - 'operation' contains operation type (array, values: 'sum', 'mean', + * 'min', 'max', 'median', 'q1', 'q3') + * - 'write_method' array defines which method to use for displaying the + * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' + * - 'tot_row_index' defines in which row results are displayed + * (integers array) + * + * - changes made by Nuovella: + * (1) optimized the routine (now it will only process each column once), + * (2) added calculations for the median, lower and upper quartile. + */ + + }, { + key: 'calc', + value: function calc() { + var tf = this.tf; + if (!tf.isFirstLoad && !tf.hasGrid()) { + return; + } + + if (this.onBeforeOperation) { + this.onBeforeOperation.call(null, tf); + } + + var opts = this.opts, + labelId = opts.id, + colIndex = opts.col, + operation = opts.operation, + outputType = opts.write_method, + totRowIndex = opts.tot_row_index, + excludeRow = opts.exclude_row, + decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; + + //nuovella: determine unique list of columns to operate on + var ucolIndex = [], + ucolMax = 0; + ucolIndex[ucolMax] = colIndex[0]; + + for (var ii = 1; ii < colIndex.length; ii++) { + var saved = 0; + //see if colIndex[ii] is already in the list of unique indexes + for (var jj = 0; jj <= ucolMax; jj++) { + if (ucolIndex[jj] === colIndex[ii]) { + saved = 1; + } + } + //if not saved then, save the index; + if (saved === 0) { + ucolMax++; + ucolIndex[ucolMax] = colIndex[ii]; + } + } + + if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { + var rows = tf.tbl.rows, + colvalues = []; + + for (var ucol = 0; ucol <= ucolMax; ucol++) { + //this retrieves col values + //use ucolIndex because we only want to pass through this loop + //once for each column get the values in this unique column + colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); + + //next: calculate all operations for this column + 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; + + for (var k = 0; k < colIndex.length; k++) { + if (colIndex[k] === ucolIndex[ucol]) { + mThisCol++; + opsThisCol[mThisCol] = _string2.default.lower(operation[k]); + decThisCol[mThisCol] = decimalPrecision[k]; + labThisCol[mThisCol] = labelId[k]; + oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; + + switch (opsThisCol[mThisCol]) { + case 'mean': + meanFlag = 1; + break; + case 'sum': + sumFlag = 1; + break; + case 'min': + minFlag = 1; + break; + case 'max': + maxFlag = 1; + break; + case 'median': + medFlag = 1; + break; + case 'q1': + q1Flag = 1; + break; + case 'q3': + q3Flag = 1; + break; + } + } + } + + for (var j = 0; j < colvalues[ucol].length; j++) { + //sort the list for calculation of median and quartiles + if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { + if (j < colvalues[ucol].length - 1) { + for (k = j + 1; k < colvalues[ucol].length; k++) { + if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { + temp = colvalues[ucol][j]; + colvalues[ucol][j] = colvalues[ucol][k]; + colvalues[ucol][k] = temp; + } + } + } + } + var cvalue = parseFloat(colvalues[ucol][j]); + theList[j] = parseFloat(cvalue); + + if (!isNaN(cvalue)) { + nbvalues++; + if (sumFlag === 1 || meanFlag === 1) { + sumValue += parseFloat(cvalue); + } + if (minFlag === 1) { + if (minValue === null) { + minValue = parseFloat(cvalue); + } else { + minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; + } + } + if (maxFlag === 1) { + if (maxValue === null) { + maxValue = parseFloat(cvalue); + } else { + maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; + } + } + } + } //for j + if (meanFlag === 1) { + meanValue = sumValue / nbvalues; + } + if (medFlag === 1) { + var aux = 0; + if (nbvalues % 2 === 1) { + aux = Math.floor(nbvalues / 2); + medValue = theList[aux]; + } else { + medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; + } + } + var posa; + if (q1Flag === 1) { + posa = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa == nbvalues) { + q1Value = (theList[posa - 1] + theList[posa]) / 2; + } else { + q1Value = theList[posa]; + } + } + if (q3Flag === 1) { + posa = 0.0; + var posb = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa === nbvalues) { + posb = 3 * posa; + q3Value = (theList[posb] + theList[posb - 1]) / 2; + } else { + q3Value = theList[nbvalues - posa - 1]; + } + } + + for (var i = 0; i <= mThisCol; i++) { + switch (opsThisCol[i]) { + case 'mean': + result = meanValue; + break; + case 'sum': + result = sumValue; + break; + case 'min': + result = minValue; + break; + case 'max': + result = maxValue; + break; + case 'median': + result = medValue; + break; + case 'q1': + result = q1Value; + break; + case 'q3': + result = q3Value; + break; + } + + var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; + + //if outputType is defined + if (oTypeThisCol && result) { + result = result.toFixed(precision); + + if (_dom2.default.id(labThisCol[i])) { + switch (_string2.default.lower(oTypeThisCol)) { + case 'innerhtml': + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result; + } + break; + case 'setvalue': + _dom2.default.id(labThisCol[i]).value = result; + break; + case 'createtextnode': + var oldnode = _dom2.default.id(labThisCol[i]).firstChild; + var txtnode = _dom2.default.text(result); + _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); + break; + } //switch + } + } else { + try { + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); + } + } catch (e) {} //catch + } //else + } //for i + + // row(s) with result are always visible + var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; + if (totRow) { + totRow.style.display = ''; + } + } //for ucol + } //if typeof + + if (this.onAfterOperation) { + this.onAfterOperation.call(null, tf); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + // unsubscribe to events + this.tf.emitter.off('after-filtering', function () { + return _this2.calc(); + }); + } + }]); + + return ColOps; + })(); + + exports.default = ColOps; + +/***/ }, + +/***/ 30: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColsVisibility = (function () { + + /** + * Columns Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function ColsVisibility(tf, f) { + _classCallCheck(this, ColsVisibility); + + // Configuration object + var cfg = tf.config(); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Columns visibility manager'; + + //show/hide cols span element + this.spanEl = null; + //show/hide cols button element + this.btnEl = null; + //show/hide cols container div element + this.contEl = null; + + //tick to hide or show column + this.tickToHide = f.tick_to_hide === false ? false : true; + //enables/disables cols manager generation + this.manager = f.manager === false ? false : true; + //only if external headers + this.headersTbl = f.headers_table || false; + //only if external headers + this.headersIndex = f.headers_index || 1; + //id of container element + this.contElTgtId = f.container_target_id || null; + //alternative headers text + this.headersText = f.headers_text || null; + //id of button container element + this.btnTgtId = f.btn_target_id || null; + //defines show/hide cols text + this.btnText = f.btn_text || 'Columns▼'; + //defines show/hide cols button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for show/hide cols button + this.btnCssClass = f.btn_css_class || 'colVis'; + //defines close link text + this.btnCloseText = f.btn_close_text || 'Close'; + //defines close button innerHtml + this.btnCloseHtml = f.btn_close_html || null; + //defines css class for close button + this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; + this.stylesheet = f.stylesheet || 'colsVisibility.css'; + //span containing show/hide cols button + this.prfx = 'colVis_'; + //defines css class span containing show/hide cols + this.spanCssClass = f.span_css_class || 'colVisSpan'; + this.prfxCont = this.prfx + 'Cont_'; + //defines css class div containing show/hide cols + this.contCssClass = f.cont_css_class || 'colVisCont'; + //defines css class for cols list (ul) + this.listCssClass = cfg.list_css_class || 'cols_checklist'; + //defines css class for list item (li) + this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; + //defines css class for selected list item (li) + this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; + //text preceding columns list + this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); + this.atStart = f.at_start || null; + this.enableHover = Boolean(f.enable_hover); + //enables select all option + this.enableTickAll = Boolean(f.enable_tick_all); + //text preceding columns list + this.tickAllText = f.tick_all_text || 'Select all:'; + + //array containing hidden columns indexes + this.hiddenCols = []; + this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; + + //callback invoked just after cols manager is loaded + this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; + //calls function before cols manager is opened + this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; + //calls function after cols manager is opened + this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; + //calls function before cols manager is closed + this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; + //calls function after cols manager is closed + this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; + + //callback before col is hidden + this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; + //callback after col is hidden + this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; + //callback before col is displayed + this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; + //callback after col is displayed + this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; + + //Grid layout compatibility + if (tf.gridLayout) { + this.headersTbl = tf.feature('gridLayout').headTbl; //headers table + this.headersIndex = 0; //headers index + this.onAfterColDisplayed = function () {}; + this.onAfterColHidden = function () {}; + } + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + _createClass(ColsVisibility, [{ + key: 'toggle', + value: function toggle() { + var contDisplay = this.contEl.style.display; + var onBeforeOpen = this.onBeforeOpen; + var onBeforeClose = this.onBeforeClose; + var onAfterOpen = this.onAfterOpen; + var onAfterClose = this.onAfterClose; + + if (onBeforeOpen && contDisplay !== 'inline') { + onBeforeOpen.call(null, this); + } + if (onBeforeClose && contDisplay === 'inline') { + onBeforeClose.call(null, this); + } + + this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; + + if (onAfterOpen && contDisplay !== 'inline') { + onAfterOpen.call(null, this); + } + if (onAfterClose && contDisplay === 'inline') { + onAfterClose.call(null, this); + } + } + }, { + key: 'checkItem', + value: function checkItem(lbl) { + var li = lbl.parentNode; + if (!li || !lbl) { + return; + } + var isChecked = lbl.firstChild.checked; + var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; + colIndex = parseInt(colIndex, 10); + if (isChecked) { + _dom2.default.addClass(li, this.listSlcItemCssClass); + } else { + _dom2.default.removeClass(li, this.listSlcItemCssClass); + } + + var hide = false; + if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { + hide = true; + } + this.setHidden(colIndex, hide); + } + }, { + key: 'init', + value: function init() { + if (!this.manager) { + return; + } + this.buildBtn(); + this.buildManager(); + + this.initialized = true; + } + + /** + * Build main button UI + */ + + }, { + key: 'buildBtn', + value: function buildBtn() { + var _this = this; + + if (this.btnEl) { + return; + } + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.spanCssClass; + + //Container element (rdiv or custom element) + if (!this.btnTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); + + if (!this.btnTgtId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + if (!this.btnHtml) { + var btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCssClass; + btn.title = this.desc; + + btn.innerHTML = this.btnText; + span.appendChild(btn); + if (!this.enableHover) { + _event2.default.add(btn, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(btn, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } else { + //Custom html + span.innerHTML = this.btnHtml; + var colVisEl = span.firstChild; + if (!this.enableHover) { + _event2.default.add(colVisEl, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(colVisEl, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } + + this.spanEl = span; + this.btnEl = this.spanEl.firstChild; + + if (this.onLoaded) { + this.onLoaded.call(null, this); + } + } + + /** + * Build columns manager UI + */ + + }, { + key: 'buildManager', + value: function buildManager() { + var _this2 = this; + + var tf = this.tf; + + var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); + container.className = this.contCssClass; + + //Extension description + var extNameLabel = _dom2.default.create('p'); + extNameLabel.innerHTML = this.text; + container.appendChild(extNameLabel); + + //Headers list + var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); + ul.className = this.listCssClass; + + var tbl = this.headersTbl ? this.headersTbl : tf.tbl; + var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); + var headerRow = tbl.rows[headerIndex]; + + //Tick all option + if (this.enableTickAll) { + var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); + _dom2.default.addClass(li, this.listItemCssClass); + ul.appendChild(li); + li.check.checked = !this.tickToHide; + + _event2.default.add(li.check, 'click', function () { + for (var h = 0; h < headerRow.cells.length; h++) { + var itm = _dom2.default.id('col_' + h + '_' + tf.id); + if (itm && li.check.checked !== itm.checked) { + itm.click(); + itm.checked = li.check.checked; + } + } + }); + } + + for (var i = 0; i < headerRow.cells.length; i++) { + var cell = headerRow.cells[i]; + var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); + var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); + _dom2.default.addClass(liElm, this.listItemCssClass); + if (!this.tickToHide) { + _dom2.default.addClass(liElm, this.listSlcItemCssClass); + } + ul.appendChild(liElm); + if (!this.tickToHide) { + liElm.check.checked = true; + } + + _event2.default.add(liElm.check, 'click', function (evt) { + var elm = _event2.default.target(evt); + var lbl = elm.parentNode; + _this2.checkItem(lbl); + }); + } + + //separator + var p = _dom2.default.create('p', ['align', 'center']); + var btn; + //Close link + if (!this.btnCloseHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCloseCssClass; + btn.innerHTML = this.btnCloseText; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + p.appendChild(btn); + } else { + p.innerHTML = this.btnCloseHtml; + btn = p.firstChild; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + } + + container.appendChild(ul); + container.appendChild(p); + + this.btnEl.parentNode.insertBefore(container, this.btnEl); + this.contEl = container; + + if (this.atStart) { + var a = this.atStart; + for (var k = 0; k < a.length; k++) { + var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); + if (itm) { + itm.click(); + } + } + } + } + + /** + * Hide or show specified columns + * @param {Numner} colIndex Column index + * @param {Boolean} hide hide column if true or show if false + */ + + }, { + key: 'setHidden', + value: function setHidden(colIndex, hide) { + var tf = this.tf; + var tbl = tf.tbl; + + if (this.onBeforeColHidden && hide) { + this.onBeforeColHidden.call(null, this, colIndex); + } + if (this.onBeforeColDisplayed && !hide) { + this.onBeforeColDisplayed.call(null, this, colIndex); + } + + this._hideCells(tbl, colIndex, hide); + if (this.headersTbl) { + this._hideCells(this.headersTbl, colIndex, hide); + } + + var hiddenCols = this.hiddenCols; + var itemIndex = hiddenCols.indexOf(colIndex); + if (hide) { + if (itemIndex === -1) { + this.hiddenCols.push(colIndex); + } + } else { + if (itemIndex !== -1) { + this.hiddenCols.splice(itemIndex, 1); + } + } + + var gridLayout; + var headTbl; + var gridColElms; + if (this.onAfterColHidden && hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); + + var headTblW = parseInt(headTbl.style.width, 10); + headTbl.style.width = headTblW - hiddenWidth + 'px'; + tbl.style.width = headTbl.style.width; + } + this.onAfterColHidden.call(null, this, colIndex); + } + + if (this.onAfterColDisplayed && !hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var width = parseInt(gridColElms[colIndex].style.width, 10); + headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; + tf.tbl.style.width = headTbl.style.width; + } + this.onAfterColDisplayed.call(null, this, colIndex); + } + } + + /** + * Show specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'showCol', + value: function showCol(colIndex) { + if (colIndex === undefined || !this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, false); + } + } + + /** + * Hide specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'hideCol', + value: function hideCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, true); + } + } + + /** + * Determine if specified column is hidden + * @param {Number} colIndex Column index + */ + + }, { + key: 'isColHidden', + value: function isColHidden(colIndex) { + if (this.hiddenCols.indexOf(colIndex) !== -1) { + return true; + } + return false; + } + + /** + * Toggle visibility of specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggleCol', + value: function toggleCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + this.showCol(colIndex); + } else { + this.hideCol(colIndex); + } + } + + /** + * Returns the indexes of the columns currently hidden + * @return {Array} column indexes + */ + + }, { + key: 'getHiddenCols', + value: function getHiddenCols() { + return this.hiddenCols; + } + + /** + * Remove the columns manager + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + if (_dom2.default.id(this.contElTgtId)) { + _dom2.default.id(this.contElTgtId).innerHTML = ''; + } else { + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + } + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + this.initialized = false; + } + }, { + key: '_getHeaderText', + value: function _getHeaderText(cell) { + if (!cell.hasChildNodes) { + return ''; + } + + for (var i = 0; i < cell.childNodes.length; i++) { + var n = cell.childNodes[i]; + if (n.nodeType === 3) { + return n.nodeValue; + } else if (n.nodeType === 1) { + if (n.id && n.id.indexOf('popUp') !== -1) { + continue; + } else { + return _dom2.default.getText(n); + } + } + continue; + } + return ''; + } + }, { + key: '_hideCells', + value: function _hideCells(tbl, colIndex, hide) { + for (var i = 0; i < tbl.rows.length; i++) { + var row = tbl.rows[i]; + var cell = row.cells[colIndex]; + if (cell) { + cell.style.display = hide ? 'none' : ''; + } + } + } + }]); + + return ColsVisibility; + })(); + + exports.default = ColsVisibility; + +/***/ }, + +/***/ 31: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var FiltersVisibility = (function () { + + /** + * Filters Row Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function FiltersVisibility(tf, f) { + _classCallCheck(this, FiltersVisibility); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Filters row visibility manager'; + + // Path and image filenames + this.stylesheet = f.stylesheet || 'filtersVisibility.css'; + this.icnExpand = f.expand_icon_name || 'icn_exp.png'; + this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; + + //expand/collapse filters span element + this.contEl = null; + //expand/collapse filters btn element + this.btnEl = null; + + this.icnExpandHtml = 'Expand filters'; + this.icnCollapseHtml = 'Collapse filters'; + this.defaultText = 'Toggle filters'; + + //id of container element + this.targetId = f.target_id || null; + //enables/disables expand/collapse icon + this.enableIcon = f.enable_icon === false ? false : true; + this.btnText = f.btn_text || ''; + + //defines expand/collapse filters text + this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; + this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; + + //defines expand/collapse filters button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for expand/collapse filters button + this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; + //defines css class span containing expand/collapse filters + this.contCssClass = f.cont_css_class || 'expClpFlt'; + this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); + + this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; + + // Prefix + this.prfx = 'fltsVis_'; + + //callback before filters row is shown + this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; + //callback after filters row is shown + this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; + //callback before filters row is hidden + this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; + //callback after filters row is hidden + this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + /** + * Initialise extension + */ + + _createClass(FiltersVisibility, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + this.buildUI(); + this.initialized = true; + } + + /** + * Build UI elements + */ + + }, { + key: 'buildUI', + value: function buildUI() { + var _this = this; + + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.contCssClass; + + //Container element (rdiv or custom element) + if (!this.targetId) { + tf.setToolbar(); + } + var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); + + if (!this.targetId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + var btn = undefined; + if (!this.btnHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); + btn.className = this.btnCssClass; + btn.title = this.btnText || this.defaultText; + btn.innerHTML = this.collapseBtnHtml; + span.appendChild(btn); + } else { + //Custom html + span.innerHTML = this.btnHtml; + btn = span.firstChild; + } + + _event2.default.add(btn, 'click', function () { + return _this.toggle(); + }); + + this.contEl = span; + this.btnEl = btn; + + if (!this.visibleAtStart) { + this.toggle(); + } + } + + /** + * Toggle filters visibility + */ + + }, { + key: 'toggle', + value: function toggle() { + var tf = this.tf; + var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; + var fltRow = tbl.rows[this.filtersRowIndex]; + var fltRowDisplay = fltRow.style.display; + + if (this.onBeforeShow && fltRowDisplay !== '') { + this.onBeforeShow.call(this, this); + } + if (this.onBeforeHide && fltRowDisplay === '') { + this.onBeforeHide.call(null, this); + } + + fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; + if (this.enableIcon && !this.btnHtml) { + this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; + } + + if (this.onAfterShow && fltRowDisplay !== '') { + this.onAfterShow.call(null, this); + } + if (this.onAfterHide && fltRowDisplay === '') { + this.onAfterHide.call(null, this); + } + } + + /** + * Destroy the UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + this.initialized = false; + } + }]); + + return FiltersVisibility; + })(); + + exports.default = FiltersVisibility; + +/***/ }, + +/***/ 32: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterSortableTable = (function () { + + /** + * SortableTable Adapter module + * @param {Object} tf TableFilter instance + */ + + function AdapterSortableTable(tf, opts) { + _classCallCheck(this, AdapterSortableTable); + + this.initialized = false; + this.name = opts.name; + this.desc = opts.description || 'Sortable table'; + + //indicates if tables was sorted + this.sorted = false; + + this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; + this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; + this.asyncSort = Boolean(opts.async_sort); + this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; + + // edit .sort-arrow.descending / .sort-arrow.ascending in + // tablefilter.css to reflect any path change + this.imgPath = opts.images_path || tf.themesPath; + this.imgBlank = opts.image_blank || 'blank.png'; + this.imgClassName = opts.image_class_name || 'sort-arrow'; + this.imgAscClassName = opts.image_asc_class_name || 'ascending'; + this.imgDescClassName = opts.image_desc_class_name || 'descending'; + //cell attribute storing custom key + this.customKey = opts.custom_key || 'data-tf-sortKey'; + + // callback invoked after sort is loaded and instanciated + this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; + // callback invoked before table is sorted + this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; + // callback invoked after table is sorted + this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; + + this.tf = tf; + } + + _createClass(AdapterSortableTable, [{ + key: 'init', + value: function init() { + var tf = this.tf; + var adpt = this; + + // SortableTable class sanity check (sortabletable.js) + if (_types2.default.isUndef(SortableTable)) { + throw new Error('SortableTable class not found.'); + } + + this.overrideSortableTable(); + this.setSortTypes(); + + //Column sort at start + var sortColAtStart = adpt.sortColAtStart; + if (sortColAtStart) { + this.stt.sort(sortColAtStart[0], sortColAtStart[1]); + } + + if (this.onSortLoaded) { + this.onSortLoaded.call(null, tf, this); + } + + /*** SortableTable callbacks ***/ + this.stt.onbeforesort = function () { + if (adpt.onBeforeSort) { + adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); + } + + /*** sort behaviour for paging ***/ + if (tf.paging) { + tf.feature('paging').disable(); + } + }; + + this.stt.onsort = function () { + adpt.sorted = true; + + //rows alternating bg issue + // TODO: move into AlternateRows component + if (tf.alternateRows) { + var rows = tf.tbl.rows, + c = 0; + + var setClass = function setClass(row, i, removeOnly) { + if (_types2.default.isUndef(removeOnly)) { + removeOnly = false; + } + var altRows = tf.feature('alternateRows'), + oddCls = altRows.oddCss, + evenCls = altRows.evenCss; + _dom2.default.removeClass(row, oddCls); + _dom2.default.removeClass(row, evenCls); + + if (!removeOnly) { + _dom2.default.addClass(row, i % 2 ? oddCls : evenCls); + } + }; + + for (var i = tf.refRow; i < tf.nbRows; i++) { + var isRowValid = rows[i].getAttribute('validRow'); + if (tf.paging && rows[i].style.display === '') { + setClass(rows[i], c); + c++; + } else { + if ((isRowValid === 'true' || isRowValid === null) && rows[i].style.display === '') { + setClass(rows[i], c); + c++; + } else { + setClass(rows[i], c, true); + } + } + } + } + //sort behaviour for paging + if (tf.paging) { + var paginator = tf.feature('paging'); + // recalculate valid rows index as sorting may have change it + tf.getValidRows(true); + paginator.enable(); + paginator.setPage(paginator.getPage()); + } + + if (adpt.onAfterSort) { + adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); + } + }; + + this.initialized = true; + } + + /** + * Sort specified column + * @param {Number} colIdx Column index + * @param {Boolean} desc Optional: descending manner + */ + + }, { + key: 'sortByColumnIndex', + value: function sortByColumnIndex(colIdx, desc) { + this.stt.sort(colIdx, desc); + } + }, { + key: 'overrideSortableTable', + value: function overrideSortableTable() { + var adpt = this, + tf = this.tf; + + /** + * Overrides headerOnclick method in order to handle th event + * @param {Object} e [description] + */ + SortableTable.prototype.headerOnclick = function (evt) { + if (!adpt.initialized) { + return; + } + + // find Header element + var el = evt.target || evt.srcElement; + + while (el.tagName !== 'TD' && el.tagName !== 'TH') { + el = el.parentNode; + } + + this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); + }; + + /** + * Overrides getCellIndex IE returns wrong cellIndex when columns are + * hidden + * @param {Object} oTd TD element + * @return {Number} Cell index + */ + SortableTable.getCellIndex = function (oTd) { + var cells = oTd.parentNode.cells, + l = cells.length, + i = undefined; + for (i = 0; cells[i] != oTd && i < l; i++) {} + return i; + }; + + /** + * Overrides initHeader in order to handle filters row position + * @param {Array} oSortTypes + */ + SortableTable.prototype.initHeader = function (oSortTypes) { + var stt = this; + if (!stt.tHead) { + if (tf.gridLayout) { + stt.tHead = tf.feature('gridLayout').headTbl.tHead; + } else { + return; + } + } + + stt.headersRow = tf.headersRow; + var cells = stt.tHead.rows[stt.headersRow].cells; + stt.sortTypes = oSortTypes || []; + var l = cells.length; + var img = undefined, + c = undefined; + + for (var i = 0; i < l; i++) { + c = cells[i]; + if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { + c.style.cursor = 'pointer'; + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + c.appendChild(img); + if (stt.sortTypes[i] !== null) { + c.setAttribute('_sortType', stt.sortTypes[i]); + } + _event2.default.add(c, 'click', stt._headerOnclick); + } else { + c.setAttribute('_sortType', oSortTypes[i]); + c._sortType = 'None'; + } + } + stt.updateHeaderArrows(); + }; + + /** + * Overrides updateHeaderArrows in order to handle arrows indicators + */ + SortableTable.prototype.updateHeaderArrows = function () { + var stt = this; + var cells = undefined, + l = undefined, + img = undefined; + + // external headers + if (adpt.asyncSort && adpt.triggerIds.length > 0) { + var triggers = adpt.triggerIds; + cells = []; + l = triggers.length; + for (var j = 0; j < triggers.length; j++) { + cells.push(_dom2.default.id(triggers[j])); + } + } else { + if (!this.tHead) { + return; + } + cells = stt.tHead.rows[stt.headersRow].cells; + l = cells.length; + } + for (var i = 0; i < l; i++) { + var cellAttr = cells[i].getAttribute('_sortType'); + if (cellAttr !== null && cellAttr !== 'None') { + img = cells[i].lastChild || cells[i]; + if (img.nodeName.toLowerCase() !== 'img') { + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + cells[i].appendChild(img); + } + if (i === stt.sortColumn) { + img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); + } else { + img.className = adpt.imgClassName; + } + } + } + }; + + /** + * Overrides getRowValue for custom key value feature + * @param {Object} oRow Row element + * @param {String} sType + * @param {Number} nColumn + * @return {String} + */ + SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { + var stt = this; + // if we have defined a custom getRowValue use that + var sortTypeInfo = stt._sortTypeInfo[sType]; + if (sortTypeInfo && sortTypeInfo.getRowValue) { + return sortTypeInfo.getRowValue(oRow, nColumn); + } + var c = oRow.cells[nColumn]; + var s = SortableTable.getInnerText(c); + return stt.getValueFromString(s, sType); + }; + + /** + * Overrides getInnerText in order to avoid Firefox unexpected sorting + * behaviour with untrimmed text elements + * @param {Object} oNode DOM element + * @return {String} DOM element inner text + */ + SortableTable.getInnerText = function (oNode) { + if (!oNode) { + return; + } + if (oNode.getAttribute(adpt.customKey)) { + return oNode.getAttribute(adpt.customKey); + } else { + return _dom2.default.getText(oNode); + } + }; + } + }, { + key: 'addSortType', + value: function addSortType() { + var args = arguments; + SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); + } + }, { + key: 'setSortTypes', + value: function setSortTypes() { + var _this = this; + + var tf = this.tf, + sortTypes = this.sortTypes, + _sortTypes = []; + + for (var i = 0; i < tf.nbCells; i++) { + var colType = undefined; + + if (sortTypes[i]) { + colType = sortTypes[i].toLowerCase(); + if (colType === 'none') { + colType = 'None'; + } + } else { + // resolve column types + if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { + colType = tf.colNbFormat[i].toLowerCase(); + } else if (tf.hasColDateType && tf.colDateType[i] !== null) { + colType = tf.colDateType[i].toLowerCase() + 'date'; + } else { + colType = 'String'; + } + } + _sortTypes.push(colType); + } + + //Public TF method to add sort type + + //Custom sort types + this.addSortType('number', Number); + this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); + this.addSortType('date', SortableTable.toDate); + this.addSortType('string'); + this.addSortType('us', usNumberConverter); + this.addSortType('eu', euNumberConverter); + this.addSortType('dmydate', dmyDateConverter); + this.addSortType('ymddate', ymdDateConverter); + this.addSortType('mdydate', mdyDateConverter); + this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); + this.addSortType('ipaddress', ipAddress, sortIP); + + this.stt = new SortableTable(tf.tbl, _sortTypes); + + /*** external table headers adapter ***/ + if (this.asyncSort && this.triggerIds.length > 0) { + (function () { + var triggers = _this.triggerIds; + for (var j = 0; j < triggers.length; j++) { + if (triggers[j] === null) { + continue; + } + var trigger = _dom2.default.id(triggers[j]); + if (trigger) { + trigger.style.cursor = 'pointer'; + + _event2.default.add(trigger, 'click', function (evt) { + var elm = evt.target; + if (!_this.tf.sort) { + return; + } + _this.stt.asyncSort(triggers.indexOf(elm.id)); + }); + trigger.setAttribute('_sortType', _sortTypes[j]); + } + } + })(); + } + } + + /** + * Destroy sort + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + this.sorted = false; + this.initialized = false; + this.stt.destroy(); + + var ids = tf.getFiltersId(); + for (var idx = 0; idx < ids.length; idx++) { + var header = tf.getHeaderElement(idx); + var img = _dom2.default.tag(header, 'img'); + + if (img.length === 1) { + header.removeChild(img[0]); + } + } + } + }]); + + return AdapterSortableTable; + })(); + + //Converters + + exports.default = AdapterSortableTable; + function usNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'us'); + } + function euNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'eu'); + } + function dateConverter(s, format) { + return _date2.default.format(s, format); + } + function dmyDateConverter(s) { + return dateConverter(s, 'DMY'); + } + function mdyDateConverter(s) { + return dateConverter(s, 'MDY'); + } + function ymdDateConverter(s) { + return dateConverter(s, 'YMD'); + } + function ddmmmyyyyDateConverter(s) { + return dateConverter(s, 'DDMMMYYYY'); + } + + function ipAddress(value) { + var vals = value.split('.'); + for (var x in vals) { + var val = vals[x]; + while (3 > val.length) { + val = '0' + val; + } + vals[x] = val; + } + return vals.join('.'); + } + + function sortIP(a, b) { + var aa = ipAddress(a.value.toLowerCase()); + var bb = ipAddress(b.value.toLowerCase()); + if (aa == bb) { + return 0; + } else if (aa < bb) { + return -1; + } else { + return 1; + } + } + +/***/ }, + +/***/ 33: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterSortabletable = __webpack_require__(32); + + var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + if (!window.SortableTable) { + __webpack_require__(34); + } // import 'script!sortabletable'; + + exports.default = _adapterSortabletable2.default; + +/***/ }, + +/***/ 34: +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") + +/***/ }, + +/***/ 35: +/***/ function(module, exports) { + + /* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra + */ + module.exports = function(src) { + if (typeof execScript === "function") + execScript(src); + else + eval.call(null, src); + } + +/***/ }, + +/***/ 36: +/***/ function(module, exports) { + + module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" + +/***/ } + +}); +//# sourceMappingURL=tf-1.js.map \ No newline at end of file diff --git a/src/modules/alternateRows.js b/src/modules/alternateRows.js index 4a55688c..a3c06031 100644 --- a/src/modules/alternateRows.js +++ b/src/modules/alternateRows.js @@ -42,9 +42,21 @@ export class AlternateRows extends Feature { this.setRowBg(rowIdx, idx); idx++; } + + this.emitter.on('row-processed', + (tf, rowIndex, isValid)=> this.processRow(tf, rowIndex, isValid)); + this.initialized = true; } + processRow(tf, rowIdx, isValid) { console.log(arguments); + if(isValid){ + this.setRowBg(rowIdx, tf.validRowsIndex.length); + } else { + this.removeRowBg(rowIdx); + } + } + /** * Sets row background color * @param {Number} rowIdx Row index @@ -88,6 +100,10 @@ export class AlternateRows extends Feature { for(var i=this.tf.refRow; i this.processRow(tf, rowIndex, isValid)); + this.initialized = false; } diff --git a/src/tablefilter.js b/src/tablefilter.js index 01179301..0833d28d 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -1846,9 +1846,9 @@ export class TableFilter { if(!isRowValid){ this.validateRow(k, false); - if(Mod.alternateRows){ - Mod.alternateRows.removeRowBg(k); - } + // if(Mod.alternateRows){ + // Mod.alternateRows.removeRowBg(k); + // } // always visible rows need to be counted as valid if(this.hasVisibleRows && this.visibleRows.indexOf(k) !== -1){ this.validRowsIndex.push(k); @@ -1858,13 +1858,15 @@ export class TableFilter { } else { this.validateRow(k, true); this.validRowsIndex.push(k); - if(this.alternateRows){ - Mod.alternateRows.setRowBg(k, this.validRowsIndex.length); - } + // if(this.alternateRows){ + // Mod.alternateRows.setRowBg(k, this.validRowsIndex.length); + // } if(this.onRowValidated){ this.onRowValidated.call(null, this, k); } + this.emitter.emit('row-validated', this, k); } + this.emitter.emit('row-processed', this, k, isRowValid); }// for k this.nbVisibleRows = this.validRowsIndex.length; From 114d508c97cce4b0457d9b8a206544f878ddc0d3 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Thu, 31 Dec 2015 12:56:50 +1100 Subject: [PATCH 09/41] Continued row-processed event --- dist/starter.html | 514 -- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 7694 +---------------- dist/tablefilter/tf-1.js | 2224 +---- src/modules/alternateRows.js | 13 +- src/tablefilter.js | 38 +- test/test-always-visible-rows.js | 2 +- 12 files changed, 57 insertions(+), 10440 deletions(-) delete mode 100644 dist/starter.html diff --git a/dist/starter.html b/dist/starter.html deleted file mode 100644 index e81b7543..00000000 --- a/dist/starter.html +++ /dev/null @@ -1,514 +0,0 @@ - - - - tablefilter v0.1.1 - Starter - - -

tablefilter v0.1.1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
countryisoyearPOPXRATPPPcgdpccci
BeninBEN19985950.33589.9517822190.951178.4690.987.55
BeninBEN19996109.53615.6990967200.191174.9092.617.86
BeninBEN20006272.00711.9763184200.611224.7492.278.25
Burkina FasoBFA19949755.03555.2047119125.76838.7679.816.57
Burkina FasoBFA19959988.00499.148407136.65860.8980.419.29
Burkina FasoBFA199610225.00511.5523987144.18881.1180.4012.12
Burkina FasoBFA199710473.53583.6693726141.78899.0176.9414.94
RussiaRUS1998146899.019.7050828932.647086.3967.739.20
RussiaRUS1999146308.9924.61993984.038074.7057.358.81
RussiaRUS2000145555.0128.129169464.859995.9154.748.79
RwandaRWA19946230.00194.51750.39529.48132.164.48
RwandaRWA19956400.00262.197509870.67746.3492.773.08
RwandaRWA19966727.00306.820007377.90823.2589.713.21
RwandaRWA19977895.18301.529785284.13847.7991.443.72
RwandaRWA19988105.00312.314086985.32914.2289.344.22
El SalvadorSLV19955669.008.7545833593.544143.5989.3110.35
El SalvadorSLV19965798.008.7550001143.694235.7988.777.79
El SalvadorSLV19975911.008.7562503813.744408.4187.057.90
Slovak RepublicSVK20005401.0046.035213.0212618.5352.2224.78
SloveniaSVN19941988.90128.808593879.9711662.1253.2119.87
SloveniaSVN19951990.00118.518501389.0312574.9654.4623.11
SloveniaSVN19961991.00135.364303697.2713151.5154.3223.23
SloveniaSVN19971985.96159.6882935103.9614143.0253.2424.14
SloveniaSVN19981982.60166.134201108.9315067.3452.8225.35
ZambiaZMB19948740.72669.3706055307.48834.1975.439.86
ZambiaZMB19958980.00864.1192017402.40829.3776.5510.31
ZambiaZMB19969214.401207.900024515.01838.0578.7410.99
ZambiaZMB19979443.211314.498047596.97851.4777.5912.15
ZambiaZMB19989665.711862.06897744.91800.6985.1213.75
ZambiaZMB19999881.212388.019043941.87765.2491.8215.30
ZambiaZMB200010089.003110.8439941157.63840.9786.3315.38
ZimbabweZWE199410775.358.1515388492.012586.8460.1018.53
ZimbabweZWE199511011.008.665375712.152603.3766.8915.03
ZimbabweZWE199611242.1610.002349852.642860.2372.0611.32
ZimbabweZWE199711923.5212.111289983.172727.0682.8211.01
ZimbabweZWE199812153.8523.679109574.062799.8577.6610.75
ZimbabweZWE199912388.3238.301200876.122770.4876.8910.73
ZimbabweZWE200012627.0044.417919169.482607.0369.238.62
- - - - - - -

-
-
-
-
-
-
-
-
-
diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index 5a5f4153..2eb02459 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-30T06:42:09.885Z 
+ *	 build date: 2015-12-31T01:55:02.158Z 
  *	 MIT License  
  */ 
 span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
\ No newline at end of file
diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css
index fdee1d64..3c580f6a 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-30T06:42:09.885Z 
+ *	 build date: 2015-12-31T01:55:02.158Z 
  *	 MIT License  
  */ 
 span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
\ No newline at end of file
diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css
index d8e03c61..7713bc69 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-30T06:42:09.885Z 
+ *	 build date: 2015-12-31T01:55:02.158Z 
  *	 MIT License  
  */ 
 .activeHeader{background-color:#66afe9 !important;color:#fff !important}
diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css
index df230589..e2a792f1 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-30T06:42:09.885Z 
+ *	 build date: 2015-12-31T01:55:02.158Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css
index 2c78df4e..f74cb79a 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-30T06:42:09.885Z 
+ *	 build date: 2015-12-31T01:55:02.158Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css
index 9aed0b4b..86fe35d7 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-30T06:42:09.885Z 
+ *	 build date: 2015-12-31T01:55:02.158Z 
  *	 MIT License  
  */ 
 table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
index 63853663..56b7322e 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -1,7686 +1,10 @@
-(function webpackUniversalModuleDefinition(root, factory) {
-	if(typeof exports === 'object' && typeof module === 'object')
-		module.exports = factory();
-	else if(typeof define === 'function' && define.amd)
-		define([], factory);
-	else {
-		var a = factory();
-		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
-	}
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ 	// install a JSONP callback for chunk loading
-/******/ 	var parentJsonpFunction = window["webpackJsonp"];
-/******/ 	window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
-/******/ 		// add "moreModules" to the modules object,
-/******/ 		// then flag all "chunkIds" as loaded and fire callback
-/******/ 		var moduleId, chunkId, i = 0, callbacks = [];
-/******/ 		for(;i < chunkIds.length; i++) {
-/******/ 			chunkId = chunkIds[i];
-/******/ 			if(installedChunks[chunkId])
-/******/ 				callbacks.push.apply(callbacks, installedChunks[chunkId]);
-/******/ 			installedChunks[chunkId] = 0;
-/******/ 		}
-/******/ 		for(moduleId in moreModules) {
-/******/ 			modules[moduleId] = moreModules[moduleId];
-/******/ 		}
-/******/ 		if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
-/******/ 		while(callbacks.length)
-/******/ 			callbacks.shift().call(null, __webpack_require__);
-/******/
-/******/ 	};
-/******/
-/******/ 	// The module cache
-/******/ 	var installedModules = {};
-/******/
-/******/ 	// object to store loaded and loading chunks
-/******/ 	// "0" means "already loaded"
-/******/ 	// Array means "loading", array contains callbacks
-/******/ 	var installedChunks = {
-/******/ 		0:0
-/******/ 	};
-/******/
-/******/ 	// The require function
-/******/ 	function __webpack_require__(moduleId) {
-/******/
-/******/ 		// Check if module is in cache
-/******/ 		if(installedModules[moduleId])
-/******/ 			return installedModules[moduleId].exports;
-/******/
-/******/ 		// Create a new module (and put it into the cache)
-/******/ 		var module = installedModules[moduleId] = {
-/******/ 			exports: {},
-/******/ 			id: moduleId,
-/******/ 			loaded: false
-/******/ 		};
-/******/
-/******/ 		// Execute the module function
-/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ 		// Flag the module as loaded
-/******/ 		module.loaded = true;
-/******/
-/******/ 		// Return the exports of the module
-/******/ 		return module.exports;
-/******/ 	}
-/******/
-/******/ 	// This file contains only the entry chunk.
-/******/ 	// The chunk loading function for additional chunks
-/******/ 	__webpack_require__.e = function requireEnsure(chunkId, callback) {
-/******/ 		// "0" is the signal for "already loaded"
-/******/ 		if(installedChunks[chunkId] === 0)
-/******/ 			return callback.call(null, __webpack_require__);
-/******/
-/******/ 		// an array means "currently loading".
-/******/ 		if(installedChunks[chunkId] !== undefined) {
-/******/ 			installedChunks[chunkId].push(callback);
-/******/ 		} else {
-/******/ 			// start chunk loading
-/******/ 			installedChunks[chunkId] = [callback];
-/******/ 			var head = document.getElementsByTagName('head')[0];
-/******/ 			var script = document.createElement('script');
-/******/ 			script.type = 'text/javascript';
-/******/ 			script.charset = 'utf-8';
-/******/ 			script.async = true;
-/******/
-/******/ 			script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js";
-/******/ 			head.appendChild(script);
-/******/ 		}
-/******/ 	};
-/******/
-/******/ 	// expose the modules object (__webpack_modules__)
-/******/ 	__webpack_require__.m = modules;
-/******/
-/******/ 	// expose the module cache
-/******/ 	__webpack_require__.c = installedModules;
-/******/
-/******/ 	// __webpack_public_path__
-/******/ 	__webpack_require__.p = "";
-/******/
-/******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
+/** 
+ *	 tablefilter v0.1.1 by Max Guglielmi
+ *	 build date: 2015-12-31T01:55:02.086Z 
+ *	 MIT License  
+ */ 
 
-	'use strict';
-	
-	var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-	
-	// Features
-	
-	Object.defineProperty(exports, "__esModule", {
-	    value: true
-	});
-	exports.TableFilter = undefined;
-	
-	var _event = __webpack_require__(1);
-	
-	var _event2 = _interopRequireDefault(_event);
-	
-	var _dom = __webpack_require__(2);
-	
-	var _dom2 = _interopRequireDefault(_dom);
-	
-	var _string = __webpack_require__(3);
-	
-	var _string2 = _interopRequireDefault(_string);
-	
-	var _cookie = __webpack_require__(4);
-	
-	var _cookie2 = _interopRequireDefault(_cookie);
-	
-	var _types = __webpack_require__(5);
-	
-	var _types2 = _interopRequireDefault(_types);
-	
-	var _array = __webpack_require__(6);
-	
-	var _array2 = _interopRequireDefault(_array);
-	
-	var _date = __webpack_require__(7);
-	
-	var _date2 = _interopRequireDefault(_date);
-	
-	var _helpers = __webpack_require__(8);
-	
-	var _helpers2 = _interopRequireDefault(_helpers);
-	
-	var _emitter = __webpack_require__(9);
-	
-	var _store = __webpack_require__(10);
-	
-	var _gridLayout = __webpack_require__(11);
-	
-	var _loader = __webpack_require__(13);
-	
-	var _highlightKeywords = __webpack_require__(14);
-	
-	var _popupFilter = __webpack_require__(15);
-	
-	var _dropdown = __webpack_require__(16);
-	
-	var _checkList = __webpack_require__(18);
-	
-	var _rowsCounter = __webpack_require__(19);
-	
-	var _statusBar = __webpack_require__(20);
-	
-	var _paging = __webpack_require__(21);
-	
-	var _clearButton = __webpack_require__(22);
-	
-	var _help = __webpack_require__(23);
-	
-	var _alternateRows = __webpack_require__(24);
-	
-	var _noResults = __webpack_require__(25);
-	
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-	
-	function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
-	
-	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-	
-	var global = window,
-	    doc = global.document;
-	
-	var TableFilter = exports.TableFilter = (function () {
-	
-	    /**
-	     * TableFilter object constructor
-	     * requires `table` or `id` arguments, `row` and `configuration` optional
-	     * @param {DOMElement} table Table DOM element
-	     * @param {String} id Table id
-	     * @param {Number} row index indicating the 1st row
-	     * @param {Object} configuration object
-	     */
-	
-	    function TableFilter() {
-	        var _this = this;
-	
-	        _classCallCheck(this, TableFilter);
-	
-	        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
-	            args[_key] = arguments[_key];
-	        }
-	
-	        if (args.length === 0) {
-	            return;
-	        }
-	
-	        this.id = null;
-	        this.version = '0.1.1';
-	        this.year = new Date().getFullYear();
-	        this.tbl = null;
-	        this.startRow = null;
-	        this.refRow = null;
-	        this.headersRow = null;
-	        this.cfg = {};
-	        this.nbFilterableRows = null;
-	        this.nbRows = null;
-	        this.nbCells = null;
-	        this._hasGrid = false;
-	
-	        // TODO: use for-of with babel plug-in
-	        args.forEach(function (arg) {
-	            // for (let arg of args) {
-	            var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg);
-	            if (argtype === 'object' && arg && arg.nodeName === 'TABLE') {
-	                _this.tbl = arg;
-	                _this.id = arg.id || 'tf_' + new Date().getTime() + '_';
-	            } else if (argtype === 'string') {
-	                _this.id = arg;
-	                _this.tbl = _dom2.default.id(arg);
-	            } else if (argtype === 'number') {
-	                _this.startRow = arg;
-	            } else if (argtype === 'object') {
-	                _this.cfg = arg;
-	            }
-	            // }
-	        });
-	
-	        if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) {
-	            throw new Error('Could not instantiate TableFilter: HTML table not found.');
-	        }
-	
-	        // configuration object
-	        var f = this.cfg;
-	
-	        this.emitter = new _emitter.Emitter();
-	
-	        //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 || 'tablefilter/';
-	
-	        /*** filter types ***/
-	        this.fltTypeInp = 'input';
-	        this.fltTypeSlc = 'select';
-	        this.fltTypeMulti = 'multiple';
-	        this.fltTypeCheckList = 'checklist';
-	        this.fltTypeNone = 'none';
-	
-	        /*** filters' grid properties ***/
-	
-	        //enables/disables filter grid
-	        this.fltGrid = f.grid === false ? false : true;
-	
-	        //enables/disables grid layout (fixed headers)
-	        this.gridLayout = Boolean(f.grid_layout);
-	
-	        this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index;
-	        this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index;
-	
-	        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 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;
-	
-	        //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.stylePath = f.style_path || this.basePath + 'style/';
-	        this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows);
-	        //defines widths of columns
-	        this.hasColWidths = _types2.default.isArray(f.col_widths);
-	        this.colWidths = this.hasColWidths ? f.col_widths : null;
-	        //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';
-	
-	        /*** filters' grid behaviours ***/
-	        //enables/disables enter key
-	        this.enterKey = f.enter_key === false ? false : true;
-	        //calls function before filtering starts
-	        this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null;
-	        //calls function after filtering
-	        this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null;
-	        //enables/disables case sensitivity
-	        this.caseSensitive = Boolean(f.case_sensitive);
-	        //has exact match per column
-	        this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match);
-	        this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : [];
-	        //enables/disbles exact match for search
-	        this.exactMatch = Boolean(f.exact_match);
-	        //refreshes drop-down lists upon validation
-	        this.linkedFilters = Boolean(f.linked_filters);
-	        //wheter excluded options are disabled
-	        this.disableExcludedOptions = Boolean(f.disable_excluded_options);
-	        //stores active filter element
-	        this.activeFlt = null;
-	        //id of active filter
-	        this.activeFilterId = null;
-	        //enables always visible rows
-	        this.hasVisibleRows = Boolean(f.rows_always_visible);
-	        //array containing always visible rows
-	        this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : [];
-	        //enables/disables external filters generation
-	        this.isExternalFlt = Boolean(f.external_flt_grid);
-	        //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null;
-	        //enables/disables single filter search
-	        this.singleSearchFlt = Boolean(f.single_filter);
-	        //calls function after row is validated
-	        this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null;
-	        //input watermark text array
-	        this.watermark = f.watermark || '';
-	        this.isWatermarkArray = _types2.default.isArray(this.watermark);
-	        //id of toolbar container element
-	        this.toolBarTgtId = f.toolbar_target_id || null;
-	        //enables/disables help div
-	        this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions);
-	        //popup filters
-	        this.popupFilters = Boolean(f.popup_filters);
-	        //active columns color
-	        this.markActiveColumns = Boolean(f.mark_active_columns);
-	        //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null;
-	        //calls function after active column header is marked
-	        this.onAfterActiveColumn = _types2.default.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 || 'Clear';
-	        //enables/disables empty option in combo-box filters
-	        this.enableEmptyOption = Boolean(f.enable_empty_option);
-	        //defines empty option text
-	        this.emptyText = f.empty_text || '(Empty)';
-	        //enables/disables non empty option in combo-box filters
-	        this.enableNonEmptyOption = Boolean(f.enable_non_empty_option);
-	        //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 = Boolean(f.sort_num_asc);
-	        this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null;
-	        //enables/disables descending numeric options sorting
-	        this.isSortNumDesc = Boolean(f.sort_num_desc);
-	        this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null;
-	        //Select filters are populated on demand
-	        this.loadFltOnDemand = Boolean(f.load_filters_on_demand);
-	        this.hasCustomOptions = _types2.default.isObj(f.custom_options);
-	        this.customOptions = f.custom_options;
-	
-	        /*** 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 || '^[¥£€$]';
-	        this.separator = f.separator || ',';
-	
-	        /*** rows counter ***/
-	        //show/hides rows counter
-	        this.rowsCounter = Boolean(f.rows_counter);
-	
-	        /*** status bar ***/
-	        //show/hides status bar
-	        this.statusBar = Boolean(f.status_bar);
-	
-	        /*** loader ***/
-	        //enables/disables loader/spinner indicator
-	        this.loader = Boolean(f.loader);
-	
-	        /*** validation - reset buttons/links ***/
-	        //show/hides filter's validation button
-	        this.displayBtn = Boolean(f.btn);
-	        //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 = Boolean(f.btn_reset);
-	        //defines css class for reset button
-	        this.btnResetCssClass = f.btn_reset_css_class || 'reset';
-	        //callback function before filters are cleared
-	        this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null;
-	        //callback function after filters are cleared
-	        this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null;
-	
-	        /*** paging ***/
-	        //enables/disables table paging
-	        this.paging = Boolean(f.paging);
-	        this.nbVisibleRows = 0; //nb visible rows
-	        this.nbHiddenRows = 0; //nb hidden rows
-	
-	        /*** autofilter on typing ***/
-	        //enables/disables auto filtering, table is filtered when user stops
-	        //typing
-	        this.autoFilter = Boolean(f.auto_filter);
-	        //onkeyup delay timer (msecs)
-	        this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900;
-	        //typing indicator
-	        this.isUserTyping = null;
-	        this.autoFilterTimer = null;
-	
-	        /*** keyword highlighting ***/
-	        //enables/disables keyword highlighting
-	        this.highlightKeywords = Boolean(f.highlight_keywords);
-	
-	        /*** No results feature ***/
-	        this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message);
-	
-	        /*** 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 = _types2.default.isArray(f.col_number_format);
-	        //array containing columns nb formats
-	        this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null;
-	        //enables date type per column
-	        this.hasColDateType = _types2.default.isArray(f.col_date_type);
-	        //array containing columns date type
-	        this.colDateType = 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_';
-	        //filter values cookie
-	        this.prfxCookieFltsValues = 'tf_flts_';
-	        //page nb cookie
-	        this.prfxCookiePageNb = 'tf_pgnb_';
-	        //page length cookie
-	        this.prfxCookiePageLen = 'tf_pglen_';
-	
-	        /*** cookies ***/
-	        this.hasStoredValues = false;
-	        //remembers filters values on page load
-	        this.rememberGridValues = Boolean(f.remember_grid_values);
-	        //cookie storing filter values
-	        this.fltsValuesCookie = this.prfxCookieFltsValues + this.id;
-	        //remembers page nb on page load
-	        this.rememberPageNb = this.paging && f.remember_page_number;
-	        //cookie storing page nb
-	        this.pgNbCookie = this.prfxCookiePageNb + this.id;
-	        //remembers page length on page load
-	        this.rememberPageLen = this.paging && f.remember_page_length;
-	        //cookie storing page length
-	        this.pgLenCookie = this.prfxCookiePageLen + this.id;
-	
-	        /*** extensions ***/
-	        //imports external script
-	        this.extensions = f.extensions;
-	        this.hasExtensions = _types2.default.isArray(this.extensions);
-	
-	        /*** themes ***/
-	        this.enableDefaultTheme = Boolean(f.enable_default_theme);
-	        //imports themes
-	        this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes);
-	        this.themes = f.themes || [];
-	        //themes path
-	        this.themesPath = f.themes_path || this.stylePath + 'themes/';
-	
-	        // Features registry
-	        this.Mod = {};
-	
-	        // Extensions registry
-	        this.ExtRegistry = {};
-	
-	        /*** TF events ***/
-	        this.Evt = {
-	            name: {
-	                filter: 'Filter',
-	                dropdown: 'DropDown',
-	                checklist: 'CheckList',
-	                changepage: 'ChangePage',
-	                clear: 'Clear',
-	                changeresultsperpage: 'ChangeResults',
-	                resetvalues: 'ResetValues',
-	                resetpage: 'ResetPage',
-	                resetpagelength: 'ResetPageLength',
-	                loadextensions: 'LoadExtensions',
-	                loadthemes: 'LoadThemes'
-	            },
-	
-	            // Detect  key
-	            detectKey: function detectKey(e) {
-	                if (!this.enterKey) {
-	                    return;
-	                }
-	                var _ev = e || global.event;
-	                if (_ev) {
-	                    var key = _event2.default.keyCode(_ev);
-	                    if (key === 13) {
-	                        this.filter();
-	                        _event2.default.cancel(_ev);
-	                        _event2.default.stop(_ev);
-	                    } else {
-	                        this.isUserTyping = true;
-	                        global.clearInterval(this.autoFilterTimer);
-	                        this.autoFilterTimer = null;
-	                    }
-	                }
-	            },
-	
-	            // if auto-filter on, detect user is typing and filter columns
-	            onKeyUp: function onKeyUp(e) {
-	                if (!this.autoFilter) {
-	                    return;
-	                }
-	                var _ev = e || global.event;
-	                var key = _event2.default.keyCode(_ev);
-	                this.isUserTyping = false;
-	
-	                function filter() {
-	                    /*jshint validthis:true */
-	                    global.clearInterval(this.autoFilterTimer);
-	                    this.autoFilterTimer = null;
-	                    if (!this.isUserTyping) {
-	                        this.filter();
-	                        this.isUserTyping = null;
-	                    }
-	                }
-	
-	                if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) {
-	                    if (this.autoFilterTimer === null) {
-	                        this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay);
-	                    }
-	                } else {
-	                    global.clearInterval(this.autoFilterTimer);
-	                    this.autoFilterTimer = null;
-	                }
-	            },
-	
-	            // if auto-filter on, detect user is typing
-	            onKeyDown: function onKeyDown() {
-	                if (!this.autoFilter) {
-	                    return;
-	                }
-	                this.isUserTyping = true;
-	            },
-	
-	            // if auto-filter on, clear interval on filter blur
-	            onInpBlur: function onInpBlur() {
-	                if (this.autoFilter) {
-	                    this.isUserTyping = false;
-	                    global.clearInterval(this.autoFilterTimer);
-	                }
-	                // TODO: hack to prevent ezEditTable enter key event hijaking.
-	                // Needs to be fixed in the vendor's library
-	                if (this.hasExtension('advancedGrid')) {
-	                    var advGrid = this.extension('advancedGrid');
-	                    var ezEditTable = advGrid._ezEditTable;
-	                    if (advGrid.cfg.editable) {
-	                        ezEditTable.Editable.Set();
-	                    }
-	                    if (advGrid.cfg.selection) {
-	                        ezEditTable.Selection.Set();
-	                    }
-	                }
-	            },
-	
-	            // set focused text-box filter as active
-	            onInpFocus: function onInpFocus(e) {
-	                var _ev = e || global.event;
-	                var elm = _event2.default.target(_ev);
-	                this.activeFilterId = elm.getAttribute('id');
-	                this.activeFlt = _dom2.default.id(this.activeFilterId);
-	                if (this.popupFilters) {
-	                    _event2.default.cancel(_ev);
-	                    _event2.default.stop(_ev);
-	                }
-	                // TODO: hack to prevent ezEditTable enter key event hijaking.
-	                // Needs to be fixed in the vendor's library
-	                if (this.hasExtension('advancedGrid')) {
-	                    var advGrid = this.extension('advancedGrid');
-	                    var ezEditTable = advGrid._ezEditTable;
-	                    if (advGrid.cfg.editable) {
-	                        ezEditTable.Editable.Remove();
-	                    }
-	                    if (advGrid.cfg.selection) {
-	                        ezEditTable.Selection.Remove();
-	                    }
-	                }
-	            },
-	
-	            // set focused drop-down filter as active
-	            onSlcFocus: function onSlcFocus(e) {
-	                var _ev = e || global.event;
-	                var elm = _event2.default.target(_ev);
-	                this.activeFilterId = elm.getAttribute('id');
-	                this.activeFlt = _dom2.default.id(this.activeFilterId);
-	                // select is populated when element has focus
-	                if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') {
-	                    var ct = elm.getAttribute('ct');
-	                    this.Mod.dropdown._build(ct);
-	                }
-	                if (this.popupFilters) {
-	                    _event2.default.cancel(_ev);
-	                    _event2.default.stop(_ev);
-	                }
-	            },
-	
-	            // filter columns on drop-down filter change
-	            onSlcChange: function onSlcChange(e) {
-	                if (!this.activeFlt) {
-	                    return;
-	                }
-	                var _ev = e || global.event;
-	                if (this.popupFilters) {
-	                    _event2.default.stop(_ev);
-	                }
-	                if (this.onSlcChange) {
-	                    this.filter();
-	                }
-	            },
-	
-	            // fill checklist filter on click if required
-	            onCheckListClick: function onCheckListClick(e) {
-	                var _ev = e || global.event;
-	                var elm = _event2.default.target(_ev);
-	                if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') {
-	                    var ct = elm.getAttribute('ct');
-	                    this.Mod.checkList._build(ct);
-	                    this.Mod.checkList.checkListDiv[ct].onclick = null;
-	                    this.Mod.checkList.checkListDiv[ct].title = '';
-	                }
-	            }
-	        };
-	    }
-	
-	    /**
-	     * Initialise filtering grid bar behaviours and layout
-	     *
-	     * TODO: decompose in smaller methods
-	     */
-	
-	    _createClass(TableFilter, [{
-	        key: 'init',
-	        value: function init() {
-	            var _this2 = this;
-	
-	            if (this._hasGrid) {
-	                return;
-	            }
-	            if (!this.tbl) {
-	                this.tbl = _dom2.default.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 Mod = this.Mod;
-	            var n = this.singleSearchFlt ? 1 : this.nbCells,
-	                inpclass = undefined;
-	
-	            //loads stylesheet if not imported
-	            this.import(this.stylesheetId, this.stylesheet, null, 'link');
-	
-	            //loads theme
-	            if (this.hasThemes) {
-	                this._loadThemes();
-	            }
-	
-	            if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) {
-	                Mod.store = new _store.Store(this);
-	                Mod.store.init();
-	            }
-	
-	            if (this.gridLayout) {
-	                Mod.gridLayout = new _gridLayout.GridLayout(this);
-	                Mod.gridLayout.init();
-	            }
-	
-	            if (this.loader) {
-	                if (!Mod.loader) {
-	                    Mod.loader = new _loader.Loader(this);
-	                }
-	                Mod.loader.init();
-	            }
-	
-	            if (this.highlightKeywords) {
-	                Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this);
-	                Mod.highlightKeyword.init();
-	            }
-	
-	            if (this.popupFilters) {
-	                if (!Mod.popupFilter) {
-	                    Mod.popupFilter = new _popupFilter.PopupFilter(this);
-	                }
-	                Mod.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 = undefined;
-	                    if (!this.gridLayout) {
-	                        var thead = _dom2.default.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.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) {
-	                            Mod.popupFilter.build(i);
-	                        }
-	
-	                        var fltcell = _dom2.default.create(this.fltCellTag),
-	                            col = this.getFilterType(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;
-	
-	                        //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 (!Mod.dropdown) {
-	                                Mod.dropdown = new _dropdown.Dropdown(this);
-	                            }
-	                            var dropdown = Mod.dropdown;
-	
-	                            var slc = _dom2.default.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 = _string2.default.lower(col) === this.fltTypeSlc ? inpclass : this.fltMultiCssClass;
-	
-	                            //filter is appended in desired external element
-	                            if (externalFltTgtId) {
-	                                _dom2.default.id(externalFltTgtId).appendChild(slc);
-	                                this.externalFltEls.push(slc);
-	                            } else {
-	                                fltcell.appendChild(slc);
-	                            }
-	
-	                            this.fltIds.push(this.prfxFlt + i + '_' + this.id);
-	
-	                            if (!this.loadFltOnDemand) {
-	                                dropdown._build(i);
-	                            }
-	
-	                            _event2.default.add(slc, 'keypress', this.Evt.detectKey.bind(this));
-	                            _event2.default.add(slc, 'change', this.Evt.onSlcChange.bind(this));
-	                            _event2.default.add(slc, 'focus', this.Evt.onSlcFocus.bind(this));
-	
-	                            //1st option is created here since dropdown.build isn't
-	                            //invoked
-	                            if (this.loadFltOnDemand) {
-	                                var opt0 = _dom2.default.createOpt(this.displayAllText, '');
-	                                slc.appendChild(opt0);
-	                            }
-	                        }
-	                        // checklist
-	                        else if (col === this.fltTypeCheckList) {
-	                                var checkList = undefined;
-	                                Mod.checkList = new _checkList.CheckList(this);
-	                                checkList = Mod.checkList;
-	
-	                                var divCont = _dom2.default.create('div', ['id', checkList.prfxCheckListDiv + i + '_' + this.id], ['ct', i], ['filled', '0']);
-	                                divCont.className = checkList.checkListDivCssClass;
-	
-	                                //filter is appended in desired element
-	                                if (externalFltTgtId) {
-	                                    _dom2.default.id(externalFltTgtId).appendChild(divCont);
-	                                    this.externalFltEls.push(divCont);
-	                                } else {
-	                                    fltcell.appendChild(divCont);
-	                                }
-	
-	                                checkList.checkListDiv[i] = divCont;
-	                                this.fltIds.push(this.prfxFlt + i + '_' + this.id);
-	                                if (!this.loadFltOnDemand) {
-	                                    checkList._build(i);
-	                                }
-	
-	                                if (this.loadFltOnDemand) {
-	                                    _event2.default.add(divCont, 'click', this.Evt.onCheckListClick.bind(this));
-	                                    divCont.appendChild(_dom2.default.text(checkList.activateCheckListTxt));
-	                                }
-	                            } else {
-	                                //show/hide input
-	                                var inptype = col === this.fltTypeInp ? 'text' : 'hidden';
-	                                var inp = _dom2.default.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;
-	                                _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this));
-	
-	                                //filter is appended in desired element
-	                                if (externalFltTgtId) {
-	                                    _dom2.default.id(externalFltTgtId).appendChild(inp);
-	                                    this.externalFltEls.push(inp);
-	                                } else {
-	                                    fltcell.appendChild(inp);
-	                                }
-	
-	                                this.fltIds.push(this.prfxFlt + i + '_' + this.id);
-	
-	                                _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this));
-	                                _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this));
-	                                _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this));
-	                                _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this));
-	
-	                                if (this.rememberGridValues) {
-	                                    var flts_values = this.Mod.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 = _dom2.default.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) {
-	                                _dom2.default.id(externalFltTgtId).appendChild(btn);
-	                            } else {
-	                                fltcell.appendChild(btn);
-	                            }
-	
-	                            _event2.default.add(btn, 'click', function () {
-	                                return _this2.filter();
-	                            });
-	                        } //if
-	                    } // for i
-	                } else {
-	                        this._resetGrid();
-	                    } //if isFirstLoad
-	            } //if this.fltGrid
-	
-	            /* Features */
-	            if (this.hasVisibleRows) {
-	                this.emitter.on('after-filtering', function () {
-	                    return _this2.enforceVisibility();
-	                });
-	                this.enforceVisibility();
-	            }
-	            if (this.rowsCounter) {
-	                Mod.rowsCounter = new _rowsCounter.RowsCounter(this);
-	                Mod.rowsCounter.init();
-	            }
-	            if (this.statusBar) {
-	                Mod.statusBar = new _statusBar.StatusBar(this);
-	                Mod.statusBar.init();
-	            }
-	            if (this.paging || Mod.paging) {
-	                if (!Mod.paging) {
-	                    Mod.paging = new _paging.Paging(this);
-	                    Mod.paging.init();
-	                }
-	                Mod.paging.reset();
-	            }
-	            if (this.btnReset) {
-	                Mod.clearButton = new _clearButton.ClearButton(this);
-	                Mod.clearButton.init();
-	            }
-	            if (this.help) {
-	                if (!Mod.help) {
-	                    Mod.help = new _help.Help(this);
-	                }
-	                Mod.help.init();
-	            }
-	            if (this.hasColWidths && !this.gridLayout) {
-	                this.setColWidths();
-	            }
-	            if (this.alternateRows) {
-	                Mod.alternateRows = new _alternateRows.AlternateRows(this);
-	                Mod.alternateRows.init();
-	            }
-	            if (this.noResults) {
-	                if (!Mod.noResults) {
-	                    Mod.noResults = new _noResults.NoResults(this);
-	                }
-	                Mod.noResults.init();
-	            }
-	
-	            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) {
-	                _dom2.default.addClass(this.tbl, this.prfxTf);
-	            }
-	
-	            if (this.loader) {
-	                Mod.loader.show('none');
-	            }
-	
-	            /* Loads extensions */
-	            if (this.hasExtensions) {
-	                this.initExtensions();
-	            }
-	
-	            // Subscribe to events
-	            if (this.markActiveColumns) {
-	                this.emitter.on('before-filtering', function () {
-	                    return _this2.clearActiveColumns();
-	                });
-	            }
-	            if (this.linkedFilters) {
-	                this.emitter.on('after-filtering', function () {
-	                    return _this2.linkFilters();
-	                });
-	            }
-	
-	            if (this.onFiltersLoaded) {
-	                this.onFiltersLoaded.call(null, this);
-	            }
-	
-	            this.emitter.emit('initialized', this);
-	        }
-	
-	        /**
-	         * Manages state messages
-	         * @param {String} evt Event name
-	         * @param {Object} cfg Config object
-	         */
-	
-	    }, {
-	        key: 'EvtManager',
-	        value: function EvtManager(evt) {
-	            var cfg = arguments.length <= 1 || arguments[1] === undefined ? { slcIndex: null, slcExternal: false, slcId: null, pgIndex: null } : arguments[1];
-	
-	            var slcIndex = cfg.slcIndex;
-	            var slcExternal = cfg.slcExternal;
-	            var slcId = cfg.slcId;
-	            var pgIndex = cfg.pgIndex;
-	            var cpt = this.Mod;
-	
-	            function efx() {
-	                /*jshint validthis:true */
-	                var ev = this.Evt.name;
-	
-	                switch (evt) {
-	                    case ev.filter:
-	                        this._filter();
-	                        break;
-	                    case ev.dropdown:
-	                        if (this.linkedFilters) {
-	                            cpt.dropdown._build(slcIndex, true);
-	                        } else {
-	                            cpt.dropdown._build(slcIndex, false, slcExternal, slcId);
-	                        }
-	                        break;
-	                    case ev.checklist:
-	                        cpt.checkList._build(slcIndex, slcExternal, slcId);
-	                        break;
-	                    case ev.changepage:
-	                        cpt.paging._changePage(pgIndex);
-	                        break;
-	                    case ev.clear:
-	                        this._clearFilters();
-	                        this._filter();
-	                        break;
-	                    case ev.changeresultsperpage:
-	                        cpt.paging._changeResultsPerPage();
-	                        break;
-	                    case ev.resetvalues:
-	                        this._resetValues();
-	                        this._filter();
-	                        break;
-	                    case ev.resetpage:
-	                        cpt.paging._resetPage(this.pgNbCookie);
-	                        break;
-	                    case ev.resetpagelength:
-	                        cpt.paging._resetPageLength(this.pgLenCookie);
-	                        break;
-	                    case ev.loadextensions:
-	                        this._loadExtensions();
-	                        break;
-	                    case ev.loadthemes:
-	                        this._loadThemes();
-	                        break;
-	                }
-	                if (this.statusBar) {
-	                    cpt.statusBar.message('');
-	                }
-	                if (this.loader) {
-	                    cpt.loader.show('none');
-	                }
-	            }
-	
-	            if (!this.loader && !this.statusBar && !this.linkedFilters) {
-	                efx.call(this);
-	            } else {
-	                if (this.loader) {
-	                    cpt.loader.show('');
-	                }
-	                if (this.statusBar) {
-	                    cpt.statusBar.message(this['msg' + evt]);
-	                }
-	                global.setTimeout(efx.bind(this), this.execDelay);
-	            }
-	        }
-	
-	        /**
-	         * Return a feature instance for a given name
-	         * @param  {String} name Name of the feature
-	         * @return {Object}
-	         */
-	
-	    }, {
-	        key: 'feature',
-	        value: function feature(name) {
-	            return this.Mod[name];
-	        }
-	
-	        /**
-	         * Initialise all the extensions defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'initExtensions',
-	        value: function initExtensions() {
-	            var exts = this.extensions;
-	
-	            for (var i = 0, len = exts.length; i < len; i++) {
-	                var ext = exts[i];
-	                if (!this.ExtRegistry[ext.name]) {
-	                    this.loadExtension(ext);
-	                }
-	            }
-	        }
-	
-	        /**
-	         * Load an extension module
-	         * @param  {Object} ext Extension config object
-	         */
-	
-	    }, {
-	        key: 'loadExtension',
-	        value: function loadExtension(ext) {
-	            var _this3 = this;
-	
-	            if (!ext || !ext.name) {
-	                return;
-	            }
-	
-	            var name = ext.name;
-	            var path = ext.path;
-	            var modulePath = undefined;
-	
-	            if (name && path) {
-	                modulePath = ext.path + name;
-	            } else {
-	                name = name.replace('.js', '');
-	                modulePath = 'extensions/{}/{}'.replace(/{}/g, name);
-	            }
-	
-	            // Trick to set config's publicPath dynamically for Webpack...
-	            __webpack_require__.p = this.basePath;
-	
-	            __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) {
-	                var inst = new mod.default(_this3, ext);
-	                inst.init();
-	                _this3.ExtRegistry[name] = inst;
-	            }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});
-	        }
-	
-	        /**
-	         * Get an extension instance
-	         * @param  {String} name Name of the extension
-	         * @return {Object}      Extension instance
-	         */
-	
-	    }, {
-	        key: 'extension',
-	        value: function extension(name) {
-	            return this.ExtRegistry[name];
-	        }
-	
-	        /**
-	         * Check passed extension name exists
-	         * @param  {String}  name Name of the extension
-	         * @return {Boolean}
-	         */
-	
-	    }, {
-	        key: 'hasExtension',
-	        value: function hasExtension(name) {
-	            return !_types2.default.isEmpty(this.ExtRegistry[name]);
-	        }
-	
-	        /**
-	         * Destroy all the extensions defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'destroyExtensions',
-	        value: function destroyExtensions() {
-	            var exts = this.extensions;
-	
-	            for (var i = 0, len = exts.length; i < len; i++) {
-	                var ext = exts[i];
-	                var extInstance = this.ExtRegistry[ext.name];
-	                if (extInstance) {
-	                    extInstance.destroy();
-	                    this.ExtRegistry[ext.name] = null;
-	                }
-	            }
-	        }
-	    }, {
-	        key: 'loadThemes',
-	        value: function loadThemes() {
-	            this.EvtManager(this.Evt.name.loadthemes);
-	        }
-	
-	        /**
-	         * Load themes defined in the configuration object
-	         */
-	
-	    }, {
-	        key: '_loadThemes',
-	        value: function _loadThemes() {
-	            var themes = this.themes;
-	            //Default theme config
-	            if (this.enableDefaultTheme) {
-	                var defaultTheme = { name: 'default' };
-	                this.themes.push(defaultTheme);
-	            }
-	            if (_types2.default.isArray(themes)) {
-	                for (var i = 0, len = themes.length; i < len; i++) {
-	                    var theme = themes[i];
-	                    var name = theme.name;
-	                    var path = theme.path;
-	                    var styleId = this.prfxTf + name;
-	                    if (name && !path) {
-	                        path = this.themesPath + name + '/' + name + '.css';
-	                    } else if (!name && theme.path) {
-	                        name = 'theme{0}'.replace('{0}', i);
-	                    }
-	
-	                    if (!this.isImported(path, 'link')) {
-	                        this.import(styleId, path, null, 'link');
-	                    }
-	                }
-	            }
-	
-	            //Some elements need to be overriden for default 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; - } - - /** - * Return stylesheet DOM element for a given theme name - * @return {DOMElement} stylesheet element - */ - - }, { - key: 'getStylesheet', - value: function getStylesheet() { - var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; - - return _dom2.default.id(this.prfxTf + name); - } - - /** - * Destroy filter grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this._hasGrid) { - return; - } - var rows = this.tbl.rows, - Mod = this.Mod; - - this._clearFilters(); - - if (this.isExternalFlt && !this.popupFilters) { - this.removeExternalFlts(); - } - if (this.infDiv) { - this.removeToolbar(); - } - if (this.highlightKeywords) { - Mod.highlightKeyword.unhighlightAll(); - } - if (this.markActiveColumns) { - this.clearActiveColumns(); - this.emitter.off('before-filtering', function () { - return _this4.clearActiveColumns(); - }); - } - if (this.hasExtensions) { - this.destroyExtensions(); - } - - for (var j = this.refRow; j < this.nbRows; j++) { - // validate row - this.validateRow(j, true); - - //removes alternating colors - if (this.alternateRows) { - Mod.alternateRows.removeRowBg(j); - } - } //for j - - if (this.fltGrid && !this.gridLayout) { - this.fltGridEl = rows[this.filtersRowIndex]; - this.tbl.deleteRow(this.filtersRowIndex); - } - - // Destroy modules - Object.keys(Mod).forEach(function (key) { - var feature = Mod[key]; - if (feature && _types2.default.isFn(feature.destroy)) { - feature.destroy(); - } - }); - - // unsubscribe to events - if (this.hasVisibleRows) { - this.emitter.off('after-filtering', function () { - return _this4.enforceVisibility(); - }); - } - if (this.linkedFilters) { - this.emitter.off('after-filtering', function () { - return _this4.linkFilters(); - }); - } - - _dom2.default.removeClass(this.tbl, this.prfxTf); - this.nbHiddenRows = 0; - this.validRowsIndex = null; - this.activeFlt = null; - this._hasGrid = false; - this.tbl = null; - } - - /** - * Generate container element for paging, reset button, rows counter etc. - */ - - }, { - key: 'setToolbar', - value: function setToolbar() { - if (this.infDiv) { - return; - } - - /*** container div ***/ - var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); - infdiv.className = this.infDivCssClass; - - //custom container - if (this.toolBarTgtId) { - _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); - } - //grid-layout - else if (this.gridLayout) { - var gridLayout = this.Mod.gridLayout; - gridLayout.tblMainCont.appendChild(infdiv); - infdiv.className = gridLayout.gridInfDivCssClass; - } - //default location: just above the table - else { - var cont = _dom2.default.create('caption'); - cont.appendChild(infdiv); - this.tbl.insertBefore(cont, this.tbl.firstChild); - } - this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); - - /*** left div containing rows # displayer ***/ - var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); - ldiv.className = this.lDivCssClass; - infdiv.appendChild(ldiv); - this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); - - /*** right div containing reset button - + nb results per page select ***/ - var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); - rdiv.className = this.rDivCssClass; - infdiv.appendChild(rdiv); - this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); - - /*** mid div containing paging elements ***/ - var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); - mdiv.className = this.mDivCssClass; - infdiv.appendChild(mdiv); - this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); - - // Enable help instructions by default if topbar is generated and not - // explicitely set to false - if (_types2.default.isUndef(this.help)) { - if (!this.Mod.help) { - this.Mod.help = new _help.Help(this); - } - this.Mod.help.init(); - this.help = true; - } - } - - /** - * Remove toolbar container element - */ - - }, { - key: 'removeToolbar', - value: function removeToolbar() { - if (!this.infDiv) { - return; - } - _dom2.default.remove(this.infDiv); - this.infDiv = null; - - var tbl = this.tbl; - var captions = _dom2.default.tag(tbl, 'caption'); - if (captions.length > 0) { - [].forEach.call(captions, function (elm) { - tbl.removeChild(elm); - }); - } - } - - /** - * Remove all the external column filters - */ - - }, { - key: 'removeExternalFlts', - value: function removeExternalFlts() { - if (!this.isExternalFlt || !this.externalFltTgtIds) { - return; - } - var ids = this.externalFltTgtIds, - len = ids.length; - for (var ct = 0; ct < len; ct++) { - var externalFltTgtId = ids[ct], - externalFlt = _dom2.default.id(externalFltTgtId); - if (externalFlt) { - externalFlt.innerHTML = ''; - } - } - } - - /** - * Check if given column implements a filter with custom options - * @param {Number} colIndex Column's index - * @return {Boolean} - */ - - }, { - key: 'isCustomOptions', - value: function isCustomOptions(colIndex) { - return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; - } - - /** - * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the - * custom options values and texts - * @param {Number} colIndex Column's index - * @return {Array} - */ - - }, { - key: 'getCustomOptions', - value: function getCustomOptions(colIndex) { - if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { - return; - } - - var customOptions = this.customOptions; - var cols = customOptions.cols; - var optTxt = [], - optArray = []; - var index = cols.indexOf(colIndex); - var slcValues = customOptions.values[index]; - var slcTexts = customOptions.texts[index]; - var slcSort = customOptions.sorts[index]; - - for (var r = 0, len = slcValues.length; r < len; r++) { - optArray.push(slcValues[r]); - if (slcTexts[r]) { - optTxt.push(slcTexts[r]); - } else { - optTxt.push(slcValues[r]); - } - } - if (slcSort) { - optArray.sort(); - optTxt.sort(); - } - return [optArray, optTxt]; - } - }, { - key: 'resetValues', - value: function resetValues() { - this.EvtManager(this.Evt.name.resetvalues); - } - - /** - * Reset persisted filter values - */ - - }, { - key: '_resetValues', - value: function _resetValues() { - //only loadFltOnDemand - if (this.rememberGridValues && this.loadFltOnDemand) { - this._resetGridValues(this.fltsValuesCookie); - } - if (this.rememberPageLen && this.Mod.paging) { - this.Mod.paging.resetPageLength(this.pgLenCookie); - } - if (this.rememberPageNb && this.Mod.paging) { - this.Mod.paging.resetPage(this.pgNbCookie); - } - } - - /** - * Reset persisted filter values when load filters on demand feature is - * enabled - * @param {String} name cookie name storing filter values - */ - - }, { - key: '_resetGridValues', - value: function _resetGridValues(name) { - if (!this.loadFltOnDemand) { - return; - } - var fltsValues = this.Mod.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 = undefined, - opt = undefined; - var fltType = this.getFilterType(i); - // if loadFltOnDemand, drop-down needs to contain stored - // value(s) for filtering - if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { - var slc = _dom2.default.id(this.fltIds[i]); - slc.options[0].selected = false; - - //selects - if (slcFltsIndex.indexOf(i) != -1) { - opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - //multiple select - if (multiFltsIndex.indexOf(i) != -1) { - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - opt = _dom2.default.createOpt(s[j], s[j], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - } // if multiFltsIndex - } else if (fltType === this.fltTypeCheckList) { - var checkList = this.Mod.checkList; - var divChk = checkList.checkListDiv[i]; - divChk.title = divChk.innerHTML; - divChk.innerHTML = ''; - - var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); - ul.className = checkList.checkListCssClass; - - var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); - li0.className = checkList.checkListItemCssClass; - ul.appendChild(li0); - - divChk.appendChild(ul); - - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - var li = _dom2.default.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.Mod.paging.setPagingInfo(); - } - } //end if - } - }, { - key: 'filter', - value: function filter() { - this.EvtManager(this.Evt.name.filter); - } - - /** - * Filter the table by retrieving the data from each cell in every single - * row and comparing it to the search term for current column. A row is - * hidden when all the search terms are not found in inspected row. - * - * TODO: Reduce complexity of this massive method - */ - - }, { - key: '_filter', - value: function _filter() { - if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { - return; - } - //invoke onbefore callback - if (this.onBeforeFilter) { - this.onBeforeFilter.call(null, this); - } - this.emitter.emit('before-filtering', this); - - var row = this.tbl.rows, - Mod = this.Mod, - hiddenrows = 0; - - this.validRowsIndex = []; - // search args re-init - this.searchArgs = this.getFiltersValue(); - - var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); - - //keyword highlighting - function highlight(str, ok, cell) { - /*jshint validthis:true */ - if (this.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 = _dom2.default.getText(cell); - } - if (w !== '') { - Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); - } - } - } - - //looks for search argument in current row - function hasArg(sA, cellData, j) { - /*jshint validthis:true */ - var occurence = undefined, - removeNbFormat = _helpers2.default.removeNbFormat; - - //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); - var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); - var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); - var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); - var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); - var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); - - var dte1 = undefined, - dte2 = undefined; - //dates - if (_date2.default.isValid(cellData, dtType)) { - dte1 = _date2.default.format(cellData, dtType); - // lower date - if (isLDate) { - dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); - occurence = dte1 < dte2; - } - // lower equal date - else if (isLEDate) { - dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); - occurence = dte1 <= dte2; - } - // greater equal date - else if (isGEDate) { - dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); - occurence = dte1 >= dte2; - } - // greater date - else if (isGDate) { - dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); - occurence = dte1 > dte2; - } - // different date - else if (isDFDate) { - dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); - occurence = dte1.toString() != dte2.toString(); - } - // equal date - else if (isEQDate) { - dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } else if (_date2.default.isValid(sA, dtType)) { - dte2 = _date2.default.format(sA, dtType); - occurence = dte1.toString() === dte2.toString(); - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } else { - //first numbers need to be formated - if (this.hasColNbFormat && this.colNbFormat[j]) { - numCellData = removeNbFormat(cellData, this.colNbFormat[j]); - nbFormat = this.colNbFormat[j]; - } else { - if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { - numCellData = removeNbFormat(cellData, 'us'); - nbFormat = 'us'; - } else { - numCellData = removeNbFormat(cellData, 'eu'); - nbFormat = 'eu'; - } - } - - // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, - // rgx:) - // lower equal - if (hasLE) { - occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); - } - //greater equal - else if (hasGE) { - occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); - } - //lower - else if (hasLO) { - occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); - } - //greater - else if (hasGR) { - occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); - } - //different - else if (hasDF) { - occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; - } - //like - else if (hasLK) { - occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } - //equal - else if (hasEQ) { - occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); - } - //starts with - else if (hasST) { - occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; - } - //ends with - else if (hasEN) { - var searchArg = sA.replace(re_en, ''); - occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } - //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(cellData); - } catch (e) { - occurence = false; - } - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } //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 = true, - - //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]; - var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; - if (sA === '') { - continue; - } - - var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); - - //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 = undefined, - occur = false, - s = hasMultiOrSA ? sAOrSplit : sAAndSplit; - for (var w = 0, len = s.length; w < len; w++) { - cS = _string2.default.trim(s[w]); - occur = hasArg.call(this, cS, cellData, j); - highlight.call(this, cS, occur, cell[j]); - if (hasMultiOrSA && occur) { - break; - } - if (hasMultiAndSA && !occur) { - break; - } - } - occurence[j] = occur; - } - //single search parameter - else { - occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); - highlight.call(this, sA, occurence[j], cell[j]); - } //else single param - - if (!occurence[j]) { - isRowValid = false; - } - if (this.singleSearchFlt && occurence[j]) { - singleFltRowValid = true; - } - if (this.popupFilters) { - Mod.popupFilter.buildIcon(j, true); - } - if (this.markActiveColumns) { - if (k === this.refRow) { - if (this.onBeforeActiveColumn) { - this.onBeforeActiveColumn.call(null, this, j); - } - _dom2.default.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); - // if(Mod.alternateRows){ - // Mod.alternateRows.removeRowBg(k); - // } - // always visible rows need to be counted as valid - if (this.hasVisibleRows && this.visibleRows.indexOf(k) !== -1) { - this.validRowsIndex.push(k); - } else { - hiddenrows++; - } - } else { - this.validateRow(k, true); - this.validRowsIndex.push(k); - // if(this.alternateRows){ - // Mod.alternateRows.setRowBg(k, this.validRowsIndex.length); - // } - if (this.onRowValidated) { - this.onRowValidated.call(null, this, k); - } - this.emitter.emit('row-validated', this, k); - } - this.emitter.emit('row-processed', this, k, isRowValid); - } // for k - - this.nbVisibleRows = this.validRowsIndex.length; - this.nbHiddenRows = hiddenrows; - - //invokes onafterfilter callback - if (this.onAfterFilter) { - this.onAfterFilter.call(null, this); - } - - this.emitter.emit('after-filtering', this); - } - - /** - * Return the data of a specified colum - * @param {Number} colIndex Column index - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} num Optional: return unformatted number - * @param {Array} exclude Optional: list of row indexes to be excluded - * @return {Array} Flat list of data for a column - */ - - }, { - key: 'getColValues', - value: function getColValues(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; - - if (!this.fltGrid) { - return; - } - var row = this.tbl.rows, - colValues = []; - - if (includeHeaders) { - colValues.push(this.getHeadersText()[colIndex]); - } - - for (var i = this.refRow; i < this.nbRows; i++) { - var isExludedRow = false; - // checks if current row index appears in exclude array - if (exclude.length > 0) { - isExludedRow = exclude.indexOf(i) != -1; - } - 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 !== '') { - continue; - } - var cellData = this.getCellData(cell[j]), - nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, - data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; - colValues.push(data); - } - } - } - return colValues; - } - - /** - * Return the filter's value of a specified column - * @param {Number} index Column index - * @return {String} Filter value - */ - - }, { - key: 'getFilterValue', - value: function getFilterValue(index) { - if (!this.fltGrid) { - return; - } - var fltValue = undefined, - flt = this.getFilterElement(index); - if (!flt) { - return ''; - } - - var fltColType = this.getFilterType(index); - if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { - fltValue = flt.value; - } - //mutiple select - else if (fltColType === this.fltTypeMulti) { - fltValue = ''; - for (var j = 0, len = flt.options.length; j < len; 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; - } - - /** - * Return the filters' values - * @return {Array} List of filters' values - */ - - }, { - key: 'getFiltersValue', - value: function getFiltersValue() { - if (!this.fltGrid) { - return; - } - var searchArgs = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); - } - return searchArgs; - } - - /** - * Return the ID of the filter of a specified column - * @param {Number} index Column's index - * @return {String} ID of the filter element - */ - - }, { - key: 'getFilterId', - value: function getFilterId(index) { - if (!this.fltGrid) { - return; - } - return this.fltIds[index]; - } - - /** - * Return the list of ids of filters matching a specified type. - * Note: hidden filters are also returned - * - * @param {String} type Filter type string ('input', 'select', 'multiple', - * 'checklist') - * @param {Boolean} bool If true returns columns indexes instead of IDs - * @return {[type]} List of element IDs or column indexes - */ - - }, { - key: 'getFiltersByType', - value: function getFiltersByType(type, bool) { - if (!this.fltGrid) { - return; - } - var arr = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - var fltType = this.getFilterType(i); - if (fltType === _string2.default.lower(type)) { - var a = bool ? i : this.fltIds[i]; - arr.push(a); - } - } - return arr; - } - - /** - * Return the filter's DOM element for a given column - * @param {Number} index Column's index - * @return {DOMElement} - */ - - }, { - key: 'getFilterElement', - value: function getFilterElement(index) { - var fltId = this.fltIds[index]; - return _dom2.default.id(fltId); - } - - /** - * Return the number of cells for a given row index - * @param {Number} rowIndex Index of the row - * @return {Number} Number of cells - */ - - }, { - key: 'getCellsNb', - value: function getCellsNb() { - var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; - - var tr = this.tbl.rows[rowIndex]; - return tr.cells.length; - } - - /** - * Return the number of filterable rows starting from reference row if - * defined - * @param {Boolean} includeHeaders Include the headers row - * @return {Number} Number of filterable rows - */ - - }, { - key: 'getRowsNb', - value: function getRowsNb(includeHeaders) { - var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, - ntrs = this.tbl.rows.length; - if (includeHeaders) { - s = 0; - } - return parseInt(ntrs - s, 10); - } - - /** - * Return the data of a given cell - * @param {DOMElement} cell Cell's DOM object - * @return {String} - */ - - }, { - key: 'getCellData', - value: function getCellData(cell) { - var idx = cell.cellIndex; - //Check for customCellData callback - if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { - return this.customCellData.call(null, this, cell, idx); - } else { - return _dom2.default.getText(cell); - } - } - - /** - * Return the table data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getTableData', - value: function getTableData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var rows = this.tbl.rows; - var tblData = []; - if (includeHeaders) { - tblData.push([this.getHeadersRowIndex(), this.getHeadersText()]); - } - for (var k = this.refRow; k < this.nbRows; k++) { - var rowData = [k, []]; - var cells = rows[k].cells; - for (var j = 0, len = cells.length; j < len; j++) { - var cellData = this.getCellData(cells[j]); - rowData[1].push(cellData); - } - tblData.push(rowData); - } - return tblData; - } - - /** - * Return the filtered data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredData', - value: function getFilteredData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - if (!this.validRowsIndex) { - return []; - } - var rows = this.tbl.rows, - filteredData = []; - if (includeHeaders) { - filteredData.push([this.getHeadersRowIndex(), this.getHeadersText()]); - } - - var validRows = this.getValidRows(true); - for (var i = 0; i < validRows.length; i++) { - var rData = [this.validRowsIndex[i], []], - cells = rows[this.validRowsIndex[i]].cells; - for (var k = 0; k < cells.length; k++) { - var cellData = this.getCellData(cells[k]); - rData[1].push(cellData); - } - filteredData.push(rData); - } - return filteredData; - } - - /** - * Return the filtered data for a given column index - * @param {Number} colIndex Colmun's index - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} Flat list of values ['val0','val1','val2'...] - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredDataCol', - value: function getFilteredDataCol(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (_types2.default.isUndef(colIndex)) { - return []; - } - var data = this.getFilteredData(), - colData = []; - if (includeHeaders) { - colData.push(this.getHeadersText()[colIndex]); - } - for (var i = 0, len = data.length; i < len; 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; - } - - /** - * Get the display value of a row - * @param {RowElement} DOM element of the row - * @return {String} Usually 'none' or '' - */ - - }, { - key: 'getRowDisplay', - value: function getRowDisplay(row) { - if (!_types2.default.isObj(row)) { - return null; - } - return row.style.display; - } - - /** - * Validate/invalidate row by setting the 'validRow' attribute on the row - * @param {Number} rowIndex Index of the row - * @param {Boolean} isValid - */ - - }, { - key: 'validateRow', - value: function validateRow(rowIndex, isValid) { - var row = this.tbl.rows[rowIndex]; - if (!row || typeof isValid !== 'boolean') { - return; - } - - // always visible rows are valid - if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { - isValid = true; - } - - var displayFlag = isValid ? '' : 'none', - validFlag = isValid ? 'true' : 'false'; - row.style.display = displayFlag; - - if (this.paging) { - row.setAttribute('validRow', validFlag); - } - } - - /** - * Validate all filterable rows - */ - - }, { - key: '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); - } - } - - /** - * Set search value to a given filter - * @param {Number} index Column's index - * @param {String} searcharg Search term - */ - - }, { - key: 'setFilterValue', - value: function setFilterValue(index) { - var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; - - if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { - return; - } - var slc = this.getFilterElement(index), - fltColType = this.getFilterType(index); - - if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { - slc.value = searcharg; - } - //multiple selects - else if (fltColType === this.fltTypeMulti) { - var s = searcharg.split(' ' + this.orOperator + ' '); - // let ct = 0; //keywords counter - for (var j = 0, len = slc.options.length; j < len; j++) { - var option = slc.options[j]; - if (s === '' || s[0] === '') { - option.selected = false; - } - if (option.value === '') { - option.selected = false; - } - if (option.value !== '' && _array2.default.has(s, option.value, true)) { - option.selected = true; - } //if - } //for j - } - //checklist - else if (fltColType === this.fltTypeCheckList) { - searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); - var sarg = searcharg.split(' ' + this.orOperator + ' '); - var lisNb = _dom2.default.tag(slc, 'li').length; - - slc.setAttribute('value', ''); - slc.setAttribute('indexes', ''); - - for (var k = 0; k < lisNb; k++) { - var li = _dom2.default.tag(slc, 'li')[k], - lbl = _dom2.default.tag(li, 'label')[0], - chk = _dom2.default.tag(li, 'input')[0], - lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); - if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { - chk.checked = true; - this.Mod.checkList.setCheckListValues(chk); - } else { - chk.checked = false; - this.Mod.checkList.setCheckListValues(chk); - } - } - } - } - - /** - * Set them columns' widths as per configuration - * @param {Number} rowIndex Optional row index to apply the widths to - * @param {Element} tbl DOM element - */ - - }, { - key: 'setColWidths', - value: function setColWidths(rowIndex, tbl) { - if (!this.fltGrid || !this.hasColWidths) { - return; - } - tbl = tbl || this.tbl; - var rIndex = undefined; - if (rowIndex === undefined) { - rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; - } else { - rIndex = rowIndex; - } - - setWidths.call(this); - - function setWidths() { - /*jshint validthis:true */ - var nbCols = this.nbCells; - var colWidths = this.colWidths; - var colTags = _dom2.default.tag(tbl, 'col'); - var tblHasColTag = colTags.length > 0; - var frag = !tblHasColTag ? doc.createDocumentFragment() : null; - for (var k = 0; k < nbCols; k++) { - var col = undefined; - if (tblHasColTag) { - col = colTags[k]; - } else { - col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); - frag.appendChild(col); - } - col.style.width = colWidths[k]; - } - if (!tblHasColTag) { - tbl.insertBefore(frag, tbl.firstChild); - } - } - } - - /** - * Makes defined rows always visible - */ - - }, { - key: 'enforceVisibility', - value: function enforceVisibility() { - if (!this.hasVisibleRows) { - return; - } - for (var i = 0, len = this.visibleRows.length; i < len; i++) { - var row = this.visibleRows[i]; - //row index cannot be > nrows - if (row <= this.nbRows) { - this.validateRow(row, true); - } - } - } - }, { - key: 'clearFilters', - value: function clearFilters() { - this.EvtManager(this.Evt.name.clear); - } - - /** - * Clear all the filters' values - */ - - }, { - key: '_clearFilters', - value: function _clearFilters() { - if (!this.fltGrid) { - return; - } - if (this.onBeforeReset) { - this.onBeforeReset.call(null, this, this.getFiltersValue()); - } - for (var i = 0, len = this.fltIds.length; i < len; i++) { - this.setFilterValue(i, ''); - } - // if(this.linkedFilters){ - // this.linkFilters(); - // } - if (this.rememberPageLen) { - _cookie2.default.remove(this.pgLenCookie); - } - if (this.rememberPageNb) { - _cookie2.default.remove(this.pgNbCookie); - } - if (this.onAfterReset) { - this.onAfterReset.call(null, this); - } - - this.emitter.emit('cleared-filters', this); - } - - /** - * Clears filtered columns visual indicator (background color) - */ - - }, { - key: 'clearActiveColumns', - value: function clearActiveColumns() { - for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { - _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); - } - } - - /** - * Refresh the filters subject to linking ('select', 'multiple', - * 'checklist' type) - */ - - }, { - key: 'linkFilters', - value: function linkFilters() { - if (!this.linkedFilters || !this.activeFilterId) { - return; - } - 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); - - var activeFlt = this.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(this.prfxFlt)[1]; - var slcSelectedValue = undefined; - for (var i = 0, len = slcIndex.length; i < len; i++) { - var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); - slcSelectedValue = this.getFilterValue(slcIndex[i]); - - // Welcome to cyclomatic complexity hell :) - // TODO: simplify/refactor if statement - if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; - } else { - curSlc.innerHTML = ''; - } - - //1st option needs to be inserted - if (this.loadFltOnDemand) { - var opt0 = _dom2.default.createOpt(this.displayAllText, ''); - if (curSlc) { - curSlc.appendChild(opt0); - } - } - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList._build(slcIndex[i]); - } else { - this.Mod.dropdown._build(slcIndex[i], true); - } - - this.setFilterValue(slcIndex[i], slcSelectedValue); - } - } // for i - } - - /** - * Re-generate the filters grid bar when previously removed - */ - - }, { - key: '_resetGrid', - value: function _resetGrid() { - if (this.isFirstLoad) { - return; - } - - var Mod = this.Mod; - var tbl = this.tbl; - var rows = tbl.rows; - var filtersRowIndex = this.filtersRowIndex; - var filtersRow = rows[filtersRowIndex]; - - // grid was removed, grid row element is stored in fltGridEl property - if (!this.gridLayout) { - // If table has a thead ensure the filters row is appended in the - // thead element - if (tbl.tHead) { - var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); - tbl.tHead.replaceChild(this.fltGridEl, tempRow); - } else { - filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); - } - } - - // filters are appended in external placeholders elements - if (this.isExternalFlt) { - var externalFltTgtIds = this.externalFltTgtIds; - for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { - var extFlt = _dom2.default.id(externalFltTgtIds[ct]); - - if (!extFlt) { - continue; - } - - var externalFltEl = this.externalFltEls[ct]; - extFlt.appendChild(externalFltEl); - var colFltType = this.getFilterType(ct); - //IE special treatment for gridLayout, appended filters are - //empty - if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { - if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { - Mod.dropdown.build(ct); - } - if (colFltType === this.fltTypeCheckList) { - Mod.checkList.build(ct); - } - } - } - } - - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = rows.length; - - if (this.popupFilters) { - this.headersRow++; - Mod.popupFilter.reset(); - } - - if (!this.gridLayout) { - _dom2.default.addClass(this.tbl, this.prfxTf); - } - this._hasGrid = true; - } - - /** - * Determines if passed filter column implements exact query match - * @param {Number} colIndex [description] - * @return {Boolean} [description] - */ - - }, { - key: 'isExactMatch', - value: function isExactMatch(colIndex) { - var fltType = this.getFilterType(colIndex); - return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; - } - - /** - * Check if passed script or stylesheet is already imported - * @param {String} filePath Ressource path - * @param {String} type Possible values: 'script' or 'link' - * @return {Boolean} - */ - - }, { - key: 'isImported', - value: function isImported(filePath, type) { - var imported = false, - importType = !type ? 'script' : type, - attr = importType == 'script' ? 'src' : 'href', - files = _dom2.default.tag(doc, importType); - for (var i = 0, len = files.length; i < len; i++) { - if (files[i][attr] === undefined) { - continue; - } - if (files[i][attr].match(filePath)) { - imported = true; - break; - } - } - return imported; - } - - /** - * Import script or stylesheet - * @param {String} fileId Ressource ID - * @param {String} filePath Ressource path - * @param {Function} callback Callback - * @param {String} type Possible values: 'script' or 'link' - */ - - }, { - key: 'import', - value: function _import(fileId, filePath, callback, type) { - var ftype = !type ? 'script' : type, - imported = this.isImported(filePath, ftype); - if (imported) { - return; - } - var o = this, - isLoaded = false, - file = undefined, - head = _dom2.default.tag(doc, 'head')[0]; - - if (_string2.default.lower(ftype) === 'link') { - file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); - } else { - file = _dom2.default.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: ' + filePath); - }; - head.appendChild(file); - } - - /** - * Check if table has filters grid - * @return {Boolean} - */ - - }, { - key: 'hasGrid', - value: function hasGrid() { - return this._hasGrid; - } - - /** - * Get list of filter IDs - * @return {[type]} [description] - */ - - }, { - key: 'getFiltersId', - value: function getFiltersId() { - return this.fltIds || []; - } - - /** - * Get filtered (valid) rows indexes - * @param {Boolean} reCalc Force calculation of filtered rows list - * @return {Array} List of row indexes - */ - - }, { - key: 'getValidRows', - value: function getValidRows(reCalc) { - 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; - } - - /** - * Get the index of the row containing the filters - * @return {Number} - */ - - }, { - key: 'getFiltersRowIndex', - value: function getFiltersRowIndex() { - return this.filtersRowIndex; - } - - /** - * Get the index of the headers row - * @return {Number} - */ - - }, { - key: 'getHeadersRowIndex', - value: function getHeadersRowIndex() { - return this.headersRow; - } - - /** - * Get the row index from where the filtering process start (1st filterable - * row) - * @return {Number} - */ - - }, { - key: 'getStartRowIndex', - value: function getStartRowIndex() { - return this.refRow; - } - - /** - * Get the index of the last row - * @return {Number} - */ - - }, { - key: 'getLastRowIndex', - value: function getLastRowIndex() { - if (!this._hasGrid) { - return; - } - return this.nbRows - 1; - } - - /** - * Get the header DOM element for a given column index - * @param {Number} colIndex Column index - * @return {Object} - */ - - }, { - key: 'getHeaderElement', - value: function getHeaderElement(colIndex) { - var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; - var tHead = _dom2.default.tag(table, 'thead'); - var headersRow = this.headersRow; - var header = undefined; - for (var i = 0; i < this.nbCells; i++) { - if (i !== colIndex) { - continue; - } - if (tHead.length === 0) { - header = table.rows[headersRow].cells[i]; - } - if (tHead.length === 1) { - header = tHead[0].rows[headersRow].cells[i]; - } - break; - } - return header; - } - - /** - * Return the list of headers' text - * @return {Array} list of headers' text - */ - - }, { - key: 'getHeadersText', - value: function getHeadersText() { - var headers = []; - for (var j = 0; j < this.nbCells; j++) { - var header = this.getHeaderElement(j); - var headerText = _dom2.default.getText(header); - headers.push(headerText); - } - return headers; - } - - /** - * Return the filter type for a specified column - * @param {Number} colIndex Column's index - * @return {String} - */ - - }, { - key: 'getFilterType', - value: function getFilterType(colIndex) { - var colType = this.cfg['col_' + colIndex]; - return !colType ? this.fltTypeInp : _string2.default.lower(colType); - } - - /** - * Get the total number of filterable rows - * @return {Number} - */ - - }, { - key: 'getFilterableRowsNb', - value: function getFilterableRowsNb() { - return this.getRowsNb(false); - } - - /** - * Get the configuration object (literal object) - * @return {Object} - */ - - }, { - key: 'config', - value: function config() { - return this.cfg; - } - }]); - - return TableFilter; - })(); - -/***/ }, -/* 1 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * DOM event utilities - */ - - exports.default = { - 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; - } - }, - target: function target(evt) { - return evt && evt.target || window.event && window.event.srcElement; - }, - keyCode: function keyCode(evt) { - return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; - } - }; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * DOM utilities - */ - - exports.default = { - - /** - * Returns text + text of children of given node - * @param {NodeElement} node - * @return {String} - */ - - getText: function getText(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 - */ - create: function create(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]); - } - } - } - return el; - }, - - /** - * Removes passed node from DOM - * @param {DOMElement} node - * @return {DOMElement} old node reference - */ - remove: function remove(node) { - return node.parentNode.removeChild(node); - }, - - /** - * Returns a text node with given text - * @param {String} txt - * @return {Object} - */ - text: function text(txt) { - return document.createTextNode(txt); - }, - hasClass: function hasClass(ele, cls) { - if (!ele) { - return false; - } - - if (supportsClassList()) { - return ele.classList.contains(cls); - } - return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); - }, - addClass: function addClass(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; - } - }, - removeClass: function removeClass(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 - */ - createOpt: function createOpt(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 - */ - createCheckItem: function createCheckItem(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; - }, - id: function id(key) { - return document.getElementById(key); - }, - tag: function tag(o, tagname) { - return o.getElementsByTagName(tagname); - } - }; - - // HTML5 classList API - - function supportsClassList() { - return document.documentElement.classList; - } - -/***/ }, -/* 3 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * String utilities - */ - - exports.default = { - lower: function lower(text) { - return text.toLowerCase(); - }, - upper: function upper(text) { - return text.toUpperCase(); - }, - trim: function trim(text) { - if (text.trim) { - return text.trim(); - } - return text.replace(/^\s*|\s*$/g, ''); - }, - isEmpty: function isEmpty(text) { - return this.trim(text) === ''; - }, - rgxEsc: function rgxEsc(text) { - var chars = /[-\/\\^$*+?.()|[\]{}]/g; - var escMatch = '\\$&'; - return String(text).replace(chars, escMatch); - }, - matchCase: function matchCase(text, caseSensitive) { - if (!caseSensitive) { - return this.lower(text); - } - return text; - }, - - /** - * Checks if passed data contains the searched term - * @param {String} term Searched term - * @param {String} data Data string - * @param {Boolean} exactMatch Exact match - * @param {Boolean} caseSensitive Case sensitive - * @return {Boolean} - */ - contains: function contains(term, data) { - var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; - - // Improved by Cedric Wartel (cwl) automatic exact match for selects and - // special characters are now filtered - var regexp = undefined, - modifier = caseSensitive ? 'g' : 'gi'; - if (exactMatch) { - regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); - } else { - regexp = new RegExp(this.rgxEsc(term), modifier); - } - return regexp.test(data); - } - }; - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Cookie utilities - */ - - exports.default = { - write: function write(name, value, hours) { - var expire = ''; - if (hours) { - expire = new Date(new Date().getTime() + hours * 3600000); - expire = '; expires=' + expire.toGMTString(); - } - document.cookie = name + '=' + escape(value) + expire; - }, - read: function read(name) { - var cookieValue = '', - search = name + '='; - if (document.cookie.length > 0) { - var cookie = document.cookie, - offset = cookie.indexOf(search); - if (offset !== -1) { - offset += search.length; - var end = cookie.indexOf(';', offset); - if (end === -1) { - end = cookie.length; - } - cookieValue = unescape(cookie.substring(offset, end)); - } - } - return cookieValue; - }, - remove: function remove(name) { - this.write(name, '', -1); - }, - valueToArray: function valueToArray(name, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.read(name); - //creates an array with filters' values - var arr = val.split(separator); - return arr; - }, - getValueByIndex: function getValueByIndex(name, index, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.valueToArray(name, separator); - return val[index]; - } - }; - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * Types utilities - */ - - var UNDEFINED = void 0; - - exports.default = { - /** - * Check if argument is an object or a global object - * @param {String or Object} v - * @return {Boolean} - */ - - isObj: function isObj(v) { - var isO = false; - if (typeof v === 'string') { - if (window[v] && _typeof(window[v]) === 'object') { - isO = true; - } - } else { - if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { - isO = true; - } - } - return isO; - }, - - /** - * Check if argument is a function - * @param {Function} fn - * @return {Boolean} - */ - isFn: function isFn(fn) { - return fn && fn.constructor == Function; - }, - - /** - * Check if argument is an array - * @param {Array} obj - * @return {Boolean} - */ - isArray: function isArray(obj) { - return obj && obj.constructor == Array; - }, - - /** - * Determine if argument is undefined - * @param {Any} o - * @return {Boolean} - */ - isUndef: function isUndef(o) { - return o === UNDEFINED; - }, - - /** - * Determine if argument is null - * @param {Any} o - * @return {Boolean} - */ - isNull: function isNull(o) { - return o === null; - }, - - /** - * Determine if argument is empty (undefined, null or empty string) - * @param {Any} o - * @return {Boolean} - */ - isEmpty: function isEmpty(o) { - return this.isUndef(o) || this.isNull(o) || o.length === 0; - } - }; - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - has: function has(arr, val, caseSensitive) { - var sCase = caseSensitive === undefined ? false : caseSensitive; - for (var i = 0; i < arr.length; i++) { - if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { - return true; - } - } - return false; - } - }; /** - * Array utilities - */ - -/***/ }, -/* 7 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Date utilities - */ - - exports.default = { - 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 = undefined, - reg2 = undefined; - // 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 = undefined, - dd = undefined, - yy = undefined; - // 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(dateStr, formatStr) { - if (!formatStr) { - formatStr = 'DMY'; - } - if (!dateStr || dateStr === '') { - return new Date(1001, 0, 1); - } - var oDate = undefined; - var parts = undefined; - - switch (formatStr.toUpperCase()) { - case 'DDMMMYYYY': - parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); - oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); - break; - case 'DMY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'MDY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'YMD': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - default: - //in case format is not correct - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - } - return oDate; - } - }; - - function y2kDate(yr) { - if (yr === undefined) { - return 0; - } - if (yr.length > 2) { - return yr; - } - var y = undefined; - //>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; - } - - function mmm2mm(mmm) { - if (mmm === undefined) { - return 0; - } - var mondigit = undefined; - 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; - } - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - removeNbFormat: function removeNbFormat(data, format) { - if (!data) { - return; - } - if (!format) { - format = 'us'; - } - var n = data; - if (_string2.default.lower(format) === 'us') { - n = +n.replace(/[^\d\.-]/g, ''); - } else { - n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); - } - return n; - } - }; /** - * Misc helpers - */ - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - "use strict"; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /** - * Event emitter class - */ - - var Emitter = exports.Emitter = (function () { - function Emitter() { - _classCallCheck(this, Emitter); - - /** - * Events object - * @type {Object} - */ - this.events = {}; - } - - /** - * Subscribe to an event - * @param {String} evt Event name - * @param {Function} fn Function invoked when event is emitted - */ - - _createClass(Emitter, [{ - key: "on", - value: function on(evt, fn) { - this.events[evt] = this.events[evt] || []; - this.events[evt].push(fn); - } - - /** - * Unsubscribe to an event - * @param {String} evt Event name - * @param {Function} fn Function invoked when event is emitted - */ - - }, { - key: "off", - value: function off(evt, fn) { - if (evt in this.events) { - this.events[evt].splice(this.events[evt].indexOf(fn), 1); - } - } - - /** - * Emit an event - * @param {String} evt Event name followed by any other argument passed to - * the invoked function - */ - - }, { - key: "emit", - value: function emit(evt /*, args...*/) { - if (evt in this.events === false) { - return; - } - for (var i = 0; i < this.events[evt].length; i++) { - this.events[evt][i].apply(this, [].slice.call(arguments, 1)); - } - } - }]); - - return Emitter; - })(); - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Store = undefined; - - var _cookie = __webpack_require__(4); - - var _cookie2 = _interopRequireDefault(_cookie); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Store = exports.Store = (function () { - - /** - * Store, persistence manager - * @param {Object} tf TableFilter instance - * - * TODO: use localStorage and fallback to cookie persistence - */ - - function Store(tf) { - _classCallCheck(this, Store); - - var f = tf.config(); - - this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(Store, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on('after-filtering', function () { - return _this.saveFilterValues(_this.tf.fltsValuesCookie); - }); - } - - /** - * Store filters' values in cookie - * @param {String} cookie name - */ - - }, { - key: 'saveFilterValues', - value: function saveFilterValues(name) { - var tf = this.tf; - var fltValues = []; - //store filters' values - for (var i = 0; i < tf.fltIds.length; i++) { - var value = tf.getFilterValue(i); - if (value === '') { - value = ' '; - } - fltValues.push(value); - } - //adds array size - fltValues.push(tf.fltIds.length); - - //writes cookie - _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); - } - - /** - * Retrieve filters' values from cookie - * @param {String} cookie name - * @return {Array} - */ - - }, { - key: 'getFilterValues', - value: function getFilterValues(name) { - var flts = _cookie2.default.read(name); - var rgx = new RegExp(this.tf.separator, 'g'); - // filters' values array - return flts.split(rgx); - } - - /** - * Store page number in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageNb', - value: function savePageNb(name) { - _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); - } - - /** - * Retrieve page number from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageNb', - value: function getPageNb(name) { - return _cookie2.default.read(name); - } - - /** - * Store page length in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageLength', - value: function savePageLength(name) { - _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); - } - - /** - * Retrieve page length from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageLength', - value: function getPageLength(name) { - return _cookie2.default.read(name); - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off('after-filtering', function () { - return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); - }); - } - }]); - - return Store; - })(); - -/***/ }, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.GridLayout = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var GridLayout = exports.GridLayout = (function (_Feature) { - _inherits(GridLayout, _Feature); - - /** - * Grid layout, table with fixed headers - * @param {Object} tf TableFilter instance - */ - - function GridLayout(tf) { - _classCallCheck(this, GridLayout); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); - - var f = _this.config; - - //defines grid width - _this.gridWidth = f.grid_width || null; - //defines grid height - _this.gridHeight = f.grid_height || null; - //defines css class for main container - _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; - //defines css class for div containing table - _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; - //defines css class for div containing headers' table - _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; - //defines css class for div containing rows counter, paging etc. - _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; - //defines which row contains column headers - _this.gridHeadRowIndex = f.grid_headers_row_index || 0; - //array of headers row indexes to be placed in header table - _this.gridHeadRows = f.grid_headers_rows || [0]; - //generate filters in table headers - _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; - //default col width - _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; - - _this.gridColElms = []; - - //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_'; - - _this.sourceTblHtml = tf.tbl.outerHTML; - return _this; - } - - /** - * Generates a grid with fixed headers - */ - - _createClass(GridLayout, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - var f = this.config; - var tbl = tf.tbl; - - if (this.initialized) { - return; - } - - tf.isExternalFlt = true; - - // default width of 100px if column widths not set - if (!tf.hasColWidths) { - tf.colWidths = []; - for (var k = 0; k < tf.nbCells; k++) { - var colW, - cell = tbl.rows[this.gridHeadRowIndex].cells[k]; - if (cell.width !== '') { - colW = cell.width; - } else if (cell.style.width !== '') { - colW = parseInt(cell.style.width, 10); - } else { - colW = this.gridDefaultColWidth; - } - tf.colWidths[k] = colW; - } - tf.hasColWidths = true; - } - tf.setColWidths(this.gridHeadRowIndex); - - var tblW; //initial table width - if (tbl.width !== '') { - tblW = tbl.width; - } else if (tbl.style.width !== '') { - tblW = parseInt(tbl.style.width, 10); - } else { - tblW = tbl.clientWidth; - } - - //Main container: it will contain all the elements - this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); - this.tblMainCont.className = this.gridMainContCssClass; - if (this.gridWidth) { - this.tblMainCont.style.width = this.gridWidth; - } - tbl.parentNode.insertBefore(this.tblMainCont, tbl); - - //Table container: div wrapping content table - this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); - this.tblCont.className = this.gridContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.tblCont.style.width = '100%'; - } else { - this.tblCont.style.width = this.gridWidth; - } - } - if (this.gridHeight) { - this.tblCont.style.height = this.gridHeight; - } - tbl.parentNode.insertBefore(this.tblCont, tbl); - var t = _dom2.default.remove(tbl); - this.tblCont.appendChild(t); - - //In case table width is expressed in % - if (tbl.style.width === '') { - tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; - } - - var d = _dom2.default.remove(this.tblCont); - this.tblMainCont.appendChild(d); - - //Headers table container: div wrapping headers table - this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); - this.headTblCont.className = this.gridHeadContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.headTblCont.style.width = '100%'; - } else { - this.headTblCont.style.width = this.gridWidth; - } - } - - //Headers table - this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); - var tH = _dom2.default.create('tHead'); - - //1st row should be headers row, ids are added if not set - //Those ids are used by the sort feature - var hRow = tbl.rows[this.gridHeadRowIndex]; - var sortTriggers = []; - for (var n = 0; n < tf.nbCells; n++) { - var c = hRow.cells[n]; - var thId = c.getAttribute('id'); - if (!thId || thId === '') { - thId = this.prfxGridTh + n + '_' + tf.id; - c.setAttribute('id', thId); - } - sortTriggers.push(thId); - } - - //Filters row is created - var filtersRow = _dom2.default.create('tr'); - if (this.gridEnableFilters && tf.fltGrid) { - tf.externalFltTgtIds = []; - for (var j = 0; j < tf.nbCells; j++) { - var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; - var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); - filtersRow.appendChild(cl); - tf.externalFltTgtIds[j] = fltTdId; - } - } - //Headers row are moved from content table to headers table - for (var i = 0; i < this.gridHeadRows.length; i++) { - var headRow = tbl.rows[this.gridHeadRows[0]]; - tH.appendChild(headRow); - } - this.headTbl.appendChild(tH); - if (tf.filtersRowIndex === 0) { - tH.insertBefore(filtersRow, hRow); - } else { - tH.appendChild(filtersRow); - } - - this.headTblCont.appendChild(this.headTbl); - this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); - - //THead needs to be removed in content table for sort feature - var thead = _dom2.default.tag(tbl, 'thead'); - if (thead.length > 0) { - tbl.removeChild(thead[0]); - } - - //Headers table style - this.headTbl.style.tableLayout = 'fixed'; - tbl.style.tableLayout = 'fixed'; - this.headTbl.cellPadding = tbl.cellPadding; - this.headTbl.cellSpacing = tbl.cellSpacing; - // this.headTbl.style.width = tbl.style.width; - - //content table without headers needs col widths to be reset - tf.setColWidths(0, this.headTbl); - - //Headers container width - // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; - - tbl.style.width = ''; - // - this.headTbl.style.width = tbl.clientWidth + 'px'; - // - - //scroll synchronisation - _event2.default.add(this.tblCont, 'scroll', function (evt) { - var elm = _event2.default.target(evt); - var scrollLeft = elm.scrollLeft; - _this2.headTblCont.scrollLeft = scrollLeft; - //New pointerX calc taking into account scrollLeft - // if(!o.isPointerXOverwritten){ - // try{ - // o.Evt.pointerX = function(evt){ - // var e = evt || global.event; - // var bdScrollLeft = tf_StandardBody().scrollLeft + - // scrollLeft; - // return (e.pageX + scrollLeft) || - // (e.clientX + bdScrollLeft); - // }; - // o.isPointerXOverwritten = true; - // } catch(err) { - // o.isPointerXOverwritten = false; - // } - // } - }); - - //Configure sort extension if any - var sort = (f.extensions || []).filter(function (itm) { - return itm.name === 'sort'; - }); - if (sort.length === 1) { - sort[0].async_sort = true; - sort[0].trigger_ids = sortTriggers; - } - - //Cols generation for all browsers excepted IE<=7 - this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; - - //Col elements are enough to keep column widths after sorting and - //filtering - var createColTags = function createColTags() { - for (var k = tf.nbCells - 1; k >= 0; k--) { - var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); - tbl.insertBefore(col, tbl.firstChild); - col.style.width = tf.colWidths[k]; - this.gridColElms[k] = col; - } - this.tblHasColTag = true; - }; - - if (!this.tblHasColTag) { - createColTags.call(this); - } else { - var cols = _dom2.default.tag(tbl, 'col'); - for (var ii = 0; ii < tf.nbCells; ii++) { - cols[ii].setAttribute('id', tf.id + '_col_' + ii); - cols[ii].style.width = tf.colWidths[ii]; - this.gridColElms.push(cols[ii]); - } - } - - var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; - f.on_after_col_resized = function (o, colIndex) { - if (!colIndex) { - return; - } - var w = o.crWColsRow.cells[colIndex].style.width; - var col = o.gridColElms[colIndex]; - col.style.width = w; - - var thCW = o.crWColsRow.cells[colIndex].clientWidth; - var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; - - if (thCW != tdCW) { - o.headTbl.style.width = tbl.clientWidth + 'px'; - } - - if (afterColResizedFn) { - afterColResizedFn.call(null, o, colIndex); - } - }; - - if (tf.popupFilters) { - filtersRow.style.display = 'none'; - } - - if (tbl.clientWidth !== this.headTbl.clientWidth) { - tbl.style.width = this.headTbl.clientWidth + 'px'; - } - - this.initialized = true; - } - - /** - * Removes the grid layout - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - var tbl = tf.tbl; - - if (!this.initialized) { - return; - } - var t = _dom2.default.remove(tbl); - this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); - _dom2.default.remove(this.tblMainCont); - - this.tblMainCont = null; - this.headTblCont = null; - this.headTbl = null; - this.tblCont = null; - - tbl.outerHTML = this.sourceTblHtml; - //needed to keep reference of table element for future usage - this.tf.tbl = t; - - this.initialized = false; - } - }]); - - return GridLayout; - })(_feature.Feature); - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var NOTIMPLEMENTED = 'Not implemented.'; - - var Feature = exports.Feature = (function () { - function Feature(tf, feature) { - _classCallCheck(this, Feature); - - this.tf = tf; - this.feature = feature; - this.enabled = tf[feature]; - this.config = tf.config(); - this.emitter = tf.emitter; - this.initialized = false; - } - - _createClass(Feature, [{ - key: 'init', - value: function init() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - } - }, { - key: 'destroy', - value: function destroy() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'enable', - value: function enable() { - this.enabled = true; - } - }, { - key: 'disable', - value: function disable() { - this.enabled = false; - } - }, { - key: 'isEnabled', - value: function isEnabled() { - return this.enabled; - } - }]); - - return Feature; - })(); - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Loader = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var Loader = exports.Loader = (function (_Feature) { - _inherits(Loader, _Feature); - - /** - * Loading message/spinner - * @param {Object} tf TableFilter instance - */ - - function Loader(tf) { - _classCallCheck(this, Loader); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); - - var f = _this.config; - - //id of container element - _this.loaderTgtId = f.loader_target_id || null; - //div containing loader - _this.loaderDiv = null; - //defines loader text - _this.loaderText = f.loader_text || 'Loading...'; - //defines loader innerHtml - _this.loaderHtml = f.loader_html || null; - //defines css class for loader div - _this.loaderCssClass = f.loader_css_class || 'loader'; - //delay for hiding loader - _this.loaderCloseDelay = 200; - //callback function before loader is displayed - _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; - //callback function after loader is closed - _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; - //loader div - _this.prfxLoader = 'load_'; - return _this; - } - - _createClass(Loader, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - var tf = this.tf; - - var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); - containerDiv.className = this.loaderCssClass; - - var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); - if (!this.loaderTgtId) { - targetEl.insertBefore(containerDiv, tf.tbl); - } else { - targetEl.appendChild(containerDiv); - } - this.loaderDiv = containerDiv; - if (!this.loaderHtml) { - this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); - } else { - this.loaderDiv.innerHTML = this.loaderHtml; - } - - this.show('none'); - this.initialized = true; - } - }, { - key: 'show', - value: function show(p) { - var _this2 = this; - - if (!this.isEnabled() || this.loaderDiv.style.display === p) { - return; - } - - var displayLoader = function displayLoader() { - if (!_this2.loaderDiv) { - return; - } - if (_this2.onShowLoader && p !== 'none') { - _this2.onShowLoader.call(null, _this2); - } - _this2.loaderDiv.style.display = p; - if (_this2.onHideLoader && p === 'none') { - _this2.onHideLoader.call(null, _this2); - } - }; - - var t = p === 'none' ? this.loaderCloseDelay : 1; - global.setTimeout(displayLoader, t); - } - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - - _dom2.default.remove(this.loaderDiv); - this.loaderDiv = null; - this.initialized = false; - } - }]); - - return Loader; - })(_feature.Feature); - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.HighlightKeyword = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var HighlightKeyword = exports.HighlightKeyword = (function () { - - /** - * HighlightKeyword, highlight matched keyword - * @param {Object} tf TableFilter instance - */ - - function HighlightKeyword(tf) { - _classCallCheck(this, HighlightKeyword); - - var f = tf.config(); - //defines css class for highlighting - this.highlightCssClass = f.highlight_css_class || 'keyword'; - this.highlightedNodes = []; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(HighlightKeyword, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on('before-filtering', function () { - return _this.unhighlightAll(); - }); - } - - /** - * highlight occurences of searched term in passed node - * @param {Node} node - * @param {String} word Searched term - * @param {String} cssClass Css class name - */ - - }, { - key: 'highlight', - value: function highlight(node, word, cssClass) { - // Iterate into this nodes childNodes - if (node.hasChildNodes) { - var children = node.childNodes; - for (var i = 0; i < children.length; i++) { - this.highlight(children[i], word, cssClass); - } - } - - if (node.nodeType === 3) { - var tempNodeVal = _string2.default.lower(node.nodeValue); - var tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) != -1) { - var pn = node.parentNode; - if (pn && pn.className != cssClass) { - // word not highlighted yet - var nv = node.nodeValue, - ni = tempNodeVal.indexOf(tempWordVal), - - // Create a load of replacement nodes - before = _dom2.default.text(nv.substr(0, ni)), - docWordVal = nv.substr(ni, word.length), - after = _dom2.default.text(nv.substr(ni + word.length)), - hiwordtext = _dom2.default.text(docWordVal), - hiword = _dom2.default.create('span'); - hiword.className = cssClass; - hiword.appendChild(hiwordtext); - pn.insertBefore(before, node); - pn.insertBefore(hiword, node); - pn.insertBefore(after, node); - pn.removeChild(node); - this.highlightedNodes.push(hiword.firstChild); - } - } - } - } - - /** - * Removes highlight to nodes matching passed string - * @param {String} word - * @param {String} cssClass Css class to remove - */ - - }, { - key: 'unhighlight', - value: function unhighlight(word, cssClass) { - var arrRemove = []; - var highlightedNodes = this.highlightedNodes; - for (var i = 0; i < highlightedNodes.length; i++) { - var n = highlightedNodes[i]; - if (!n) { - continue; - } - var tempNodeVal = _string2.default.lower(n.nodeValue), - tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) !== -1) { - var pn = n.parentNode; - if (pn && pn.className === cssClass) { - var prevSib = pn.previousSibling, - nextSib = pn.nextSibling; - if (!prevSib || !nextSib) { - continue; - } - nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; - prevSib.nodeValue = ''; - n.nodeValue = ''; - arrRemove.push(i); - } - } - } - for (var k = 0; k < arrRemove.length; k++) { - highlightedNodes.splice(arrRemove[k], 1); - } - } - - /** - * Clear all occurrences of highlighted nodes - */ - - }, { - key: 'unhighlightAll', - value: function unhighlightAll() { - if (!this.tf.highlightKeywords || !this.tf.searchArgs) { - return; - } - for (var y = 0; y < this.tf.searchArgs.length; y++) { - this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); - } - this.highlightedNodes = []; - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off('before-filtering', function () { - return _this2.unhighlightAll(); - }); - } - }]); - - return HighlightKeyword; - })(); - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.PopupFilter = undefined; - - var _feature = __webpack_require__(12); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var PopupFilter = exports.PopupFilter = (function (_Feature) { - _inherits(PopupFilter, _Feature); - - /** - * Pop-up filter component - * @param {Object} tf TableFilter instance - */ - - function PopupFilter(tf) { - _classCallCheck(this, PopupFilter); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); - - var f = _this.config; - - // Enable external filters behaviour - tf.isExternalFlt = true; - tf.externalFltTgtIds = []; - - //filter icon path - _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; - //active filter icon path - _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; - _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; - //defines css class for popup div containing filter - _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; - //callback function before popup filtes is opened - _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; - //callback function after popup filtes is opened - _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; - //callback function before popup filtes is closed - _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; - //callback function after popup filtes is closed - _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; - - //stores filters spans - _this.popUpFltSpans = []; - //stores filters icons - _this.popUpFltImgs = []; - //stores filters containers - _this.popUpFltElms = _this.popUpFltElmCache || []; - _this.popUpFltAdjustToContainer = true; - - //id prefix for pop-up filter span - _this.prfxPopUpSpan = 'popUpSpan_'; - //id prefix for pop-up div containing filter - _this.prfxPopUpDiv = 'popUpDiv_'; - return _this; - } - - _createClass(PopupFilter, [{ - key: 'onClick', - value: function onClick(e) { - var evt = e || global.event, - elm = evt.target.parentNode, - colIndex = parseInt(elm.getAttribute('ci'), 10); - - this.closeAll(colIndex); - this.toggle(colIndex); - - if (this.popUpFltAdjustToContainer) { - var popUpDiv = this.popUpFltElms[colIndex], - header = this.tf.getHeaderElement(colIndex), - headerWidth = header.clientWidth * 0.95; - popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; - } - _event2.default.cancel(evt); - _event2.default.stop(evt); - } - - /** - * Initialize DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - for (var i = 0; i < tf.nbCells; i++) { - if (tf.getFilterType(i) === tf.fltTypeNone) { - continue; - } - var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); - popUpSpan.innerHTML = this.popUpImgFltHtml; - var header = tf.getHeaderElement(i); - header.appendChild(popUpSpan); - _event2.default.add(popUpSpan, 'click', function (evt) { - _this2.onClick(evt); - }); - this.popUpFltSpans[i] = popUpSpan; - this.popUpFltImgs[i] = popUpSpan.firstChild; - } - - // subscribe to events - this.emitter.on('before-filtering', function () { - return _this2.buildIcons(); - }); - this.emitter.on('after-filtering', function () { - return _this2.closeAll(); - }); - - this.initialized = true; - } - - /** - * Reset previously destroyed feature - */ - - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - this.buildAll(); - } - - /** - * Build all pop-up filters elements - */ - - }, { - key: 'buildAll', - value: function buildAll() { - for (var i = 0; i < this.popUpFltElmCache.length; i++) { - this.build(i, this.popUpFltElmCache[i]); - } - } - - /** - * Build a specified pop-up filter elements - * @param {Number} colIndex Column index - * @param {Object} div Optional container DOM element - */ - - }, { - key: 'build', - value: function build(colIndex, div) { - var tf = this.tf; - var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; - popUpDiv.className = this.popUpDivCssClass; - tf.externalFltTgtIds.push(popUpDiv.id); - var header = tf.getHeaderElement(colIndex); - header.insertBefore(popUpDiv, header.firstChild); - _event2.default.add(popUpDiv, 'click', function (evt) { - _event2.default.stop(evt); - }); - this.popUpFltElms[colIndex] = popUpDiv; - } - - /** - * Toogle visibility of specified filter - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggle', - value: function toggle(colIndex) { - var tf = this.tf, - popUpFltElm = this.popUpFltElms[colIndex]; - - if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { - if (this.onBeforePopUpOpen) { - this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'block'; - if (tf.getFilterType(colIndex) === tf.fltTypeInp) { - var flt = tf.getFilterElement(colIndex); - if (flt) { - flt.focus(); - } - } - if (this.onAfterPopUpOpen) { - this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } else { - if (this.onBeforePopUpClose) { - this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'none'; - if (this.onAfterPopUpClose) { - this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } - } - - /** - * Close all filters excepted for the specified one if any - * @param {Number} exceptIdx Column index of the filter to not close - */ - - }, { - key: 'closeAll', - value: function closeAll(exceptIdx) { - for (var i = 0; i < this.popUpFltElms.length; i++) { - if (i === exceptIdx) { - continue; - } - var popUpFltElm = this.popUpFltElms[i]; - if (popUpFltElm) { - popUpFltElm.style.display = 'none'; - } - } - } - - /** - * Build all the icons representing the pop-up filters - */ - - }, { - key: 'buildIcons', - value: function buildIcons() { - for (var i = 0; i < this.popUpFltImgs.length; i++) { - this.buildIcon(i, false); - } - } - - /** - * Build specified icon - * @param {Number} colIndex Column index - * @param {Boolean} active Apply active state - */ - - }, { - key: 'buildIcon', - value: function buildIcon(colIndex, active) { - if (this.popUpFltImgs[colIndex]) { - this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; - } - } - - /** - * Remove pop-up filters - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - this.popUpFltElmCache = []; - for (var i = 0; i < this.popUpFltElms.length; i++) { - var popUpFltElm = this.popUpFltElms[i], - popUpFltSpan = this.popUpFltSpans[i], - popUpFltImg = this.popUpFltImgs[i]; - if (popUpFltElm) { - _dom2.default.remove(popUpFltElm); - this.popUpFltElmCache[i] = popUpFltElm; - } - popUpFltElm = null; - if (popUpFltSpan) { - _dom2.default.remove(popUpFltSpan); - } - popUpFltSpan = null; - if (popUpFltImg) { - _dom2.default.remove(popUpFltImg); - } - popUpFltImg = null; - } - this.popUpFltElms = []; - this.popUpFltSpans = []; - this.popUpFltImgs = []; - - // unsubscribe to events - this.emitter.off('before-filtering', function () { - return _this3.buildIcons(); - }); - this.emitter.off('after-filtering', function () { - return _this3.closeAll(); - }); - - this.initialized = false; - } - }]); - - return PopupFilter; - })(_feature.Feature); - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Dropdown = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Dropdown = exports.Dropdown = (function () { - - /** - * Dropdown UI component - * @param {Object} tf TableFilter instance - */ - - function Dropdown(tf) { - _classCallCheck(this, Dropdown); - - // Configuration object - var f = tf.config(); - - this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; - //defines empty option text - this.nonEmptyText = f.non_empty_text || '(Non empty)'; - //sets select filling method: 'innerHTML' or 'createElement' - this.slcFillingMethod = f.slc_filling_method || 'createElement'; - //IE only, tooltip text appearing on select before it is populated - this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; - //tooltip text appearing on multiple select - this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; - - this.isCustom = null; - this.opts = null; - this.optsTxt = null; - this.slcInnerHtml = null; - - this.tf = tf; - } - - /** - * Build drop-down filter UI asynchronously - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Boolean} isExternal Render in external container - * @param {String} extSlcId External container id - */ - - _createClass(Dropdown, [{ - key: 'build', - value: function build(colIndex, isLinked, isExternal, extSlcId) { - var tf = this.tf; - tf.EvtManager(tf.Evt.name.dropdown, { - slcIndex: colIndex, - slcRefreshed: isLinked, - slcExternal: isExternal, - slcId: extSlcId - }); - } - - /** - * Build drop-down filter UI - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Boolean} isExternal Render in external container - * @param {String} extSlcId External container id - */ - - }, { - key: '_build', - value: function _build(colIndex) { - var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.opts = []; - this.optsTxt = []; - this.slcInnerHtml = ''; - - var slcId = tf.fltIds[colIndex]; - if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { - return; - } - var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), - rows = tf.tbl.rows, - matchCase = tf.matchCase; - - //custom select test - this.isCustom = tf.isCustomOptions(colIndex); - - //custom selects text - var activeFlt; - if (isLinked && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - /*** remember grid values ***/ - var fltsValues = [], - fltArr = []; - if (tf.rememberGridValues) { - fltsValues = tf.feature('store').getFilterValues(tf.fltsValuesCookie); - if (fltsValues && !_string2.default.isEmpty(fltsValues.toString())) { - if (this.isCustom) { - fltArr.push(fltsValues[colIndex]); - } else { - fltArr = fltsValues[colIndex].split(' ' + tf.orOperator + ' '); - } - } - } - - var excludedOpts = null, - filteredDataCol = null; - if (isLinked && tf.disableExcludedOptions) { - excludedOpts = []; - filteredDataCol = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cell = rows[k].cells, - nchilds = cell.length; - - // checks if row has exact cell # - if (nchilds !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - // WTF: cyclomatic complexity hell - if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cell[j]), - - //Vary Peter's patch - cell_string = _string2.default.matchCase(cell_data, matchCase); - - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, matchCase)) { - this.opts.push(cell_data); - } - - if (isLinked && tf.disableExcludedOptions) { - var filteredCol = filteredDataCol[j]; - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { - excludedOpts.push(cell_data); - } - } - } //if colIndex==j - } //for j - } //for k - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (excludedOpts) { - excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - } - } - - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (excludedOpts) { - excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (excludedOpts) { - excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - //populates drop-down - this.addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr); - } - - /** - * Add drop-down options - * @param {Number} colIndex Column index - * @param {Object} slc Select Dom element - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Array} excludedOpts Array of excluded options - * @param {Array} fltsValues Collection of persisted filter values - * @param {Array} fltArr Collection of persisted filter values - */ - - }, { - key: 'addOptions', - value: function addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod), - slcValue = slc.value; - - slc.innerHTML = ''; - slc = this.addFirstOption(slc); - - for (var y = 0; y < this.opts.length; y++) { - if (this.opts[y] === '') { - continue; - } - var val = this.opts[y]; //option value - var lbl = this.isCustom ? this.optsTxt[y] : val; //option text - var isDisabled = false; - if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - isDisabled = true; - } - - if (fillMethod === 'innerhtml') { - var slcAttr = ''; - if (tf.loadFltOnDemand && slcValue === this.opts[y]) { - slcAttr = 'selected="selected"'; - } - this.slcInnerHtml += ''; - } else { - var opt; - //fill select on demand - if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { - opt = _dom2.default.createOpt(lbl, val, true); - } else { - if (tf.getFilterType(colIndex) !== tf.fltTypeMulti) { - opt = _dom2.default.createOpt(lbl, val, fltsValues[colIndex] !== ' ' && val === fltsValues[colIndex] ? true : false); - } else { - opt = _dom2.default.createOpt(lbl, val, _array2.default.has(fltArr, _string2.default.matchCase(this.opts[y], tf.matchCase), tf.matchCase) || fltArr.toString().indexOf(val) !== -1 ? true : false); - } - } - if (isDisabled) { - opt.disabled = true; - } - slc.appendChild(opt); - } - } // for y - - if (fillMethod === 'innerhtml') { - slc.innerHTML += this.slcInnerHtml; - } - slc.setAttribute('filled', '1'); - } - - /** - * Add drop-down header option - * @param {Object} slc Select DOM element - */ - - }, { - key: 'addFirstOption', - value: function addFirstOption(slc) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod); - - if (fillMethod === 'innerhtml') { - this.slcInnerHtml += ''; - } else { - var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); - if (!this.enableSlcResetFilter) { - opt0.style.display = 'none'; - } - slc.appendChild(opt0); - if (tf.enableEmptyOption) { - var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); - slc.appendChild(opt1); - } - if (tf.enableNonEmptyOption) { - var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); - slc.appendChild(opt2); - } - } - return slc; - } - }]); - - return Dropdown; - })(); - -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - ignoreCase: function ignoreCase(a, b) { - var x = _string2.default.lower(a); - var y = _string2.default.lower(b); - return x < y ? -1 : x > y ? 1 : 0; - } - }; - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.CheckList = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var CheckList = exports.CheckList = (function () { - - /** - * Checklist UI component - * @param {Object} tf TableFilter instance - */ - - function CheckList(tf) { - _classCallCheck(this, CheckList); - - // Configuration object - var f = tf.config(); - - this.checkListDiv = []; //checklist container div - //defines css class for div containing checklist filter - this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; - //defines css class for checklist filters - this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; - //defines css class for checklist item (li) - this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; - //defines css class for selected checklist item (li) - this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; - //Load on demand text - this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; - //defines css class for checklist filters - this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; - this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; - //checklist filter container div - this.prfxCheckListDiv = 'chkdiv_'; - - this.isCustom = null; - this.opts = null; - this.optsTxt = null; - this.excludedOpts = null; - - this.tf = tf; - } - - // TODO: move event here - - _createClass(CheckList, [{ - key: 'onChange', - value: function onChange(evt) { - var elm = evt.target; - this.tf.activeFilterId = elm.getAttribute('id'); - this.tf.activeFlt = _dom2.default.id(this.tf.activeFilterId); - this.tf.Evt.onSlcChange.call(this.tf, evt); - } - }, { - key: 'optionClick', - value: function optionClick(evt) { - this.setCheckListValues(evt.target); - this.onChange(evt); - } - - /** - * Build checklist UI asynchronously - * @param {Number} colIndex Column index - * @param {Boolean} isExternal Render in external container - * @param {String} extFltId External container id - */ - - }, { - key: 'build', - value: function build(colIndex, isExternal, extFltId) { - var tf = this.tf; - tf.EvtManager(tf.Evt.name.checklist, { slcIndex: colIndex, slcExternal: isExternal, slcId: extFltId }); - } - - /** - * Build checklist UI - * @param {Number} colIndex Column index - * @param {Boolean} isExternal Render in external container - * @param {String} extFltId External container id - */ - - }, { - key: '_build', - value: function _build(colIndex) { - var _this = this; - - var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.opts = []; - this.optsTxt = []; - - var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; - if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { - return; - } - - var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); - var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); - ul.className = this.checkListCssClass; - _event2.default.add(ul, 'change', function (evt) { - _this.onChange(evt); - }); - - var rows = tf.tbl.rows; - this.isCustom = tf.isCustomOptions(colIndex); - - var activeFlt; - if (tf.linkedFilters && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - var filteredDataCol = []; - if (tf.linkedFilters && tf.disableExcludedOptions) { - this.excludedOpts = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cells = rows[k].cells; - var ncells = cells.length; - - // checks if row has exact cell # - if (ncells !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < ncells; j++) { - // WTF: cyclomatic complexity hell :) - if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cells[j]); - //Vary Peter's patch - var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { - this.opts.push(cell_data); - } - var filteredCol = filteredDataCol[j]; - if (tf.linkedFilters && tf.disableExcludedOptions) { - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { - this.excludedOpts.push(cell_data); - } - } - } - } - } - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!tf.matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (this.excludedOpts) { - this.excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - } - } - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - this.addChecks(colIndex, ul, tf.separator); - - if (tf.loadFltOnDemand) { - flt.innerHTML = ''; - } - flt.appendChild(ul); - flt.setAttribute('filled', '1'); - } - - /** - * Add checklist options - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addChecks', - value: function addChecks(colIndex, ul) { - var _this2 = this; - - var tf = this.tf; - var chkCt = this.addTChecks(colIndex, ul); - var fltArr = []; //remember grid values - var store = tf.feature('store'); - var tmpVal = store ? store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null; - if (tmpVal && _string2.default.trim(tmpVal).length > 0) { - if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1) { - fltArr.push(tmpVal); - } else { - fltArr = tmpVal.split(' ' + tf.orOperator + ' '); - } - } - - for (var y = 0; y < this.opts.length; y++) { - var val = this.opts[y]; //item value - var lbl = this.isCustom ? this.optsTxt[y] : val; //item text - var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); - li.className = this.checkListItemCssClass; - if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - _dom2.default.addClass(li, this.checkListItemDisabledCssClass); - li.check.disabled = true; - li.disabled = true; - } else { - _event2.default.add(li.check, 'click', function (evt) { - _this2.optionClick(evt); - }); - } - ul.appendChild(li); - - if (val === '') { - //item is hidden - li.style.display = 'none'; - } - - /*** remember grid values ***/ - if (tf.rememberGridValues) { - if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1 && fltArr.toString().indexOf(val) != -1 || _array2.default.has(fltArr, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - li.check.checked = true; - this.setCheckListValues(li.check); - } - } - } - } - - /** - * Add checklist header option - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addTChecks', - value: function addTChecks(colIndex, ul) { - var _this3 = this; - - var tf = this.tf; - var chkCt = 1; - var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); - li0.className = this.checkListItemCssClass; - ul.appendChild(li0); - - _event2.default.add(li0.check, 'click', function (evt) { - _this3.optionClick(evt); - }); - - if (!this.enableCheckListResetFilter) { - li0.style.display = 'none'; - } - - if (tf.enableEmptyOption) { - var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); - li1.className = this.checkListItemCssClass; - ul.appendChild(li1); - _event2.default.add(li1.check, 'click', function (evt) { - _this3.optionClick(evt); - }); - chkCt++; - } - - if (tf.enableNonEmptyOption) { - var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); - li2.className = this.checkListItemCssClass; - ul.appendChild(li2); - _event2.default.add(li2.check, 'click', function (evt) { - _this3.optionClick(evt); - }); - chkCt++; - } - return chkCt; - } - - /** - * Store checked options in DOM element attribute - * @param {Object} o checklist option DOM element - */ - - }, { - key: 'setCheckListValues', - value: function setCheckListValues(o) { - if (!o) { - return; - } - var tf = this.tf; - var chkValue = o.value; //checked item value - var chkIndex = parseInt(o.id.split('_')[2], 10); - var filterTag = 'ul', - itemTag = 'li'; - var n = o; - - //ul tag search - while (_string2.default.lower(n.nodeName) !== filterTag) { - n = n.parentNode; - } - - var li = n.childNodes[chkIndex]; - var colIndex = n.getAttribute('colIndex'); - var fltValue = n.getAttribute('value'); //filter value (ul tag) - var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) - - if (o.checked) { - //show all item - if (chkValue === '') { - if (fltIndexes && fltIndexes !== '') { - //items indexes - var indSplit = fltIndexes.split(tf.separator); - //checked items loop - for (var u = 0; u < indSplit.length; u++) { - //checked item - var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); - if (cChk) { - cChk.checked = false; - _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); - } - } - } - n.setAttribute('value', ''); - n.setAttribute('indexes', ''); - } else { - fltValue = fltValue ? fltValue : ''; - chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); - chkIndex = fltIndexes + chkIndex + tf.separator; - n.setAttribute('value', chkValue); - n.setAttribute('indexes', chkIndex); - //1st option unchecked - if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { - _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; - } - } - - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); - _dom2.default.addClass(li, this.checkListSlcItemCssClass); - } - } else { - //removes values and indexes - if (chkValue !== '') { - var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); - fltValue = fltValue.replace(replaceValue, ''); - n.setAttribute('value', _string2.default.trim(fltValue)); - - var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); - fltIndexes = fltIndexes.replace(replaceIndex, ''); - n.setAttribute('indexes', fltIndexes); - } - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(li, this.checkListSlcItemCssClass); - } - } - } - }]); - - return CheckList; - })(); - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.RowsCounter = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var RowsCounter = exports.RowsCounter = (function (_Feature) { - _inherits(RowsCounter, _Feature); - - /** - * Rows counter - * @param {Object} tf TableFilter instance - */ - - function RowsCounter(tf) { - _classCallCheck(this, RowsCounter); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); - - var f = _this.config; - - //id of custom container element - _this.rowsCounterTgtId = f.rows_counter_target_id || null; - //element containing tot nb rows - _this.rowsCounterDiv = null; - //element containing tot nb rows label - _this.rowsCounterSpan = null; - //defines rows counter text - _this.rowsCounterText = f.rows_counter_text || 'Rows: '; - _this.fromToTextSeparator = f.from_to_text_separator || '-'; - _this.overText = f.over_text || ' / '; - //defines css class rows counter - _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; - //rows counter div - _this.prfxCounter = 'counter_'; - //nb displayed rows label - _this.prfxTotRows = 'totrows_span_'; - //label preceding nb rows label - _this.prfxTotRowsTxt = 'totRowsTextSpan_'; - //callback raised before counter is refreshed - _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; - //callback raised after counter is refreshed - _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; - return _this; - } - - _createClass(RowsCounter, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - //rows counter container - var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); - countDiv.className = this.totRowsCssClass; - //rows counter label - var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); - var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); - countText.appendChild(_dom2.default.text(this.rowsCounterText)); - - // counter is added to defined element - if (!this.rowsCounterTgtId) { - tf.setToolbar(); - } - var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); - - //default container: 'lDiv' - if (!this.rowsCounterTgtId) { - countDiv.appendChild(countText); - countDiv.appendChild(countSpan); - targetEl.appendChild(countDiv); - } else { - //custom container, no need to append statusDiv - targetEl.appendChild(countText); - targetEl.appendChild(countSpan); - } - this.rowsCounterDiv = countDiv; - this.rowsCounterSpan = countSpan; - - // subscribe to after-filtering event - this.emitter.on('after-filtering', function () { - return _this2.refresh(tf.nbVisibleRows); - }); - // subscribe to grouped-by-page event - this.emitter.on('grouped-by-page', function () { - return _this2.refresh(tf.nbVisibleRows); - }); - // subscribe to rows-changed event - this.emitter.on('rows-changed', function () { - return _this2.refresh(); - }); - - this.initialized = true; - this.refresh(); - } - }, { - key: 'refresh', - value: function refresh(p) { - if (!this.initialized || !this.isEnabled()) { - return; - } - - var tf = this.tf; - - if (this.onBeforeRefreshCounter) { - this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); - } - - var totTxt; - if (!tf.paging) { - if (p && p !== '') { - totTxt = p; - } else { - totTxt = tf.nbFilterableRows - tf.nbHiddenRows; - } - } else { - var paging = tf.feature('paging'); - if (paging) { - //paging start row - var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); - var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; - totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; - } - } - - this.rowsCounterSpan.innerHTML = totTxt; - if (this.onAfterRefreshCounter) { - this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - if (!this.rowsCounterTgtId && this.rowsCounterDiv) { - _dom2.default.remove(this.rowsCounterDiv); - } else { - _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; - } - this.rowsCounterSpan = null; - this.rowsCounterDiv = null; - - // unsubscribe to events - this.emitter.off('after-filtering', function () { - return _this3.refresh(tf.nbVisibleRows); - }); - this.emitter.off('grouped-by-page', function () { - return _this3.refresh(tf.nbVisibleRows); - }); - this.emitter.off('rows-changed', function () { - return _this3.refresh(); - }); - - this.initialized = false; - } - }]); - - return RowsCounter; - })(_feature.Feature); - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.StatusBar = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var StatusBar = exports.StatusBar = (function (_Feature) { - _inherits(StatusBar, _Feature); - - /** - * Status bar UI component - * @param {Object} tf TableFilter instance - */ - - function StatusBar(tf) { - _classCallCheck(this, StatusBar); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); - - var f = _this.config; - - //id of custom container element - _this.statusBarTgtId = f.status_bar_target_id || null; - //element containing status bar label - _this.statusBarDiv = null; - //status bar - _this.statusBarSpan = null; - //status bar label - _this.statusBarSpanText = null; - //defines status bar text - _this.statusBarText = f.status_bar_text || ''; - //defines css class status bar - _this.statusBarCssClass = f.status_bar_css_class || 'status'; - //delay for status bar clearing - _this.statusBarCloseDelay = 250; - - //calls function before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //calls function after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - - // status bar div - _this.prfxStatus = 'status_'; - // status bar label - _this.prfxStatusSpan = 'statusSpan_'; - // text preceding status bar label - _this.prfxStatusTxt = 'statusText_'; - return _this; - } - - _createClass(StatusBar, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - var tf = this.tf; - - //status bar container - var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); - statusDiv.className = this.statusBarCssClass; - - //status bar label - var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); - //preceding text - var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); - statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); - - // target element container - if (!this.statusBarTgtId) { - tf.setToolbar(); - } - var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); - - //default container: 'lDiv' - if (!this.statusBarTgtId) { - statusDiv.appendChild(statusSpanText); - statusDiv.appendChild(statusSpan); - targetEl.appendChild(statusDiv); - } else { - // custom container, no need to append statusDiv - targetEl.appendChild(statusSpanText); - targetEl.appendChild(statusSpan); - } - - this.statusBarDiv = statusDiv; - this.statusBarSpan = statusSpan; - this.statusBarSpanText = statusSpanText; - - this.initialized = true; - } - }, { - key: 'message', - value: function message() { - var _this2 = this; - - var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; - - if (!this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, t); - } - - var d = t === '' ? this.statusBarCloseDelay : 1; - global.setTimeout(function () { - _this2.statusBarSpan.innerHTML = t; - if (_this2.onAfterShowMsg) { - _this2.onAfterShowMsg.call(null, _this2.tf, t); - } - }, d); - } - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - - this.statusBarDiv.innerHTML = ''; - _dom2.default.remove(this.statusBarDiv); - this.statusBarSpan = null; - this.statusBarSpanText = null; - this.statusBarDiv = null; - this.initialized = false; - } - }]); - - return StatusBar; - })(_feature.Feature); - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Paging = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Paging = exports.Paging = (function (_Feature) { - _inherits(Paging, _Feature); - - /** - * Pagination component - * @param {Object} tf TableFilter instance - */ - - function Paging(tf) { - _classCallCheck(this, Paging); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); - - var f = _this.config; - - //css class for paging buttons (previous,next,etc.) - _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; - //stores paging select element - _this.pagingSlc = null; - //results per page select element - _this.resultsPerPageSlc = null; - //id of container element - _this.pagingTgtId = f.paging_target_id || null; - //defines table paging length - _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; - //id of container element - _this.resultsPerPageTgtId = f.results_per_page_target_id || null; - //css class for paging select element - _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; - //css class for paging input element - _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; - //stores results per page text and values - _this.resultsPerPage = f.results_per_page || null; - //enables/disables results per page drop-down - _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); - //defines css class for results per page select - _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; - //css class for label preceding results per page select - _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; - //1st row index of current page - _this.startPagingRow = 0; - //total nb of pages - _this.nbPages = 0; - //current page nb - _this.currentPageNb = 1; - //defines next page button text - _this.btnNextPageText = f.btn_next_page_text || '>'; - //defines previous page button text - _this.btnPrevPageText = f.btn_prev_page_text || '<'; - //defines last page button text - _this.btnLastPageText = f.btn_last_page_text || '>|'; - //defines first page button text - _this.btnFirstPageText = f.btn_first_page_text || '|<'; - //defines next page button html - _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); - //defines last page button html - _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); - //defines text preceeding page selector drop-down - _this.pageText = f.page_text || ' Page '; - //defines text after page selector drop-down - _this.ofText = f.of_text || ' of '; - //css class for span containing tot nb of pages - _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; - //enables/disables paging buttons - _this.hasPagingBtns = f.paging_btns === false ? false : true; - //defines previous page button html - _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; - //calls function before page is changed - _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; - //calls function before page is changed - _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; - - //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_'; - - var start_row = _this.refRow; - var nrows = _this.nbRows; - //calculates page nb - _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); - - //Paging elements events - var o = _this; - // Paging DOM events - _this.evt = { - slcIndex: function slcIndex() { - return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; - }, - nbOpts: function nbOpts() { - return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; - }, - next: function next() { - var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; - o.changePage(nextIndex); - }, - prev: function prev() { - var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); - o.changePage(prevIndex); - }, - last: function last() { - o.changePage(o.evt.nbOpts()); - }, - first: function first() { - o.changePage(0); - }, - _detectKey: function _detectKey(e) { - var key = _event2.default.keyCode(e); - if (key === 13) { - if (tf.sorted) { - tf.filter(); - o.changePage(o.evt.slcIndex()); - } else { - o.changePage(); - } - this.blur(); - } - }, - - slcPagesChange: null, - nextEvt: null, - prevEvt: null, - lastEvt: null, - firstEvt: null - }; - return _this; - } - - /** - * Initialize DOM elements - */ - - _createClass(Paging, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var slcPages; - var tf = this.tf; - var evt = this.evt; - - if (this.initialized) { - return; - } - - // Check resultsPerPage is in expected format and initialise the - // results per page component - if (this.hasResultsPerPage) { - if (this.resultsPerPage.length < 2) { - this.hasResultsPerPage = false; - } else { - this.pagingLength = this.resultsPerPage[1][0]; - this.setResultsPerPage(); - } - } - - evt.slcPagesChange = function (event) { - var slc = event.target; - _this2.changePage(slc.selectedIndex); - }; - - // Paging drop-down list selector - if (this.pageSelectorType === tf.fltTypeSlc) { - slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); - slcPages.className = this.pgSlcCssClass; - _event2.default.add(slcPages, 'change', evt.slcPagesChange); - } - - // Paging input selector - if (this.pageSelectorType === tf.fltTypeInp) { - slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); - slcPages.className = this.pgInpCssClass; - _event2.default.add(slcPages, 'keypress', evt._detectKey); - } - - // btns containers - var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); - var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); - var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); - var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); - - if (this.hasPagingBtns) { - // Next button - if (!this.btnNextPageHtml) { - var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); - btn_next.className = this.btnPageCssClass; - _event2.default.add(btn_next, 'click', evt.next); - btnNextSpan.appendChild(btn_next); - } else { - btnNextSpan.innerHTML = this.btnNextPageHtml; - _event2.default.add(btnNextSpan, 'click', evt.next); - } - // Previous button - if (!this.btnPrevPageHtml) { - var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); - btn_prev.className = this.btnPageCssClass; - _event2.default.add(btn_prev, 'click', evt.prev); - btnPrevSpan.appendChild(btn_prev); - } else { - btnPrevSpan.innerHTML = this.btnPrevPageHtml; - _event2.default.add(btnPrevSpan, 'click', evt.prev); - } - // Last button - if (!this.btnLastPageHtml) { - var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); - btn_last.className = this.btnPageCssClass; - _event2.default.add(btn_last, 'click', evt.last); - btnLastSpan.appendChild(btn_last); - } else { - btnLastSpan.innerHTML = this.btnLastPageHtml; - _event2.default.add(btnLastSpan, 'click', evt.last); - } - // First button - if (!this.btnFirstPageHtml) { - var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); - btn_first.className = this.btnPageCssClass; - _event2.default.add(btn_first, 'click', evt.first); - btnFirstSpan.appendChild(btn_first); - } else { - btnFirstSpan.innerHTML = this.btnFirstPageHtml; - _event2.default.add(btnFirstSpan, 'click', evt.first); - } - } - - // paging elements (buttons+drop-down list) are added to defined element - if (!this.pagingTgtId) { - tf.setToolbar(); - } - var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - targetEl.appendChild(btnFirstSpan); - targetEl.appendChild(btnPrevSpan); - - var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); - pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); - pgBeforeSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgBeforeSpan); - targetEl.appendChild(slcPages); - var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); - pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); - pgAfterSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgAfterSpan); - var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); - pgspan.className = this.nbPgSpanCssClass; - pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); - targetEl.appendChild(pgspan); - targetEl.appendChild(btnNextSpan); - targetEl.appendChild(btnLastSpan); - this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); - - if (!tf.rememberGridValues) { - this.setPagingInfo(); - } - if (!tf.fltGrid) { - tf.validateAllRows(); - this.setPagingInfo(tf.validRowsIndex); - } - - this.emitter.on('after-filtering', function () { - return _this2.resetPagingInfo(); - }); - - this.initialized = true; - } - - /** - * Reset paging when filters are already instantiated - * @param {Boolean} filterTable Execute filtering once paging instanciated - */ - - }, { - key: 'reset', - value: function reset() { - var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var tf = this.tf; - if (!tf.hasGrid() || this.isEnabled()) { - return; - } - this.enable(); - this.init(); - tf.resetValues(); - if (filterTable) { - tf.filter(); - } - } - - /** - * Reset paging info from scratch after a filtering process - */ - - }, { - key: 'resetPagingInfo', - value: function resetPagingInfo() { - this.startPagingRow = 0; - this.currentPageNb = 1; - this.setPagingInfo(this.tf.validRowsIndex); - } - - /** - * Calculate number of pages based on valid rows - * Refresh paging select according to number of pages - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'setPagingInfo', - value: function setPagingInfo() { - var validRows = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0]; - - var tf = this.tf; - var rows = tf.tbl.rows; - var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - //store valid rows indexes - tf.validRowsIndex = validRows; - - if (validRows.length === 0) { - //counts rows to be grouped - for (var j = tf.refRow; j < tf.nbRows; j++) { - var row = rows[j]; - if (!row) { - continue; - } - - var isRowValid = row.getAttribute('validRow'); - if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { - tf.validRowsIndex.push(j); - } - } - } - - //calculate nb of pages - this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); - //refresh page nb span - pgspan.innerHTML = this.nbPages; - //select clearing shortcut - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.innerHTML = ''; - } - - if (this.nbPages > 0) { - mdiv.style.visibility = 'visible'; - if (this.pageSelectorType === tf.fltTypeSlc) { - for (var z = 0; z < this.nbPages; z++) { - var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); - this.pagingSlc.options[z] = opt; - } - } else { - //input type - this.pagingSlc.value = this.currentPageNb; - } - } else { - /*** if no results paging select and buttons are hidden ***/ - mdiv.style.visibility = 'hidden'; - } - this.groupByPage(tf.validRowsIndex); - } - - /** - * Group table rows by page and display valid rows - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'groupByPage', - value: function groupByPage(validRows) { - var tf = this.tf; - var alternateRows = tf.feature('alternateRows'); - var rows = tf.tbl.rows; - var startPagingRow = parseInt(this.startPagingRow, 10); - var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); - - //store valid rows indexes - if (validRows) { - tf.validRowsIndex = validRows; - } - - //this loop shows valid rows of current page - for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { - var validRowIdx = tf.validRowsIndex[h]; - var r = rows[validRowIdx]; - var isRowValid = r.getAttribute('validRow'); - - if (h >= startPagingRow && h < endPagingRow) { - if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { - r.style.display = ''; - } - if (tf.alternateRows && alternateRows) { - alternateRows.setRowBg(validRowIdx, h); - } - } else { - r.style.display = 'none'; - if (tf.alternateRows && alternateRows) { - alternateRows.removeRowBg(validRowIdx); - } - } - } - - tf.nbVisibleRows = tf.validRowsIndex.length; - - // broadcast grouping by page - this.emitter.emit('grouped-by-page', tf, this); - } - - /** - * Return the current page number - * @return {Number} Page number - */ - - }, { - key: 'getPage', - value: function getPage() { - return this.currentPageNb; - } - - /** - * Show page based on passed param value (string or number): - * @param {String} or {Number} cmd possible string values: 'next', - * 'previous', 'last', 'first' or page number as per param - */ - - }, { - key: 'setPage', - value: function setPage(cmd) { - var tf = this.tf; - if (!tf.hasGrid() || !this.isEnabled()) { - return; - } - var btnEvt = this.evt, - cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); - if (cmdtype === 'string') { - switch (_string2.default.lower(cmd)) { - case 'next': - btnEvt.next(); - break; - case 'previous': - btnEvt.prev(); - break; - case 'last': - btnEvt.last(); - break; - case 'first': - btnEvt.first(); - break; - default: - btnEvt.next(); - break; - } - } else if (cmdtype === 'number') { - this.changePage(cmd - 1); - } - } - - /** - * Generates UI elements for the number of results per page drop-down - */ - - }, { - key: 'setResultsPerPage', - value: function setResultsPerPage() { - var _this3 = this; - - var tf = this.tf; - var evt = this.evt; - - if (!tf.hasGrid() && !tf.isFirstLoad) { - return; - } - if (this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - - evt.slcResultsChange = function (ev) { - _this3.changeResultsPerPage(); - ev.target.blur(); - }; - - var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); - slcR.className = this.resultsSlcCssClass; - var slcRText = this.resultsPerPage[0], - slcROpts = this.resultsPerPage[1]; - var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); - slcRSpan.className = this.resultsSpanCssClass; - - // results per page select is added to external element - if (!this.resultsPerPageTgtId) { - tf.setToolbar(); - } - var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); - slcRSpan.appendChild(_dom2.default.text(slcRText)); - - var help = tf.feature('help'); - if (help && help.btn) { - help.btn.parentNode.insertBefore(slcRSpan, help.btn); - help.btn.parentNode.insertBefore(slcR, help.btn); - } else { - targetEl.appendChild(slcRSpan); - targetEl.appendChild(slcR); - } - - for (var r = 0; r < slcROpts.length; r++) { - var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); - slcR.options[r] = currOpt; - } - _event2.default.add(slcR, 'change', evt.slcResultsChange); - this.resultsPerPageSlc = slcR; - } - - /** - * Remove number of results per page UI elements - */ - - }, { - key: 'removeResultsPerPage', - value: function removeResultsPerPage() { - var tf = this.tf; - if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - var slcR = this.resultsPerPageSlc, - slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); - if (slcR) { - _dom2.default.remove(slcR); - } - if (slcRSpan) { - _dom2.default.remove(slcRSpan); - } - this.resultsPerPageSlc = null; - } - - /** - * Change the page asynchronously according to passed index - * @param {Number} index Index of the page (0-n) - */ - - }, { - key: 'changePage', - value: function changePage(index) { - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.changepage, { pgIndex: index }); - } - - /** - * Change rows asynchronously according to page results - */ - - }, { - key: 'changeResultsPerPage', - value: function changeResultsPerPage() { - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.changeresultsperpage); - } - - /** - * Re-set asynchronously page nb at page re-load - */ - - }, { - key: 'resetPage', - value: function resetPage() { - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.resetpage); - } - - /** - * Re-set asynchronously page length at page re-load - */ - - }, { - key: 'resetPageLength', - value: function resetPageLength() { - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.resetpagelength); - } - - /** - * Change the page according to passed index - * @param {Number} index Index of the page (0-n) - */ - - }, { - key: '_changePage', - value: function _changePage(index) { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - if (index === null) { - index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; - } - if (index >= 0 && index <= this.nbPages - 1) { - if (this.onBeforeChangePage) { - this.onBeforeChangePage.call(null, this, index); - } - this.currentPageNb = parseInt(index, 10) + 1; - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.options[index].selected = true; - } else { - this.pagingSlc.value = this.currentPageNb; - } - - if (tf.rememberPageNb) { - tf.feature('store').savePageNb(tf.pgNbCookie); - } - this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; - - this.groupByPage(); - - if (this.onAfterChangePage) { - this.onAfterChangePage.call(null, this, index); - } - } - } - - /** - * Change rows according to page results drop-down - * TODO: accept a parameter setting the results per page length - */ - - }, { - key: '_changeResultsPerPage', - value: function _changeResultsPerPage() { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - var slcR = this.resultsPerPageSlc; - var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); - this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); - this.startPagingRow = this.pagingLength * slcPagesSelIndex; - - if (!isNaN(this.pagingLength)) { - if (this.startPagingRow >= tf.nbFilterableRows) { - this.startPagingRow = tf.nbFilterableRows - this.pagingLength; - } - this.setPagingInfo(); - - if (this.pageSelectorType === tf.fltTypeSlc) { - var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; - this.pagingSlc.options[slcIndex].selected = true; - } - if (tf.rememberPageLen) { - tf.feature('store').savePageLength(tf.pgLenCookie); - } - } - } - - /** - * Re-set page nb at page re-load - */ - - }, { - key: '_resetPage', - value: function _resetPage(name) { - var tf = this.tf; - var pgnb = tf.feature('store').getPageNb(name); - if (pgnb !== '') { - this.changePage(pgnb - 1); - } - } - - /** - * Re-set page length value at page re-load - */ - - }, { - key: '_resetPageLength', - value: function _resetPageLength(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - var pglenIndex = tf.feature('store').getPageLength(name); - - if (pglenIndex !== '') { - this.resultsPerPageSlc.options[pglenIndex].selected = true; - this.changeResultsPerPage(); - } - } - - /** - * Remove paging feature - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - var tf = this.tf; - - if (!this.initialized) { - return; - } - // btns containers - var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); - var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); - var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); - var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); - //span containing 'Page' text - var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); - //span containing 'of' text - var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); - //span containing nb of pages - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - var evt = this.evt; - - if (this.pagingSlc) { - if (this.pageSelectorType === tf.fltTypeSlc) { - _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); - } else if (this.pageSelectorType === tf.fltTypeInp) { - _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); - } - _dom2.default.remove(this.pagingSlc); - } - - if (btnNextSpan) { - _event2.default.remove(btnNextSpan, 'click', evt.next); - _dom2.default.remove(btnNextSpan); - } - - if (btnPrevSpan) { - _event2.default.remove(btnPrevSpan, 'click', evt.prev); - _dom2.default.remove(btnPrevSpan); - } - - if (btnLastSpan) { - _event2.default.remove(btnLastSpan, 'click', evt.last); - _dom2.default.remove(btnLastSpan); - } - - if (btnFirstSpan) { - _event2.default.remove(btnFirstSpan, 'click', evt.first); - _dom2.default.remove(btnFirstSpan); - } - - if (pgBeforeSpan) { - _dom2.default.remove(pgBeforeSpan); - } - - if (pgAfterSpan) { - _dom2.default.remove(pgAfterSpan); - } - - if (pgspan) { - _dom2.default.remove(pgspan); - } - - if (this.hasResultsPerPage) { - this.removeResultsPerPage(); - } - - this.emitter.off('after-filtering', function () { - return _this4.resetPagingInfo(); - }); - - this.pagingSlc = null; - this.nbPages = 0; - this.disable(); - this.initialized = false; - } - }]); - - return Paging; - })(_feature.Feature); - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.ClearButton = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var ClearButton = exports.ClearButton = (function (_Feature) { - _inherits(ClearButton, _Feature); - - /** - * Clear button component - * @param {Object} tf TableFilter instance - */ - - function ClearButton(tf) { - _classCallCheck(this, ClearButton); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); - - var f = _this.config; - - //id of container element - _this.btnResetTgtId = f.btn_reset_target_id || null; - //reset button element - _this.btnResetEl = null; - //defines reset text - _this.btnResetText = f.btn_reset_text || 'Reset'; - //defines reset button tooltip - _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; - //defines reset button innerHtml - _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); - //span containing reset button - _this.prfxResetSpan = 'resetspan_'; - return _this; - } - - _createClass(ClearButton, [{ - key: 'onClick', - value: function onClick() { - if (!this.isEnabled()) { - return; - } - this.tf.clearFilters(); - } - - /** - * Build DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - - if (this.initialized) { - return; - } - - var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); - - // reset button is added to defined element - if (!this.btnResetTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); - targetEl.appendChild(resetspan); - - if (!this.btnResetHtml) { - var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); - fltreset.className = tf.btnResetCssClass; - fltreset.appendChild(_dom2.default.text(this.btnResetText)); - resetspan.appendChild(fltreset); - _event2.default.add(fltreset, 'click', function () { - _this2.onClick(); - }); - } else { - resetspan.innerHTML = this.btnResetHtml; - var resetEl = resetspan.firstChild; - _event2.default.add(resetEl, 'click', function () { - _this2.onClick(); - }); - } - this.btnResetEl = resetspan.firstChild; - - this.initialized = true; - } - - /** - * Remove clear button UI - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - - if (!this.initialized) { - return; - } - - var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); - if (resetspan) { - _dom2.default.remove(resetspan); - } - this.btnResetEl = null; - this.initialized = false; - } - }]); - - return ClearButton; - })(_feature.Feature); - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Help = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; - var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; - - var Help = exports.Help = (function (_Feature) { - _inherits(Help, _Feature); - - /** - * Help UI component - * @param {Object} tf TableFilter instance - */ - - function Help(tf) { - _classCallCheck(this, Help); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); - - var f = _this.config; - - //id of custom container element for instructions - _this.tgtId = f.help_instructions_target_id || null; - //id of custom container element for instructions - _this.contTgtId = f.help_instructions_container_target_id || null; - //defines help text - _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; - //defines help innerHtml - _this.instrHtml = f.help_instructions_html || null; - //defines reset button text - _this.btnText = f.help_instructions_btn_text || '?'; - //defines reset button innerHtml - _this.btnHtml = f.help_instructions_btn_html || null; - //defines css class for help button - _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; - //defines css class for help container - _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; - //help button element - _this.btn = null; - //help content div - _this.cont = null; - _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; - - //id prefix for help elements - _this.prfxHelpSpan = 'helpSpan_'; - //id prefix for help elements - _this.prfxHelpDiv = 'helpDiv_'; - return _this; - } - - _createClass(Help, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); - var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); - - //help button is added to defined element - if (!this.tgtId) { - tf.setToolbar(); - } - var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); - targetEl.appendChild(helpspan); - - var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); - - if (!this.btnHtml) { - divContainer.appendChild(helpdiv); - var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); - helplink.className = this.btnCssClass; - helplink.appendChild(_dom2.default.text(this.btnText)); - helpspan.appendChild(helplink); - _event2.default.add(helplink, 'click', function () { - _this2.toggle(); - }); - } else { - helpspan.innerHTML = this.btnHtml; - var helpEl = helpspan.firstChild; - _event2.default.add(helpEl, 'click', function () { - _this2.toggle(); - }); - divContainer.appendChild(helpdiv); - } - - if (!this.instrHtml) { - helpdiv.innerHTML = this.instrText; - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } else { - if (this.contTgtId) { - divContainer.appendChild(helpdiv); - } - helpdiv.innerHTML = this.instrHtml; - if (!this.contTgtId) { - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } - } - helpdiv.innerHTML += this.defaultHtml; - _event2.default.add(helpdiv, 'click', function () { - _this2.toggle(); - }); - - this.cont = helpdiv; - this.btn = helpspan; - this.initialized = true; - } - - /** - * Toggle help pop-up - */ - - }, { - key: 'toggle', - value: function toggle() { - // check only if explicitily set to false as in this case undefined - // signifies the help feature is enabled by default - if (this.enabled === false) { - return; - } - var divDisplay = this.cont.style.display; - if (divDisplay === '' || divDisplay === 'none') { - this.cont.style.display = 'inline'; - } else { - this.cont.style.display = 'none'; - } - } - - /** - * Remove help UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - _dom2.default.remove(this.btn); - this.btn = null; - if (!this.cont) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - this.initialized = false; - } - }]); - - return Help; - })(_feature.Feature); - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AlternateRows = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var AlternateRows = exports.AlternateRows = (function (_Feature) { - _inherits(AlternateRows, _Feature); - - /** - * Alternating rows color - * @param {Object} tf TableFilter instance - */ - - function AlternateRows(tf) { - _classCallCheck(this, AlternateRows); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); - - var config = _this.config; - //defines css class for even rows - _this.evenCss = config.even_row_css_class || 'even'; - //defines css class for odd rows - _this.oddCss = config.odd_row_css_class || 'odd'; - return _this; - } - - /** - * Sets alternating rows color - */ - - _createClass(AlternateRows, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var validRowsIndex = tf.validRowsIndex; - var noValidRowsIndex = validRowsIndex === null; - //1st index - var beginIndex = noValidRowsIndex ? tf.refRow : 0; - // nb indexes - var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; - var idx = 0; - - //alternates bg color - for (var j = beginIndex; j < indexLen; j++) { - var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; - this.setRowBg(rowIdx, idx); - idx++; - } - - this.emitter.on('row-processed', function (tf, rowIndex, isValid) { - return _this2.processRow(tf, rowIndex, isValid); - }); - - this.initialized = true; - } - }, { - key: 'processRow', - value: function processRow(tf, rowIdx, isValid) { - console.log(arguments); - if (isValid) { - this.setRowBg(rowIdx, tf.validRowsIndex.length); - } else { - this.removeRowBg(rowIdx); - } - } - - /** - * Sets row background color - * @param {Number} rowIdx Row index - * @param {Number} idx Valid rows collection index needed to calculate bg - * color - */ - - }, { - key: 'setRowBg', - value: function setRowBg(rowIdx, idx) { - if (!this.isEnabled() || isNaN(rowIdx)) { - return; - } - var rows = this.tf.tbl.rows; - var i = isNaN(idx) ? rowIdx : idx; - this.removeRowBg(rowIdx); - - _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); - } - - /** - * Removes row background color - * @param {Number} idx Row index - */ - - }, { - key: 'removeRowBg', - value: function removeRowBg(idx) { - if (isNaN(idx)) { - return; - } - var rows = this.tf.tbl.rows; - _dom2.default.removeClass(rows[idx], this.oddCss); - _dom2.default.removeClass(rows[idx], this.evenCss); - } - - /** - * Removes all alternating backgrounds - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { - this.removeRowBg(i); - } - - this.emitter.off('row-processed', function (tf, rowIndex, isValid) { - return _this3.processRow(tf, rowIndex, isValid); - }); - - this.initialized = false; - } - }]); - - return AlternateRows; - })(_feature.Feature); - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.NoResults = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var NoResults = exports.NoResults = (function (_Feature) { - _inherits(NoResults, _Feature); - - /** - * No results message UI component - * @param {Object} tf TableFilter instance - */ - - function NoResults(tf) { - _classCallCheck(this, NoResults); - - //configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); - - var f = _this.config.no_results_message; - - _this.content = f.content || 'No results'; - _this.customContainer = f.custom_container || null; - _this.customContainerId = f.custom_container_id || null; - _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); - _this.cssClass = f.css_class || 'no-results'; - - _this.cont = null; - - //callback before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //callback after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - //callback before message is hidden - _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; - //callback after message is hidden - _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; - - _this.prfxNoResults = 'nores_'; - return _this; - } - - _createClass(NoResults, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - var tf = this.tf; - var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; - - //container - var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); - cont.className = this.cssClass; - cont.innerHTML = this.content; - - if (this.isExternal) { - target.appendChild(cont); - } else { - target.parentNode.insertBefore(cont, target.nextSibling); - } - - this.cont = cont; - - // subscribe to after-filtering event - this.emitter.on('after-filtering', function () { - return _this2.toggle(); - }); - - this.initialized = true; - this.hide(); - } - }, { - key: 'toggle', - value: function toggle() { - if (this.tf.nbVisibleRows > 0) { - this.hide(); - } else { - this.show(); - } - } - }, { - key: 'show', - value: function show() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, this); - } - - this.setWidth(); - this.cont.style.display = 'block'; - - if (this.onAfterShowMsg) { - this.onAfterShowMsg.call(null, this.tf, this); - } - } - }, { - key: 'hide', - value: function hide() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - - this.cont.style.display = 'none'; - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - } - }, { - key: 'setWidth', - value: function setWidth() { - if (!this.initialized || this.isExternal || !this.isEnabled()) { - return; - } - if (this.tf.gridLayout) { - var gridLayout = this.tf.feature('gridLayout'); - this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; - } else { - this.cont.style.width = this.tf.tbl.clientWidth + 'px'; - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - // unsubscribe to after-filtering event - this.emitter.off('after-filtering', function () { - return _this3.toggle(); - }); - this.initialized = false; - } - }]); - - return NoResults; - })(_feature.Feature); - -/***/ } -/******/ ]) -}); -; -//# sourceMappingURL=tablefilter.js.map \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var a=s[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var n,r,o=0,h=[];on;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.1",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":a(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),a=s._ezEditTable;s.cfg.editable&&a.Editable.Remove(),s.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,a,l);break;case e.checklist:r.checkList._build(s,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,a=i.slcExternal,l=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,a=t.path,l=void 0;s&&a?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var a=[i(26)("./"+l)];(function(i){var a=new i["default"](e,t);a.init(),e.ExtRegistry[s]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],a=this.ExtRegistry[s.name];a&&(a.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var a=t[i],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],a=u["default"].id(s);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],a=[],l=i.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(a.sort(),s.sort()),[a,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(i)),""!==a&&s.highlightKeyword.highlight(i,a,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=a(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)s=l<=a(t.replace(r,""),n);else if(T)s=l>=a(t.replace(o,""),n);else if(u)s=la(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,a=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.popupFilters&&s.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),a++),this.emitter.emit("row-processed",this,x,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d; +l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var a=0,l=i.options.length;l>a;a++)i.options[a].selected&&(e=e.concat(i.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,a=this.fltIds.length;a>s;s++){var l=this.getFilterType(s);if(l===f["default"].lower(t)){var n=e?s:this.fltIds[s];i.push(n)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sn;n++){var o=this.getCellData(l[n]);a[1].push(o)}i.push(a)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),a=0;aa;a++){var n=i[a],r=n[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",a=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",a),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),a=s.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=s[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=i[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("cleared-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=s.length;r>n;n++){var o=u["default"].id(this.fltIds[s[n]]);if(l=this.getFilterValue(s[n]),a!==s[n]||this.paging&&-1!=t.indexOf(s[n])&&a===s[n]||!this.paging&&(-1!=i.indexOf(s[n])||-1!=e.indexOf(s[n]))||l===this.displayAllText){if(-1!=i.indexOf(s[n])?this.Mod.checkList.checkListDiv[s[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[n])?this.Mod.checkList._build(s[n]):this.Mod.dropdown._build(s[n],!0),this.setFilterValue(s[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,a=i[s];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",a="script"==s?"src":"href",l=u["default"].tag(H,s),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var a=s?s:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var a=0;a0){var s=document.cookie,a=s.indexOf(i);if(-1!==a){a+=i.length;var l=s.indexOf(";",a);-1===l&&(l=s.length),e=unescape(s.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,a=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0])}return a}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,a=parseInt(s.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,i,s,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var i=0;i_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,a=this.addTChecks(t,e),l=[],n=s.feature("store"),o=n?n.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),l=a+s.pagingLength-1<=e.nbVisibleRows?a+s.pagingLength-1:e.nbVisibleRows;i=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var a=i.refRow,r=i.nbRows;i.nbPages=Math.ceil((r-a)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,i=e.tbl.rows,s=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id); +if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(s.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=s[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&i&&i.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&i&&i.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":a(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),a=d["default"].id(this.prfxBtnLastSpan+e.id),l=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),a&&(b["default"].remove(a,"click",h.last),d["default"].remove(a)),l&&(b["default"].remove(l,"click",h.first),d["default"].remove(l)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var a=i.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ir;r++){var o=s?r:i[r];this.setRowBg(o,n),n++}this.emitter.on("row-processed",function(e,i,s){return t.processRow(i,s)}),this.initialized=!0}}},{key:"processRow",value:function(t,e){e?this.setRowBg(t,this.tf.validRowsIndex.length):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 58cc1966..4101f405 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,2218 +1,8 @@ -webpackJsonp([1],{ +/** + * tablefilter v0.1.1 by Max Guglielmi + * build date: 2015-12-31T01:55:02.086Z + * MIT License + */ -/***/ 26: -/***/ function(module, exports, __webpack_require__) { - - var map = { - "./array": 6, - "./array.js": 6, - "./cookie": 4, - "./cookie.js": 4, - "./date": 7, - "./date.js": 7, - "./dom": 2, - "./dom.js": 2, - "./emitter": 9, - "./emitter.js": 9, - "./event": 1, - "./event.js": 1, - "./extensions/advancedGrid/adapterEzEditTable": 27, - "./extensions/advancedGrid/adapterEzEditTable.js": 27, - "./extensions/advancedGrid/advancedGrid": 28, - "./extensions/advancedGrid/advancedGrid.js": 28, - "./extensions/colOps/colOps": 29, - "./extensions/colOps/colOps.js": 29, - "./extensions/colsVisibility/colsVisibility": 30, - "./extensions/colsVisibility/colsVisibility.js": 30, - "./extensions/filtersVisibility/filtersVisibility": 31, - "./extensions/filtersVisibility/filtersVisibility.js": 31, - "./extensions/sort/adapterSortabletable": 32, - "./extensions/sort/adapterSortabletable.js": 32, - "./extensions/sort/sort": 33, - "./extensions/sort/sort.js": 33, - "./helpers": 8, - "./helpers.js": 8, - "./modules/alternateRows": 24, - "./modules/alternateRows.js": 24, - "./modules/checkList": 18, - "./modules/checkList.js": 18, - "./modules/clearButton": 22, - "./modules/clearButton.js": 22, - "./modules/dropdown": 16, - "./modules/dropdown.js": 16, - "./modules/feature": 12, - "./modules/feature.js": 12, - "./modules/gridLayout": 11, - "./modules/gridLayout.js": 11, - "./modules/help": 23, - "./modules/help.js": 23, - "./modules/highlightKeywords": 14, - "./modules/highlightKeywords.js": 14, - "./modules/loader": 13, - "./modules/loader.js": 13, - "./modules/noResults": 25, - "./modules/noResults.js": 25, - "./modules/paging": 21, - "./modules/paging.js": 21, - "./modules/popupFilter": 15, - "./modules/popupFilter.js": 15, - "./modules/rowsCounter": 19, - "./modules/rowsCounter.js": 19, - "./modules/statusBar": 20, - "./modules/statusBar.js": 20, - "./modules/store": 10, - "./modules/store.js": 10, - "./sort": 17, - "./sort.js": 17, - "./string": 3, - "./string.js": 3, - "./types": 5, - "./types.js": 5 - }; - function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); - }; - function webpackContextResolve(req) { - return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); - }; - webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); - }; - webpackContext.resolve = webpackContextResolve; - module.exports = webpackContext; - webpackContext.id = 26; - - -/***/ }, - -/***/ 27: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterEzEditTable = (function () { - /** - * Adapter module for ezEditTable, an external library providing advanced - * grid features (selection and edition): - * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus - * - * @param {Object} tf TableFilter instance - */ - - function AdapterEzEditTable(tf, cfg) { - _classCallCheck(this, AdapterEzEditTable); - - // ezEditTable config - this.initialized = false; - this.desc = cfg.description || 'ezEditTable adapter'; - this.filename = cfg.filename || 'ezEditTable.js'; - this.vendorPath = cfg.vendor_path; - this.loadStylesheet = Boolean(cfg.load_stylesheet); - this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; - this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; - this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; - // Enable the ezEditTable's scroll into view behaviour if grid layout on - cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; - - this._ezEditTable = null; - this.cfg = cfg; - this.tf = tf; - } - - /** - * Conditionally load ezEditTable library and set advanced grid - * @return {[type]} [description] - */ - - _createClass(AdapterEzEditTable, [{ - key: 'init', - value: function init() { - var _this = this; - - var tf = this.tf; - if (window.EditTable) { - this._setAdvancedGrid(); - } else { - var path = this.vendorPath + this.filename; - tf.import(this.filename, path, function () { - _this._setAdvancedGrid(); - }); - } - if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { - tf.import(this.stylesheetName, this.stylesheet, null, 'link'); - } - } - - /** - * Instantiate ezEditTable component for advanced grid features - */ - - }, { - key: '_setAdvancedGrid', - value: function _setAdvancedGrid() { - var tf = this.tf; - - //start row for EditTable constructor needs to be calculated - var startRow, - cfg = this.cfg, - thead = _dom2.default.tag(tf.tbl, 'thead'); - - //if thead exists and startRow not specified, startRow is calculated - //automatically by EditTable - if (thead.length > 0 && !cfg.startRow) { - startRow = undefined; - } - //otherwise startRow config property if any or TableFilter refRow - else { - startRow = cfg.startRow || tf.refRow; - } - - cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; - var editable = cfg.editable; - var selectable = cfg.selection; - - if (selectable) { - cfg.default_selection = cfg.default_selection || 'row'; - } - //CSS Styles - cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; - - var _lastValidRowIndex = 0; - var _lastRowIndex = 0; - - if (selectable) { - //Row navigation needs to be calculated according to TableFilter's - //validRowsIndex array - var onAfterSelection = function onAfterSelection(et, selectedElm, e) { - var slc = et.Selection; - //Next valid filtered row needs to be selected - var doSelect = function doSelect(nextRowIndex) { - if (et.defaultSelection === 'row') { - slc.SelectRowByIndex(nextRowIndex); - } else { - et.ClearSelections(); - var cellIndex = selectedElm.cellIndex, - row = tf.tbl.rows[nextRowIndex]; - if (et.defaultSelection === 'both') { - slc.SelectRowByIndex(nextRowIndex); - } - if (row) { - slc.SelectCell(row.cells[cellIndex]); - } - } - //Table is filtered - if (tf.validRowsIndex.length !== tf.getRowsNb()) { - var r = tf.tbl.rows[nextRowIndex]; - if (r) { - r.scrollIntoView(false); - } - if (cell) { - if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { - tf.tblCont.scrollLeft = 100000000; - } else if (cell.cellIndex === 0 && tf.gridLayout) { - tf.tblCont.scrollLeft = 0; - } else { - cell.scrollIntoView(false); - } - } - } - }; - - //table is not filtered - if (!tf.validRowsIndex) { - return; - } - var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, - nextRowIndex, - paging = tf.feature('paging'), - - //pgup/pgdown keys - d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { - //last row - if (row.rowIndex >= validIndexes[validIdxLen - 1]) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - var calcRowIndex = _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[_lastValidRowIndex - d]; - nextRowIndex = v ? v : validIndexes[0]; - } - } - _lastRowIndex = row.rowIndex; - doSelect(nextRowIndex); - } else { - //If filtered row is valid, special calculation for - //pgup/pgdown keys - if (keyCode !== 34 && keyCode !== 33) { - _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); - _lastRowIndex = row.rowIndex; - } else { - if (keyCode === 34) { - //pgdown - //last row - if (_lastValidRowIndex + d <= validIdxLen - 1) { - nextRowIndex = validIndexes[_lastValidRowIndex + d]; - } else { - nextRowIndex = [validIdxLen - 1]; - } - } else { - //pgup - //first row - if (_lastValidRowIndex - d <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - nextRowIndex = validIndexes[_lastValidRowIndex - d]; - } - } - _lastRowIndex = nextRowIndex; - _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); - doSelect(nextRowIndex); - } - } - }; - - //Page navigation has to be enforced whenever selected row is out of - //the current page range - var onBeforeSelection = function onBeforeSelection(et, selectedElm) { - var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; - if (tf.paging) { - if (tf.feature('paging').nbPages > 1) { - var paging = tf.feature('paging'); - //page length is re-assigned in case it has changed - et.nbRowsPerPage = paging.pagingLength; - var validIndexes = tf.validRowsIndex, - validIdxLen = validIndexes.length, - pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); - var rowIndex = row.rowIndex; - - if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { - paging.setPage('last'); - } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { - paging.setPage('first'); - } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { - paging.setPage('next'); - } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { - paging.setPage('previous'); - } - } - } - }; - - //Selected row needs to be visible when paging is activated - if (tf.paging) { - tf.feature('paging').onAfterChangePage = function (paging) { - var advGrid = paging.tf.extension('advancedGrid'); - var et = advGrid._ezEditTable; - var slc = et.Selection; - var row = slc.GetActiveRow(); - if (row) { - row.scrollIntoView(false); - } - var cell = slc.GetActiveCell(); - if (cell) { - cell.scrollIntoView(false); - } - }; - } - - //Rows navigation when rows are filtered is performed with the - //EditTable row selection callback events - if (cfg.default_selection === 'row') { - var fnB = cfg.on_before_selected_row; - cfg.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 = cfg.on_after_selected_row; - cfg.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 = cfg.on_before_selected_cell; - cfg.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 = cfg.on_after_selected_cell; - cfg.on_after_selected_cell = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnC) { - fnC.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - } - } - if (editable) { - //Added or removed rows, TF rows number needs to be re-calculated - var fnE = cfg.on_added_dom_row; - cfg.on_added_dom_row = function () { - tf.nbFilterableRows++; - if (!tf.paging) { - tf.emitter.emit('rows-changed', tf, this); - //tf.feature('rowsCounter').refresh(); - } else { - tf.nbRows++; - tf.nbVisibleRows++; - tf.nbFilterableRows++; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnE) { - fnE.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - if (cfg.actions && cfg.actions['delete']) { - var fnF = cfg.actions['delete'].on_after_submit; - cfg.actions['delete'].on_after_submit = function () { - tf.nbFilterableRows--; - if (!tf.paging) { - // tf.feature('rowsCounter').refresh(); - tf.emitter.emit('rows-changed', tf, this); - } else { - tf.nbRows--; - tf.nbVisibleRows--; - tf.nbFilterableRows--; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(false); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnF) { - fnF.call(null, arguments[0], arguments[1]); - } - }; - } - } - - try { - this._ezEditTable = new EditTable(tf.id, cfg, startRow); - this._ezEditTable.Init(); - } catch (e) { - throw new Error(this.err); - } - - this.initialized = true; - } - - /** - * Reset advanced grid when previously removed - */ - - }, { - key: 'reset', - value: function reset() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.Set(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Set(); - } - } - } - - /** - * Remove advanced grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.ClearSelections(); - ezEditTable.Selection.Remove(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Remove(); - } - } - this.initialized = false; - } - }]); - - return AdapterEzEditTable; - })(); - - exports.default = AdapterEzEditTable; - -/***/ }, - -/***/ 28: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterEzEditTable = __webpack_require__(27); - - var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _adapterEzEditTable2.default; - -/***/ }, - -/***/ 29: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColOps = (function () { - - /** - * Column calculations - * @param {Object} tf TableFilter instance - */ - - function ColOps(tf, opts) { - _classCallCheck(this, ColOps); - - //calls function before col operation - this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; - //calls function after col operation - this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; - - this.opts = opts; - this.tf = tf; - } - - _createClass(ColOps, [{ - key: 'init', - value: function init() { - var _this = this; - - // subscribe to events - this.tf.emitter.on('after-filtering', function () { - return _this.calc(); - }); - - this.calc(); - } - - /** - * Calculates columns' values - * Configuration options are stored in 'opts' property - * - 'id' contains ids of elements showing result (array) - * - 'col' contains the columns' indexes (array) - * - 'operation' contains operation type (array, values: 'sum', 'mean', - * 'min', 'max', 'median', 'q1', 'q3') - * - 'write_method' array defines which method to use for displaying the - * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' - * - 'tot_row_index' defines in which row results are displayed - * (integers array) - * - * - changes made by Nuovella: - * (1) optimized the routine (now it will only process each column once), - * (2) added calculations for the median, lower and upper quartile. - */ - - }, { - key: 'calc', - value: function calc() { - var tf = this.tf; - if (!tf.isFirstLoad && !tf.hasGrid()) { - return; - } - - if (this.onBeforeOperation) { - this.onBeforeOperation.call(null, tf); - } - - var opts = this.opts, - labelId = opts.id, - colIndex = opts.col, - operation = opts.operation, - outputType = opts.write_method, - totRowIndex = opts.tot_row_index, - excludeRow = opts.exclude_row, - decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; - - //nuovella: determine unique list of columns to operate on - var ucolIndex = [], - ucolMax = 0; - ucolIndex[ucolMax] = colIndex[0]; - - for (var ii = 1; ii < colIndex.length; ii++) { - var saved = 0; - //see if colIndex[ii] is already in the list of unique indexes - for (var jj = 0; jj <= ucolMax; jj++) { - if (ucolIndex[jj] === colIndex[ii]) { - saved = 1; - } - } - //if not saved then, save the index; - if (saved === 0) { - ucolMax++; - ucolIndex[ucolMax] = colIndex[ii]; - } - } - - if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { - var rows = tf.tbl.rows, - colvalues = []; - - for (var ucol = 0; ucol <= ucolMax; ucol++) { - //this retrieves col values - //use ucolIndex because we only want to pass through this loop - //once for each column get the values in this unique column - colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); - - //next: calculate all operations for this column - 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; - - for (var k = 0; k < colIndex.length; k++) { - if (colIndex[k] === ucolIndex[ucol]) { - mThisCol++; - opsThisCol[mThisCol] = _string2.default.lower(operation[k]); - decThisCol[mThisCol] = decimalPrecision[k]; - labThisCol[mThisCol] = labelId[k]; - oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; - - switch (opsThisCol[mThisCol]) { - case 'mean': - meanFlag = 1; - break; - case 'sum': - sumFlag = 1; - break; - case 'min': - minFlag = 1; - break; - case 'max': - maxFlag = 1; - break; - case 'median': - medFlag = 1; - break; - case 'q1': - q1Flag = 1; - break; - case 'q3': - q3Flag = 1; - break; - } - } - } - - for (var j = 0; j < colvalues[ucol].length; j++) { - //sort the list for calculation of median and quartiles - if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { - if (j < colvalues[ucol].length - 1) { - for (k = j + 1; k < colvalues[ucol].length; k++) { - if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { - temp = colvalues[ucol][j]; - colvalues[ucol][j] = colvalues[ucol][k]; - colvalues[ucol][k] = temp; - } - } - } - } - var cvalue = parseFloat(colvalues[ucol][j]); - theList[j] = parseFloat(cvalue); - - if (!isNaN(cvalue)) { - nbvalues++; - if (sumFlag === 1 || meanFlag === 1) { - sumValue += parseFloat(cvalue); - } - if (minFlag === 1) { - if (minValue === null) { - minValue = parseFloat(cvalue); - } else { - minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; - } - } - if (maxFlag === 1) { - if (maxValue === null) { - maxValue = parseFloat(cvalue); - } else { - maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; - } - } - } - } //for j - if (meanFlag === 1) { - meanValue = sumValue / nbvalues; - } - if (medFlag === 1) { - var aux = 0; - if (nbvalues % 2 === 1) { - aux = Math.floor(nbvalues / 2); - medValue = theList[aux]; - } else { - medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; - } - } - var posa; - if (q1Flag === 1) { - posa = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa == nbvalues) { - q1Value = (theList[posa - 1] + theList[posa]) / 2; - } else { - q1Value = theList[posa]; - } - } - if (q3Flag === 1) { - posa = 0.0; - var posb = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa === nbvalues) { - posb = 3 * posa; - q3Value = (theList[posb] + theList[posb - 1]) / 2; - } else { - q3Value = theList[nbvalues - posa - 1]; - } - } - - for (var i = 0; i <= mThisCol; i++) { - switch (opsThisCol[i]) { - case 'mean': - result = meanValue; - break; - case 'sum': - result = sumValue; - break; - case 'min': - result = minValue; - break; - case 'max': - result = maxValue; - break; - case 'median': - result = medValue; - break; - case 'q1': - result = q1Value; - break; - case 'q3': - result = q3Value; - break; - } - - var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; - - //if outputType is defined - if (oTypeThisCol && result) { - result = result.toFixed(precision); - - if (_dom2.default.id(labThisCol[i])) { - switch (_string2.default.lower(oTypeThisCol)) { - case 'innerhtml': - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result; - } - break; - case 'setvalue': - _dom2.default.id(labThisCol[i]).value = result; - break; - case 'createtextnode': - var oldnode = _dom2.default.id(labThisCol[i]).firstChild; - var txtnode = _dom2.default.text(result); - _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); - break; - } //switch - } - } else { - try { - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); - } - } catch (e) {} //catch - } //else - } //for i - - // row(s) with result are always visible - var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; - if (totRow) { - totRow.style.display = ''; - } - } //for ucol - } //if typeof - - if (this.onAfterOperation) { - this.onAfterOperation.call(null, tf); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - // unsubscribe to events - this.tf.emitter.off('after-filtering', function () { - return _this2.calc(); - }); - } - }]); - - return ColOps; - })(); - - exports.default = ColOps; - -/***/ }, - -/***/ 30: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColsVisibility = (function () { - - /** - * Columns Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function ColsVisibility(tf, f) { - _classCallCheck(this, ColsVisibility); - - // Configuration object - var cfg = tf.config(); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Columns visibility manager'; - - //show/hide cols span element - this.spanEl = null; - //show/hide cols button element - this.btnEl = null; - //show/hide cols container div element - this.contEl = null; - - //tick to hide or show column - this.tickToHide = f.tick_to_hide === false ? false : true; - //enables/disables cols manager generation - this.manager = f.manager === false ? false : true; - //only if external headers - this.headersTbl = f.headers_table || false; - //only if external headers - this.headersIndex = f.headers_index || 1; - //id of container element - this.contElTgtId = f.container_target_id || null; - //alternative headers text - this.headersText = f.headers_text || null; - //id of button container element - this.btnTgtId = f.btn_target_id || null; - //defines show/hide cols text - this.btnText = f.btn_text || 'Columns▼'; - //defines show/hide cols button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for show/hide cols button - this.btnCssClass = f.btn_css_class || 'colVis'; - //defines close link text - this.btnCloseText = f.btn_close_text || 'Close'; - //defines close button innerHtml - this.btnCloseHtml = f.btn_close_html || null; - //defines css class for close button - this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; - this.stylesheet = f.stylesheet || 'colsVisibility.css'; - //span containing show/hide cols button - this.prfx = 'colVis_'; - //defines css class span containing show/hide cols - this.spanCssClass = f.span_css_class || 'colVisSpan'; - this.prfxCont = this.prfx + 'Cont_'; - //defines css class div containing show/hide cols - this.contCssClass = f.cont_css_class || 'colVisCont'; - //defines css class for cols list (ul) - this.listCssClass = cfg.list_css_class || 'cols_checklist'; - //defines css class for list item (li) - this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; - //defines css class for selected list item (li) - this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; - //text preceding columns list - this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); - this.atStart = f.at_start || null; - this.enableHover = Boolean(f.enable_hover); - //enables select all option - this.enableTickAll = Boolean(f.enable_tick_all); - //text preceding columns list - this.tickAllText = f.tick_all_text || 'Select all:'; - - //array containing hidden columns indexes - this.hiddenCols = []; - this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; - - //callback invoked just after cols manager is loaded - this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; - //calls function before cols manager is opened - this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; - //calls function after cols manager is opened - this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; - //calls function before cols manager is closed - this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; - //calls function after cols manager is closed - this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; - - //callback before col is hidden - this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; - //callback after col is hidden - this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; - //callback before col is displayed - this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; - //callback after col is displayed - this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; - - //Grid layout compatibility - if (tf.gridLayout) { - this.headersTbl = tf.feature('gridLayout').headTbl; //headers table - this.headersIndex = 0; //headers index - this.onAfterColDisplayed = function () {}; - this.onAfterColHidden = function () {}; - } - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - _createClass(ColsVisibility, [{ - key: 'toggle', - value: function toggle() { - var contDisplay = this.contEl.style.display; - var onBeforeOpen = this.onBeforeOpen; - var onBeforeClose = this.onBeforeClose; - var onAfterOpen = this.onAfterOpen; - var onAfterClose = this.onAfterClose; - - if (onBeforeOpen && contDisplay !== 'inline') { - onBeforeOpen.call(null, this); - } - if (onBeforeClose && contDisplay === 'inline') { - onBeforeClose.call(null, this); - } - - this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; - - if (onAfterOpen && contDisplay !== 'inline') { - onAfterOpen.call(null, this); - } - if (onAfterClose && contDisplay === 'inline') { - onAfterClose.call(null, this); - } - } - }, { - key: 'checkItem', - value: function checkItem(lbl) { - var li = lbl.parentNode; - if (!li || !lbl) { - return; - } - var isChecked = lbl.firstChild.checked; - var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; - colIndex = parseInt(colIndex, 10); - if (isChecked) { - _dom2.default.addClass(li, this.listSlcItemCssClass); - } else { - _dom2.default.removeClass(li, this.listSlcItemCssClass); - } - - var hide = false; - if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { - hide = true; - } - this.setHidden(colIndex, hide); - } - }, { - key: 'init', - value: function init() { - if (!this.manager) { - return; - } - this.buildBtn(); - this.buildManager(); - - this.initialized = true; - } - - /** - * Build main button UI - */ - - }, { - key: 'buildBtn', - value: function buildBtn() { - var _this = this; - - if (this.btnEl) { - return; - } - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.spanCssClass; - - //Container element (rdiv or custom element) - if (!this.btnTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); - - if (!this.btnTgtId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - if (!this.btnHtml) { - var btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCssClass; - btn.title = this.desc; - - btn.innerHTML = this.btnText; - span.appendChild(btn); - if (!this.enableHover) { - _event2.default.add(btn, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(btn, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } else { - //Custom html - span.innerHTML = this.btnHtml; - var colVisEl = span.firstChild; - if (!this.enableHover) { - _event2.default.add(colVisEl, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(colVisEl, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } - - this.spanEl = span; - this.btnEl = this.spanEl.firstChild; - - if (this.onLoaded) { - this.onLoaded.call(null, this); - } - } - - /** - * Build columns manager UI - */ - - }, { - key: 'buildManager', - value: function buildManager() { - var _this2 = this; - - var tf = this.tf; - - var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); - container.className = this.contCssClass; - - //Extension description - var extNameLabel = _dom2.default.create('p'); - extNameLabel.innerHTML = this.text; - container.appendChild(extNameLabel); - - //Headers list - var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); - ul.className = this.listCssClass; - - var tbl = this.headersTbl ? this.headersTbl : tf.tbl; - var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); - var headerRow = tbl.rows[headerIndex]; - - //Tick all option - if (this.enableTickAll) { - var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); - _dom2.default.addClass(li, this.listItemCssClass); - ul.appendChild(li); - li.check.checked = !this.tickToHide; - - _event2.default.add(li.check, 'click', function () { - for (var h = 0; h < headerRow.cells.length; h++) { - var itm = _dom2.default.id('col_' + h + '_' + tf.id); - if (itm && li.check.checked !== itm.checked) { - itm.click(); - itm.checked = li.check.checked; - } - } - }); - } - - for (var i = 0; i < headerRow.cells.length; i++) { - var cell = headerRow.cells[i]; - var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); - var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); - _dom2.default.addClass(liElm, this.listItemCssClass); - if (!this.tickToHide) { - _dom2.default.addClass(liElm, this.listSlcItemCssClass); - } - ul.appendChild(liElm); - if (!this.tickToHide) { - liElm.check.checked = true; - } - - _event2.default.add(liElm.check, 'click', function (evt) { - var elm = _event2.default.target(evt); - var lbl = elm.parentNode; - _this2.checkItem(lbl); - }); - } - - //separator - var p = _dom2.default.create('p', ['align', 'center']); - var btn; - //Close link - if (!this.btnCloseHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCloseCssClass; - btn.innerHTML = this.btnCloseText; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - p.appendChild(btn); - } else { - p.innerHTML = this.btnCloseHtml; - btn = p.firstChild; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - } - - container.appendChild(ul); - container.appendChild(p); - - this.btnEl.parentNode.insertBefore(container, this.btnEl); - this.contEl = container; - - if (this.atStart) { - var a = this.atStart; - for (var k = 0; k < a.length; k++) { - var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); - if (itm) { - itm.click(); - } - } - } - } - - /** - * Hide or show specified columns - * @param {Numner} colIndex Column index - * @param {Boolean} hide hide column if true or show if false - */ - - }, { - key: 'setHidden', - value: function setHidden(colIndex, hide) { - var tf = this.tf; - var tbl = tf.tbl; - - if (this.onBeforeColHidden && hide) { - this.onBeforeColHidden.call(null, this, colIndex); - } - if (this.onBeforeColDisplayed && !hide) { - this.onBeforeColDisplayed.call(null, this, colIndex); - } - - this._hideCells(tbl, colIndex, hide); - if (this.headersTbl) { - this._hideCells(this.headersTbl, colIndex, hide); - } - - var hiddenCols = this.hiddenCols; - var itemIndex = hiddenCols.indexOf(colIndex); - if (hide) { - if (itemIndex === -1) { - this.hiddenCols.push(colIndex); - } - } else { - if (itemIndex !== -1) { - this.hiddenCols.splice(itemIndex, 1); - } - } - - var gridLayout; - var headTbl; - var gridColElms; - if (this.onAfterColHidden && hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); - - var headTblW = parseInt(headTbl.style.width, 10); - headTbl.style.width = headTblW - hiddenWidth + 'px'; - tbl.style.width = headTbl.style.width; - } - this.onAfterColHidden.call(null, this, colIndex); - } - - if (this.onAfterColDisplayed && !hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var width = parseInt(gridColElms[colIndex].style.width, 10); - headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; - tf.tbl.style.width = headTbl.style.width; - } - this.onAfterColDisplayed.call(null, this, colIndex); - } - } - - /** - * Show specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'showCol', - value: function showCol(colIndex) { - if (colIndex === undefined || !this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, false); - } - } - - /** - * Hide specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'hideCol', - value: function hideCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, true); - } - } - - /** - * Determine if specified column is hidden - * @param {Number} colIndex Column index - */ - - }, { - key: 'isColHidden', - value: function isColHidden(colIndex) { - if (this.hiddenCols.indexOf(colIndex) !== -1) { - return true; - } - return false; - } - - /** - * Toggle visibility of specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggleCol', - value: function toggleCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - this.showCol(colIndex); - } else { - this.hideCol(colIndex); - } - } - - /** - * Returns the indexes of the columns currently hidden - * @return {Array} column indexes - */ - - }, { - key: 'getHiddenCols', - value: function getHiddenCols() { - return this.hiddenCols; - } - - /** - * Remove the columns manager - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - if (_dom2.default.id(this.contElTgtId)) { - _dom2.default.id(this.contElTgtId).innerHTML = ''; - } else { - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - } - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - this.initialized = false; - } - }, { - key: '_getHeaderText', - value: function _getHeaderText(cell) { - if (!cell.hasChildNodes) { - return ''; - } - - for (var i = 0; i < cell.childNodes.length; i++) { - var n = cell.childNodes[i]; - if (n.nodeType === 3) { - return n.nodeValue; - } else if (n.nodeType === 1) { - if (n.id && n.id.indexOf('popUp') !== -1) { - continue; - } else { - return _dom2.default.getText(n); - } - } - continue; - } - return ''; - } - }, { - key: '_hideCells', - value: function _hideCells(tbl, colIndex, hide) { - for (var i = 0; i < tbl.rows.length; i++) { - var row = tbl.rows[i]; - var cell = row.cells[colIndex]; - if (cell) { - cell.style.display = hide ? 'none' : ''; - } - } - } - }]); - - return ColsVisibility; - })(); - - exports.default = ColsVisibility; - -/***/ }, - -/***/ 31: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var FiltersVisibility = (function () { - - /** - * Filters Row Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function FiltersVisibility(tf, f) { - _classCallCheck(this, FiltersVisibility); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Filters row visibility manager'; - - // Path and image filenames - this.stylesheet = f.stylesheet || 'filtersVisibility.css'; - this.icnExpand = f.expand_icon_name || 'icn_exp.png'; - this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; - - //expand/collapse filters span element - this.contEl = null; - //expand/collapse filters btn element - this.btnEl = null; - - this.icnExpandHtml = 'Expand filters'; - this.icnCollapseHtml = 'Collapse filters'; - this.defaultText = 'Toggle filters'; - - //id of container element - this.targetId = f.target_id || null; - //enables/disables expand/collapse icon - this.enableIcon = f.enable_icon === false ? false : true; - this.btnText = f.btn_text || ''; - - //defines expand/collapse filters text - this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; - this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; - - //defines expand/collapse filters button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for expand/collapse filters button - this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; - //defines css class span containing expand/collapse filters - this.contCssClass = f.cont_css_class || 'expClpFlt'; - this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); - - this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; - - // Prefix - this.prfx = 'fltsVis_'; - - //callback before filters row is shown - this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; - //callback after filters row is shown - this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; - //callback before filters row is hidden - this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; - //callback after filters row is hidden - this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - /** - * Initialise extension - */ - - _createClass(FiltersVisibility, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - this.buildUI(); - this.initialized = true; - } - - /** - * Build UI elements - */ - - }, { - key: 'buildUI', - value: function buildUI() { - var _this = this; - - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.contCssClass; - - //Container element (rdiv or custom element) - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); - - if (!this.targetId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - var btn = undefined; - if (!this.btnHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); - btn.className = this.btnCssClass; - btn.title = this.btnText || this.defaultText; - btn.innerHTML = this.collapseBtnHtml; - span.appendChild(btn); - } else { - //Custom html - span.innerHTML = this.btnHtml; - btn = span.firstChild; - } - - _event2.default.add(btn, 'click', function () { - return _this.toggle(); - }); - - this.contEl = span; - this.btnEl = btn; - - if (!this.visibleAtStart) { - this.toggle(); - } - } - - /** - * Toggle filters visibility - */ - - }, { - key: 'toggle', - value: function toggle() { - var tf = this.tf; - var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; - var fltRow = tbl.rows[this.filtersRowIndex]; - var fltRowDisplay = fltRow.style.display; - - if (this.onBeforeShow && fltRowDisplay !== '') { - this.onBeforeShow.call(this, this); - } - if (this.onBeforeHide && fltRowDisplay === '') { - this.onBeforeHide.call(null, this); - } - - fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; - if (this.enableIcon && !this.btnHtml) { - this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; - } - - if (this.onAfterShow && fltRowDisplay !== '') { - this.onAfterShow.call(null, this); - } - if (this.onAfterHide && fltRowDisplay === '') { - this.onAfterHide.call(null, this); - } - } - - /** - * Destroy the UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - this.initialized = false; - } - }]); - - return FiltersVisibility; - })(); - - exports.default = FiltersVisibility; - -/***/ }, - -/***/ 32: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _date = __webpack_require__(7); - - var _date2 = _interopRequireDefault(_date); - - var _helpers = __webpack_require__(8); - - var _helpers2 = _interopRequireDefault(_helpers); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterSortableTable = (function () { - - /** - * SortableTable Adapter module - * @param {Object} tf TableFilter instance - */ - - function AdapterSortableTable(tf, opts) { - _classCallCheck(this, AdapterSortableTable); - - this.initialized = false; - this.name = opts.name; - this.desc = opts.description || 'Sortable table'; - - //indicates if tables was sorted - this.sorted = false; - - this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; - this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; - this.asyncSort = Boolean(opts.async_sort); - this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; - - // edit .sort-arrow.descending / .sort-arrow.ascending in - // tablefilter.css to reflect any path change - this.imgPath = opts.images_path || tf.themesPath; - this.imgBlank = opts.image_blank || 'blank.png'; - this.imgClassName = opts.image_class_name || 'sort-arrow'; - this.imgAscClassName = opts.image_asc_class_name || 'ascending'; - this.imgDescClassName = opts.image_desc_class_name || 'descending'; - //cell attribute storing custom key - this.customKey = opts.custom_key || 'data-tf-sortKey'; - - // callback invoked after sort is loaded and instanciated - this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; - // callback invoked before table is sorted - this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; - // callback invoked after table is sorted - this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; - - this.tf = tf; - } - - _createClass(AdapterSortableTable, [{ - key: 'init', - value: function init() { - var tf = this.tf; - var adpt = this; - - // SortableTable class sanity check (sortabletable.js) - if (_types2.default.isUndef(SortableTable)) { - throw new Error('SortableTable class not found.'); - } - - this.overrideSortableTable(); - this.setSortTypes(); - - //Column sort at start - var sortColAtStart = adpt.sortColAtStart; - if (sortColAtStart) { - this.stt.sort(sortColAtStart[0], sortColAtStart[1]); - } - - if (this.onSortLoaded) { - this.onSortLoaded.call(null, tf, this); - } - - /*** SortableTable callbacks ***/ - this.stt.onbeforesort = function () { - if (adpt.onBeforeSort) { - adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); - } - - /*** sort behaviour for paging ***/ - if (tf.paging) { - tf.feature('paging').disable(); - } - }; - - this.stt.onsort = function () { - adpt.sorted = true; - - //rows alternating bg issue - // TODO: move into AlternateRows component - if (tf.alternateRows) { - var rows = tf.tbl.rows, - c = 0; - - var setClass = function setClass(row, i, removeOnly) { - if (_types2.default.isUndef(removeOnly)) { - removeOnly = false; - } - var altRows = tf.feature('alternateRows'), - oddCls = altRows.oddCss, - evenCls = altRows.evenCss; - _dom2.default.removeClass(row, oddCls); - _dom2.default.removeClass(row, evenCls); - - if (!removeOnly) { - _dom2.default.addClass(row, i % 2 ? oddCls : evenCls); - } - }; - - for (var i = tf.refRow; i < tf.nbRows; i++) { - var isRowValid = rows[i].getAttribute('validRow'); - if (tf.paging && rows[i].style.display === '') { - setClass(rows[i], c); - c++; - } else { - if ((isRowValid === 'true' || isRowValid === null) && rows[i].style.display === '') { - setClass(rows[i], c); - c++; - } else { - setClass(rows[i], c, true); - } - } - } - } - //sort behaviour for paging - if (tf.paging) { - var paginator = tf.feature('paging'); - // recalculate valid rows index as sorting may have change it - tf.getValidRows(true); - paginator.enable(); - paginator.setPage(paginator.getPage()); - } - - if (adpt.onAfterSort) { - adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); - } - }; - - this.initialized = true; - } - - /** - * Sort specified column - * @param {Number} colIdx Column index - * @param {Boolean} desc Optional: descending manner - */ - - }, { - key: 'sortByColumnIndex', - value: function sortByColumnIndex(colIdx, desc) { - this.stt.sort(colIdx, desc); - } - }, { - key: 'overrideSortableTable', - value: function overrideSortableTable() { - var adpt = this, - tf = this.tf; - - /** - * Overrides headerOnclick method in order to handle th event - * @param {Object} e [description] - */ - SortableTable.prototype.headerOnclick = function (evt) { - if (!adpt.initialized) { - return; - } - - // find Header element - var el = evt.target || evt.srcElement; - - while (el.tagName !== 'TD' && el.tagName !== 'TH') { - el = el.parentNode; - } - - this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); - }; - - /** - * Overrides getCellIndex IE returns wrong cellIndex when columns are - * hidden - * @param {Object} oTd TD element - * @return {Number} Cell index - */ - SortableTable.getCellIndex = function (oTd) { - var cells = oTd.parentNode.cells, - l = cells.length, - i = undefined; - for (i = 0; cells[i] != oTd && i < l; i++) {} - return i; - }; - - /** - * Overrides initHeader in order to handle filters row position - * @param {Array} oSortTypes - */ - SortableTable.prototype.initHeader = function (oSortTypes) { - var stt = this; - if (!stt.tHead) { - if (tf.gridLayout) { - stt.tHead = tf.feature('gridLayout').headTbl.tHead; - } else { - return; - } - } - - stt.headersRow = tf.headersRow; - var cells = stt.tHead.rows[stt.headersRow].cells; - stt.sortTypes = oSortTypes || []; - var l = cells.length; - var img = undefined, - c = undefined; - - for (var i = 0; i < l; i++) { - c = cells[i]; - if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { - c.style.cursor = 'pointer'; - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - c.appendChild(img); - if (stt.sortTypes[i] !== null) { - c.setAttribute('_sortType', stt.sortTypes[i]); - } - _event2.default.add(c, 'click', stt._headerOnclick); - } else { - c.setAttribute('_sortType', oSortTypes[i]); - c._sortType = 'None'; - } - } - stt.updateHeaderArrows(); - }; - - /** - * Overrides updateHeaderArrows in order to handle arrows indicators - */ - SortableTable.prototype.updateHeaderArrows = function () { - var stt = this; - var cells = undefined, - l = undefined, - img = undefined; - - // external headers - if (adpt.asyncSort && adpt.triggerIds.length > 0) { - var triggers = adpt.triggerIds; - cells = []; - l = triggers.length; - for (var j = 0; j < triggers.length; j++) { - cells.push(_dom2.default.id(triggers[j])); - } - } else { - if (!this.tHead) { - return; - } - cells = stt.tHead.rows[stt.headersRow].cells; - l = cells.length; - } - for (var i = 0; i < l; i++) { - var cellAttr = cells[i].getAttribute('_sortType'); - if (cellAttr !== null && cellAttr !== 'None') { - img = cells[i].lastChild || cells[i]; - if (img.nodeName.toLowerCase() !== 'img') { - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - cells[i].appendChild(img); - } - if (i === stt.sortColumn) { - img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); - } else { - img.className = adpt.imgClassName; - } - } - } - }; - - /** - * Overrides getRowValue for custom key value feature - * @param {Object} oRow Row element - * @param {String} sType - * @param {Number} nColumn - * @return {String} - */ - SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { - var stt = this; - // if we have defined a custom getRowValue use that - var sortTypeInfo = stt._sortTypeInfo[sType]; - if (sortTypeInfo && sortTypeInfo.getRowValue) { - return sortTypeInfo.getRowValue(oRow, nColumn); - } - var c = oRow.cells[nColumn]; - var s = SortableTable.getInnerText(c); - return stt.getValueFromString(s, sType); - }; - - /** - * Overrides getInnerText in order to avoid Firefox unexpected sorting - * behaviour with untrimmed text elements - * @param {Object} oNode DOM element - * @return {String} DOM element inner text - */ - SortableTable.getInnerText = function (oNode) { - if (!oNode) { - return; - } - if (oNode.getAttribute(adpt.customKey)) { - return oNode.getAttribute(adpt.customKey); - } else { - return _dom2.default.getText(oNode); - } - }; - } - }, { - key: 'addSortType', - value: function addSortType() { - var args = arguments; - SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); - } - }, { - key: 'setSortTypes', - value: function setSortTypes() { - var _this = this; - - var tf = this.tf, - sortTypes = this.sortTypes, - _sortTypes = []; - - for (var i = 0; i < tf.nbCells; i++) { - var colType = undefined; - - if (sortTypes[i]) { - colType = sortTypes[i].toLowerCase(); - if (colType === 'none') { - colType = 'None'; - } - } else { - // resolve column types - if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { - colType = tf.colNbFormat[i].toLowerCase(); - } else if (tf.hasColDateType && tf.colDateType[i] !== null) { - colType = tf.colDateType[i].toLowerCase() + 'date'; - } else { - colType = 'String'; - } - } - _sortTypes.push(colType); - } - - //Public TF method to add sort type - - //Custom sort types - this.addSortType('number', Number); - this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); - this.addSortType('date', SortableTable.toDate); - this.addSortType('string'); - this.addSortType('us', usNumberConverter); - this.addSortType('eu', euNumberConverter); - this.addSortType('dmydate', dmyDateConverter); - this.addSortType('ymddate', ymdDateConverter); - this.addSortType('mdydate', mdyDateConverter); - this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); - this.addSortType('ipaddress', ipAddress, sortIP); - - this.stt = new SortableTable(tf.tbl, _sortTypes); - - /*** external table headers adapter ***/ - if (this.asyncSort && this.triggerIds.length > 0) { - (function () { - var triggers = _this.triggerIds; - for (var j = 0; j < triggers.length; j++) { - if (triggers[j] === null) { - continue; - } - var trigger = _dom2.default.id(triggers[j]); - if (trigger) { - trigger.style.cursor = 'pointer'; - - _event2.default.add(trigger, 'click', function (evt) { - var elm = evt.target; - if (!_this.tf.sort) { - return; - } - _this.stt.asyncSort(triggers.indexOf(elm.id)); - }); - trigger.setAttribute('_sortType', _sortTypes[j]); - } - } - })(); - } - } - - /** - * Destroy sort - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - this.sorted = false; - this.initialized = false; - this.stt.destroy(); - - var ids = tf.getFiltersId(); - for (var idx = 0; idx < ids.length; idx++) { - var header = tf.getHeaderElement(idx); - var img = _dom2.default.tag(header, 'img'); - - if (img.length === 1) { - header.removeChild(img[0]); - } - } - } - }]); - - return AdapterSortableTable; - })(); - - //Converters - - exports.default = AdapterSortableTable; - function usNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'us'); - } - function euNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'eu'); - } - function dateConverter(s, format) { - return _date2.default.format(s, format); - } - function dmyDateConverter(s) { - return dateConverter(s, 'DMY'); - } - function mdyDateConverter(s) { - return dateConverter(s, 'MDY'); - } - function ymdDateConverter(s) { - return dateConverter(s, 'YMD'); - } - function ddmmmyyyyDateConverter(s) { - return dateConverter(s, 'DDMMMYYYY'); - } - - function ipAddress(value) { - var vals = value.split('.'); - for (var x in vals) { - var val = vals[x]; - while (3 > val.length) { - val = '0' + val; - } - vals[x] = val; - } - return vals.join('.'); - } - - function sortIP(a, b) { - var aa = ipAddress(a.value.toLowerCase()); - var bb = ipAddress(b.value.toLowerCase()); - if (aa == bb) { - return 0; - } else if (aa < bb) { - return -1; - } else { - return 1; - } - } - -/***/ }, - -/***/ 33: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterSortabletable = __webpack_require__(32); - - var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - if (!window.SortableTable) { - __webpack_require__(34); - } // import 'script!sortabletable'; - - exports.default = _adapterSortabletable2.default; - -/***/ }, - -/***/ 34: -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") - -/***/ }, - -/***/ 35: -/***/ function(module, exports) { - - /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra - */ - module.exports = function(src) { - if (typeof execScript === "function") - execScript(src); - else - eval.call(null, src); - } - -/***/ }, - -/***/ 36: -/***/ function(module, exports) { - - module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" - -/***/ } - -}); -//# sourceMappingURL=tf-1.js.map \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),g=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+g?d[l+g]:[u-1]:l-g<=d[0]?d[0]:d[l-g],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var m=l+g;o=m>u-1?d[u-1]:d[m]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-g];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var g=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),g&&g.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(m){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off("after-filtering",function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/src/modules/alternateRows.js b/src/modules/alternateRows.js index a3c06031..76757671 100644 --- a/src/modules/alternateRows.js +++ b/src/modules/alternateRows.js @@ -44,14 +44,19 @@ export class AlternateRows extends Feature { } this.emitter.on('row-processed', - (tf, rowIndex, isValid)=> this.processRow(tf, rowIndex, isValid)); + (tf, rowIndex, isValid)=> this.processRow(rowIndex, isValid)); this.initialized = true; } - processRow(tf, rowIdx, isValid) { console.log(arguments); + /** + * Set/remove row background based on row validation + * @param {Number} rowIdx Row index + * @param {Boolean} isValid Valid row flag + */ + processRow(rowIdx, isValid) { if(isValid){ - this.setRowBg(rowIdx, tf.validRowsIndex.length); + this.setRowBg(rowIdx, this.tf.validRowsIndex.length); } else { this.removeRowBg(rowIdx); } @@ -102,7 +107,7 @@ export class AlternateRows extends Feature { } this.emitter.off('row-processed', - (tf, rowIndex, isValid)=> this.processRow(tf, rowIndex, isValid)); + (tf, rowIndex, isValid)=> this.processRow(rowIndex, isValid)); this.initialized = false; } diff --git a/src/tablefilter.js b/src/tablefilter.js index 0833d28d..8b69d106 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -129,7 +129,7 @@ export class TableFilter { //stores filters values this.searchArgs = null; //stores valid rows indexes (rows visible upon filtering) - this.validRowsIndex = null; + this.validRowsIndex = []; //stores filters row element this.fltGridEl = null; //is first load boolean @@ -1249,7 +1249,7 @@ export class TableFilter { Dom.removeClass(this.tbl, this.prfxTf); this.nbHiddenRows = 0; - this.validRowsIndex = null; + this.validRowsIndex = []; this.activeFlt = null; this._hasGrid = false; this.tbl = null; @@ -1850,21 +1850,21 @@ export class TableFilter { // Mod.alternateRows.removeRowBg(k); // } // always visible rows need to be counted as valid - if(this.hasVisibleRows && this.visibleRows.indexOf(k) !== -1){ - this.validRowsIndex.push(k); - } else { - hiddenrows++; - } + // if(this.hasVisibleRows && this.visibleRows.indexOf(k) !==-1){ + // this.validRowsIndex.push(k); + // } else { + // hiddenrows++; + // } + hiddenrows++; } else { this.validateRow(k, true); - this.validRowsIndex.push(k); + // this.validRowsIndex.push(k); // if(this.alternateRows){ // Mod.alternateRows.setRowBg(k, this.validRowsIndex.length); // } - if(this.onRowValidated){ - this.onRowValidated.call(null, this, k); - } - this.emitter.emit('row-validated', this, k); + // if(this.onRowValidated){ + // this.onRowValidated.call(null, this, k); + // } } this.emitter.emit('row-processed', this, k, isRowValid); }// for k @@ -2204,6 +2204,18 @@ export class TableFilter { if(this.paging){ row.setAttribute('validRow', validFlag); } + + if(isValid){ + if(this.validRowsIndex.indexOf(rowIndex) === -1){ + this.validRowsIndex.push(rowIndex); + } + + if(this.onRowValidated){ + this.onRowValidated.call(null, this, rowIndex); + } + + this.emitter.emit('row-validated', this, rowIndex); + } } /** @@ -2216,7 +2228,7 @@ export class TableFilter { this.validRowsIndex = []; for(let k=this.refRow; k Date: Thu, 31 Dec 2015 15:20:51 +1100 Subject: [PATCH 10/41] Fixed unit tests --- dist/starter.html | 514 ++++++++++++++++++ dist/tablefilter/style/colsVisibility.css | 4 +- dist/tablefilter/style/filtersVisibility.css | 4 +- dist/tablefilter/style/tablefilter.css | 4 +- .../style/themes/default/default.css | 4 +- .../style/themes/mytheme/mytheme.css | 4 +- .../style/themes/skyblue/skyblue.css | 4 +- dist/tablefilter/tablefilter.js | 8 +- dist/tablefilter/tf-1.js | 4 +- package.json | 2 +- src/modules/alternateRows.js | 2 +- src/tablefilter.js | 17 - 12 files changed, 534 insertions(+), 37 deletions(-) create mode 100644 dist/starter.html diff --git a/dist/starter.html b/dist/starter.html new file mode 100644 index 00000000..52a62918 --- /dev/null +++ b/dist/starter.html @@ -0,0 +1,514 @@ + + + + tablefilter v0.1.2 - Starter + + +

tablefilter v0.1.2

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
countryisoyearPOPXRATPPPcgdpccci
BeninBEN19985950.33589.9517822190.951178.4690.987.55
BeninBEN19996109.53615.6990967200.191174.9092.617.86
BeninBEN20006272.00711.9763184200.611224.7492.278.25
Burkina FasoBFA19949755.03555.2047119125.76838.7679.816.57
Burkina FasoBFA19959988.00499.148407136.65860.8980.419.29
Burkina FasoBFA199610225.00511.5523987144.18881.1180.4012.12
Burkina FasoBFA199710473.53583.6693726141.78899.0176.9414.94
RussiaRUS1998146899.019.7050828932.647086.3967.739.20
RussiaRUS1999146308.9924.61993984.038074.7057.358.81
RussiaRUS2000145555.0128.129169464.859995.9154.748.79
RwandaRWA19946230.00194.51750.39529.48132.164.48
RwandaRWA19956400.00262.197509870.67746.3492.773.08
RwandaRWA19966727.00306.820007377.90823.2589.713.21
RwandaRWA19977895.18301.529785284.13847.7991.443.72
RwandaRWA19988105.00312.314086985.32914.2289.344.22
El SalvadorSLV19955669.008.7545833593.544143.5989.3110.35
El SalvadorSLV19965798.008.7550001143.694235.7988.777.79
El SalvadorSLV19975911.008.7562503813.744408.4187.057.90
Slovak RepublicSVK20005401.0046.035213.0212618.5352.2224.78
SloveniaSVN19941988.90128.808593879.9711662.1253.2119.87
SloveniaSVN19951990.00118.518501389.0312574.9654.4623.11
SloveniaSVN19961991.00135.364303697.2713151.5154.3223.23
SloveniaSVN19971985.96159.6882935103.9614143.0253.2424.14
SloveniaSVN19981982.60166.134201108.9315067.3452.8225.35
ZambiaZMB19948740.72669.3706055307.48834.1975.439.86
ZambiaZMB19958980.00864.1192017402.40829.3776.5510.31
ZambiaZMB19969214.401207.900024515.01838.0578.7410.99
ZambiaZMB19979443.211314.498047596.97851.4777.5912.15
ZambiaZMB19989665.711862.06897744.91800.6985.1213.75
ZambiaZMB19999881.212388.019043941.87765.2491.8215.30
ZambiaZMB200010089.003110.8439941157.63840.9786.3315.38
ZimbabweZWE199410775.358.1515388492.012586.8460.1018.53
ZimbabweZWE199511011.008.665375712.152603.3766.8915.03
ZimbabweZWE199611242.1610.002349852.642860.2372.0611.32
ZimbabweZWE199711923.5212.111289983.172727.0682.8211.01
ZimbabweZWE199812153.8523.679109574.062799.8577.6610.75
ZimbabweZWE199912388.3238.301200876.122770.4876.8910.73
ZimbabweZWE200012627.0044.417919169.482607.0369.238.62
+ + + + + + +

+
+
+
+
+
+
+
+
+
diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index 2eb02459..757c4a04 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-31T01:55:02.158Z 
+ *	 tablefilter v0.1.2 by Max Guglielmi 
+ *	 build date: 2015-12-31T04:17:24.962Z 
  *	 MIT License  
  */ 
 span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
\ No newline at end of file
diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css
index 3c580f6a..2da333c4 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-31T01:55:02.158Z 
+ *	 tablefilter v0.1.2 by Max Guglielmi 
+ *	 build date: 2015-12-31T04:17:24.962Z 
  *	 MIT License  
  */ 
 span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
\ No newline at end of file
diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css
index 7713bc69..24ce5b6e 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-31T01:55:02.158Z 
+ *	 tablefilter v0.1.2 by Max Guglielmi 
+ *	 build date: 2015-12-31T04:17:24.962Z 
  *	 MIT License  
  */ 
 .activeHeader{background-color:#66afe9 !important;color:#fff !important}
diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css
index e2a792f1..73c88bc8 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-31T01:55:02.158Z 
+ *	 tablefilter v0.1.2 by Max Guglielmi 
+ *	 build date: 2015-12-31T04:17:24.962Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css
index f74cb79a..ed67e349 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-31T01:55:02.158Z 
+ *	 tablefilter v0.1.2 by Max Guglielmi 
+ *	 build date: 2015-12-31T04:17:24.962Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css
index 86fe35d7..0f6e410a 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.1 by Max Guglielmi 
- *	 build date: 2015-12-31T01:55:02.158Z 
+ *	 tablefilter v0.1.2 by Max Guglielmi 
+ *	 build date: 2015-12-31T04:17:24.962Z 
  *	 MIT License  
  */ 
 table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
index 56b7322e..9e588dde 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -1,10 +1,10 @@
 /** 
- *	 tablefilter v0.1.1 by Max Guglielmi
- *	 build date: 2015-12-31T01:55:02.086Z 
+ *	 tablefilter v0.1.2 by Max Guglielmi
+ *	 build date: 2015-12-31T04:17:24.900Z 
  *	 MIT License  
  */ 
 
-!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var a=s[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var n,r,o=0,h=[];on;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.1",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":a(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),a=s._ezEditTable;s.cfg.editable&&a.Editable.Remove(),s.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,a,l);break;case e.checklist:r.checkList._build(s,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,a=i.slcExternal,l=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,a=t.path,l=void 0;s&&a?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var a=[i(26)("./"+l)];(function(i){var a=new i["default"](e,t);a.init(),e.ExtRegistry[s]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],a=this.ExtRegistry[s.name];a&&(a.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var a=t[i],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],a=u["default"].id(s);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],a=[],l=i.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(a.sort(),s.sort()),[a,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(i)),""!==a&&s.highlightKeyword.highlight(i,a,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=a(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)s=l<=a(t.replace(r,""),n);else if(T)s=l>=a(t.replace(o,""),n);else if(u)s=la(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,a=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.popupFilters&&s.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),a++),this.emitter.emit("row-processed",this,x,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d; +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var a=s[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var n,r,o=0,h=[];on;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.2",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":a(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),a=s._ezEditTable;s.cfg.editable&&a.Editable.Remove(),s.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,a,l);break;case e.checklist:r.checkList._build(s,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,a=i.slcExternal,l=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,a=t.path,l=void 0;s&&a?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var a=[i(26)("./"+l)];(function(i){var a=new i["default"](e,t);a.init(),e.ExtRegistry[s]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],a=this.ExtRegistry[s.name];a&&(a.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var a=t[i],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],a=u["default"].id(s);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],a=[],l=i.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(a.sort(),s.sort()),[a,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(i)),""!==a&&s.highlightKeyword.highlight(i,a,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=a(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)s=l<=a(t.replace(r,""),n);else if(T)s=l>=a(t.replace(o,""),n);else if(u)s=la(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,a=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.popupFilters&&s.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),a++),this.emitter.emit("row-processed",this,x,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d; l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var a=0,l=i.options.length;l>a;a++)i.options[a].selected&&(e=e.concat(i.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,a=this.fltIds.length;a>s;s++){var l=this.getFilterType(s);if(l===f["default"].lower(t)){var n=e?s:this.fltIds[s];i.push(n)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sn;n++){var o=this.getCellData(l[n]);a[1].push(o)}i.push(a)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),a=0;aa;a++){var n=i[a],r=n[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",a=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",a),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),a=s.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=s[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=i[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("cleared-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=s.length;r>n;n++){var o=u["default"].id(this.fltIds[s[n]]);if(l=this.getFilterValue(s[n]),a!==s[n]||this.paging&&-1!=t.indexOf(s[n])&&a===s[n]||!this.paging&&(-1!=i.indexOf(s[n])||-1!=e.indexOf(s[n]))||l===this.displayAllText){if(-1!=i.indexOf(s[n])?this.Mod.checkList.checkListDiv[s[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[n])?this.Mod.checkList._build(s[n]):this.Mod.dropdown._build(s[n],!0),this.setFilterValue(s[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,a=i[s];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",a="script"==s?"src":"href",l=u["default"].tag(H,s),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var a=s?s:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var a=0;a0){var s=document.cookie,a=s.indexOf(i);if(-1!==a){a+=i.length;var l=s.indexOf(";",a);-1===l&&(l=s.length),e=unescape(s.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,a=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0])}return a}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,a=parseInt(s.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,i,s,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var i=0;i_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,a=this.addTChecks(t,e),l=[],n=s.feature("store"),o=n?n.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),l=a+s.pagingLength-1<=e.nbVisibleRows?a+s.pagingLength-1:e.nbVisibleRows;i=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var a=i.refRow,r=i.nbRows;i.nbPages=Math.ceil((r-a)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,i=e.tbl.rows,s=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id); -if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(s.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=s[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&i&&i.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&i&&i.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":a(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),a=d["default"].id(this.prfxBtnLastSpan+e.id),l=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),a&&(b["default"].remove(a,"click",h.last),d["default"].remove(a)),l&&(b["default"].remove(l,"click",h.first),d["default"].remove(l)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var a=i.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ir;r++){var o=s?r:i[r];this.setRowBg(o,n),n++}this.emitter.on("row-processed",function(e,i,s){return t.processRow(i,s)}),this.initialized=!0}}},{key:"processRow",value:function(t,e){e?this.setRowBg(t,this.tf.validRowsIndex.length):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file +if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(s.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=s[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&i&&i.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&i&&i.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":a(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),a=d["default"].id(this.prfxBtnLastSpan+e.id),l=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),a&&(b["default"].remove(a,"click",h.last),d["default"].remove(a)),l&&(b["default"].remove(l,"click",h.first),d["default"].remove(l)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var a=i.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ir;r++){var o=s?r:i[r];this.setRowBg(o,n),n++}this.emitter.on("row-processed",function(e,i,s){return t.processRow(i,s)}),this.initialized=!0}}},{key:"processRow",value:function(t,e){e?this.setRowBg(t,this.tf.validRowsIndex.length):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 4101f405..42e6757d 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.1 by Max Guglielmi - * build date: 2015-12-31T01:55:02.086Z + * tablefilter v0.1.2 by Max Guglielmi + * build date: 2015-12-31T04:17:24.900Z * MIT License */ diff --git a/package.json b/package.json index ff4687b3..6f2b576b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tablefilter", - "version": "0.1.1", + "version": "0.1.2", "description": "A Javascript library making HTML tables filterable and a bit more", "license": "MIT", "author": { diff --git a/src/modules/alternateRows.js b/src/modules/alternateRows.js index 76757671..6f4ad86e 100644 --- a/src/modules/alternateRows.js +++ b/src/modules/alternateRows.js @@ -27,7 +27,7 @@ export class AlternateRows extends Feature { var tf = this.tf; var validRowsIndex = tf.validRowsIndex; - var noValidRowsIndex = validRowsIndex===null; + var noValidRowsIndex = validRowsIndex.length === 0; //1st index var beginIndex = noValidRowsIndex ? tf.refRow : 0; // nb indexes diff --git a/src/tablefilter.js b/src/tablefilter.js index 8b69d106..94190129 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -1846,25 +1846,9 @@ export class TableFilter { if(!isRowValid){ this.validateRow(k, false); - // if(Mod.alternateRows){ - // Mod.alternateRows.removeRowBg(k); - // } - // always visible rows need to be counted as valid - // if(this.hasVisibleRows && this.visibleRows.indexOf(k) !==-1){ - // this.validRowsIndex.push(k); - // } else { - // hiddenrows++; - // } hiddenrows++; } else { this.validateRow(k, true); - // this.validRowsIndex.push(k); - // if(this.alternateRows){ - // Mod.alternateRows.setRowBg(k, this.validRowsIndex.length); - // } - // if(this.onRowValidated){ - // this.onRowValidated.call(null, this, k); - // } } this.emitter.emit('row-processed', this, k, isRowValid); }// for k @@ -2228,7 +2212,6 @@ export class TableFilter { this.validRowsIndex = []; for(let k=this.refRow; k Date: Thu, 31 Dec 2015 15:23:24 +1100 Subject: [PATCH 11/41] Uncommented line in unit test --- test/test-always-visible-rows.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-always-visible-rows.js b/test/test-always-visible-rows.js index 1c04121b..e5229031 100644 --- a/test/test-always-visible-rows.js +++ b/test/test-always-visible-rows.js @@ -108,7 +108,7 @@ 'Row display for alwaysVisibleRow2' ); - //tf.destroy(); + tf.destroy(); }); } From 9964032b88e57c7fc9c27480d3c9532f740980b0 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Sat, 2 Jan 2016 14:43:00 +1100 Subject: [PATCH 12/41] Added cell-processed event, improved alternateRows --- dist/starter.html | 4 +- dist/tablefilter/style/colsVisibility.css | 4 +- dist/tablefilter/style/filtersVisibility.css | 4 +- dist/tablefilter/style/tablefilter.css | 4 +- .../style/themes/default/default.css | 4 +- .../style/themes/mytheme/mytheme.css | 4 +- .../style/themes/skyblue/skyblue.css | 4 +- dist/tablefilter/tablefilter.js | 12 ++--- dist/tablefilter/tf-1.js | 8 +-- package.json | 2 +- src/extensions/sort/adapterSortabletable.js | 39 ++------------ src/modules/alternateRows.js | 33 ++++++++---- src/modules/paging.js | 30 ++--------- src/modules/popupFilter.js | 6 ++- src/tablefilter.js | 50 +++++++++-------- test/test-loader.js | 4 -- test/test-popup-filter.js | 54 +++++++++++++++++++ 17 files changed, 143 insertions(+), 123 deletions(-) diff --git a/dist/starter.html b/dist/starter.html index 52a62918..3a4514b3 100644 --- a/dist/starter.html +++ b/dist/starter.html @@ -1,10 +1,10 @@ - tablefilter v0.1.2 - Starter + tablefilter v0.1.3 - Starter -

tablefilter v0.1.2

+

tablefilter v0.1.3

diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 757c4a04..c0dca7c7 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.2 by Max Guglielmi - * build date: 2015-12-31T04:17:24.962Z + * tablefilter v0.1.3 by Max Guglielmi + * build date: 2016-01-02T03:37:45.442Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 2da333c4..14c64b57 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.2 by Max Guglielmi - * build date: 2015-12-31T04:17:24.962Z + * tablefilter v0.1.3 by Max Guglielmi + * build date: 2016-01-02T03:37:45.442Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 24ce5b6e..2f351ed7 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.2 by Max Guglielmi - * build date: 2015-12-31T04:17:24.962Z + * tablefilter v0.1.3 by Max Guglielmi + * build date: 2016-01-02T03:37:45.442Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 73c88bc8..646fa406 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.2 by Max Guglielmi - * build date: 2015-12-31T04:17:24.962Z + * tablefilter v0.1.3 by Max Guglielmi + * build date: 2016-01-02T03:37:45.442Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index ed67e349..6a71af8e 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.2 by Max Guglielmi - * build date: 2015-12-31T04:17:24.962Z + * tablefilter v0.1.3 by Max Guglielmi + * build date: 2016-01-02T03:37:45.442Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 0f6e410a..350f86c3 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.2 by Max Guglielmi - * build date: 2015-12-31T04:17:24.962Z + * tablefilter v0.1.3 by Max Guglielmi + * build date: 2016-01-02T03:37:45.442Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 9e588dde..b592b6b4 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,10 @@ /** - * tablefilter v0.1.2 by Max Guglielmi - * build date: 2015-12-31T04:17:24.900Z + * tablefilter v0.1.3 by Max Guglielmi + * build date: 2016-01-02T03:37:45.348Z * MIT License */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var a=s[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var n,r,o=0,h=[];on;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.2",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":a(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),a=s._ezEditTable;s.cfg.editable&&a.Editable.Remove(),s.cfg.selection&&a.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var a=void 0;if(!this.gridLayout){var l=u["default"].tag(this.tbl,"thead");a=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,a.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(a.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||a.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.loader&&e.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,a,l);break;case e.checklist:r.checkList._build(s,a,l);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,a=i.slcExternal,l=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,a=t.path,l=void 0;s&&a?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var a=[i(26)("./"+l)];(function(i){var a=new i["default"](e,t);a.init(),e.ExtRegistry[s]=a}).apply(null,a)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],a=this.ExtRegistry[s.name];a&&(a.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var a=t[i],l=a.name,n=a.path,r=this.prfxTf+l;l&&!n?n=this.themesPath+l+"/"+l+".css":!l&&a.path&&(l="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],a=u["default"].id(s);a&&(a.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],a=[],l=i.indexOf(t),n=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=n.length;u>h;h++)a.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(a.sort(),s.sort()),[a,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var a=0;ah;h++)""!==l[h]&&(n=u["default"].createOpt(l[h],l[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[a];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[a]],["colIndex",a]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[a]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[a].split(" "+this.orOperator+" ");for(var h=0,d=l.length;d>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[a]+"_"+(h+1),l[h],l[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var a=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(a=u["default"].getText(i)),""!==a&&s.highlightKeyword.highlight(i,a,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,a=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=a(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=a(e,"us"),n="us"):(l=a(e,"eu"),n="eu"),x)s=l<=a(t.replace(r,""),n);else if(T)s=l>=a(t.replace(o,""),n);else if(u)s=la(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,a=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.popupFilters&&s.popupFilter.buildIcon(I,!0),this.markActiveColumns&&x===this.refRow&&(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,I),u["default"].addClass(this.getHeaderElement(I),this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,I))}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),a++),this.emitter.emit("row-processed",this,x,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=a,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var a=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n));var o=a[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===a[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d; -l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var a=0,l=i.options.length;l>a;a++)i.options[a].selected&&(e=e.concat(i.options[a].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,a=this.fltIds.length;a>s;s++){var l=this.getFilterType(s);if(l===f["default"].lower(t)){var n=e?s:this.fltIds[s];i.push(n)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sn;n++){var o=this.getCellData(l[n]);a[1].push(o)}i.push(a)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),a=0;aa;a++){var n=i[a],r=n[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",a=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",a),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===a||""===a[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(a,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),a=s.length>0,l=a?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;a?r=s[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),l.appendChild(r)),r.style.width=i[n]}a||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("cleared-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var a=this.activeFilterId.split("_")[0];a=a.split(this.prfxFlt)[1];for(var l=void 0,n=0,r=s.length;r>n;n++){var o=u["default"].id(this.fltIds[s[n]]);if(l=this.getFilterValue(s[n]),a!==s[n]||this.paging&&-1!=t.indexOf(s[n])&&a===s[n]||!this.paging&&(-1!=i.indexOf(s[n])||-1!=e.indexOf(s[n]))||l===this.displayAllText){if(-1!=i.indexOf(s[n])?this.Mod.checkList.checkListDiv[s[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[n])?this.Mod.checkList._build(s[n]):this.Mod.dropdown._build(s[n],!0),this.setFilterValue(s[n],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,a=i[s];if(!this.gridLayout)if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else a.parentNode.insertBefore(this.fltGridEl,a);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",a="script"==s?"src":"href",l=u["default"].tag(H,s),n=0,r=l.length;r>n;n++)if(void 0!==l[n][a]&&l[n][a].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var a=s?s:"script",l=this.isImported(e,a);if(!l){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(a)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var a=0;a0){var s=document.cookie,a=s.indexOf(i);if(-1!==a){a+=i.length;var l=s.indexOf(";",a);-1===l&&(l=s.length),e=unescape(s.substring(a,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,a=0;a2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,a=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,a=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,a=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,a=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&a.test(t)===!1)return!1;var l=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var a=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),a=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),a=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),a=new Date(i(l[2]),l[1]-1,l[0])}return a}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,a=parseInt(s.getAttribute("ci"),10);if(this.closeAll(a),this.toggle(a),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[a],n=this.tf.getHeaderElement(a),r=.95*n.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&a.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!a.paging||a.paging&&(!a.validRowsIndex||a.validRowsIndex&&-1!=a.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=a.validRowsIndex.indexOf(m)))){var w=a.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&a.disableExcludedOptions){var k=b[C];k||(k=a.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=a.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(a.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,i,s,a,l){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==a[t]&&c===a[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(l,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==l.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var a=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(a)}if(e.enableNonEmptyOption){var l=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var a=i(3),l=s(a);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=function(){function t(t,e){for(var i=0;i_;_++)if(t===_&&(!a.linkedFilters||a.linkedFilters&&a.disableExcludedOptions)||t===_&&a.linkedFilters&&(""===u[v].style.display&&!a.paging||a.paging&&(!f||f===t||f!=t&&-1!=a.validRowsIndex.indexOf(v)))){var y=a.getCellData(b[_]),C=d["default"].matchCase(y,a.matchCase);h["default"].has(this.opts,C,a.matchCase)||this.opts.push(y);var w=p[_];a.linkedFilters&&a.disableExcludedOptions&&(w||(w=a.getFilteredDataCol(_)),h["default"].has(w,C,a.matchCase)||h["default"].has(this.excludedOpts,C,a.matchCase)||a.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=a.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(a.sortSlc&&!this.isCustom&&(a.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),a.sortNumAsc&&-1!=a.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(a.sortNumDesc&&-1!=a.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,a.separator),a.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,a=this.addTChecks(t,e),l=[],n=s.feature("store"),o=n?n.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?l.push(o):l=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),l=a+s.pagingLength-1<=e.nbVisibleRows?a+s.pagingLength-1:e.nbVisibleRows;i=a+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var a=i.refRow,r=i.nbRows;i.nbPages=Math.ceil((r-a)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var a=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)a.innerHTML=this.btnNextPageHtml,b["default"].add(a,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),a.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(a),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],e=this.tf,i=e.tbl.rows,s=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,a=d["default"].id(this.prfxPgSpan+e.id); -if(e.validRowsIndex=t,0===t.length)for(var l=e.refRow;l0)if(s.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var o=0;on;n++){var o=e.validRowsIndex[n],h=s[o],u=h.getAttribute("validRow");n>=a&&l>n?((c["default"].isNull(u)||Boolean("true"===u))&&(h.style.display=""),e.alternateRows&&i&&i.setRowBg(o,n)):(h.style.display="none",e.alternateRows&&i&&i.removeRowBg(o))}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":a(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var a=this.resultsPerPage[0],l=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(a));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),a=d["default"].id(this.prfxBtnLastSpan+e.id),l=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),a&&(b["default"].remove(a,"click",h.last),d["default"].remove(a)),l&&(b["default"].remove(l,"click",h.first),d["default"].remove(l)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var a=i.firstChild;f["default"].add(a,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),f["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var a=this.tgtId?u["default"].id(this.tgtId):e.rDiv;a.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ir;r++){var o=s?r:i[r];this.setRowBg(o,n),n++}this.emitter.on("row-processed",function(e,i,s){return t.processRow(i,s)}),this.initialized=!0}}},{key:"processRow",value:function(t,e){e?this.setRowBg(t,this.tf.validRowsIndex.length):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var l=s[i]={exports:{},id:i,loaded:!1};return t[i].call(l.exports,l,l.exports,e),l.loaded=!0,l.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,a){for(var n,r,o=0,h=[];on;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.3",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":l(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),l=s._ezEditTable;s.cfg.editable&&l.Editable.Remove(),s.cfg.selection&&l.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var l=void 0;if(!this.gridLayout){var a=u["default"].tag(this.tbl,"thead");l=a.length>0?a[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,l.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(l.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||l.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.emitter.on("cell-processed",function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,l,a);break;case e.checklist:r.checkList._build(s,l,a);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,l=i.slcExternal,a=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,l=t.path,a=void 0;s&&l?a=t.path+s:(s=s.replace(".js",""),a="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var l=[i(26)("./"+a)];(function(i){var l=new i["default"](e,t);l.init(),e.ExtRegistry[s]=l}).apply(null,l)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],l=this.ExtRegistry[s.name];l&&(l.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var l=t[i],a=l.name,n=l.path,r=this.prfxTf+a;a&&!n?n=this.themesPath+a+"/"+a+".css":!a&&l.path&&(a="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()}),this.emitter.off("cell-processed",function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],l=u["default"].id(s);l&&(l.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],l=[],a=i.indexOf(t),n=e.values[a],r=e.texts[a],o=e.sorts[a],h=0,u=n.length;u>h;h++)l.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(l.sort(),s.sort()),[l,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var l=0;lh;h++)""!==a[h]&&(n=u["default"].createOpt(a[h],a[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[l];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[l]],["colIndex",l]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[l]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),a=e[l].split(" "+this.orOperator+" ");for(var h=0,d=a.length;d>h;h++)if(""!==a[h]){var v=u["default"].createCheckItem(this.fltIds[l]+"_"+(h+1),a[h],a[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var l=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(l=u["default"].getText(i)),""!==l&&s.highlightKeyword.highlight(i,l,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,l=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(a=l(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=l(e,"us"),n="us"):(a=l(e,"eu"),n="eu"),x)s=a<=l(t.replace(r,""),n);else if(T)s=a>=l(t.replace(o,""),n);else if(u)s=al(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,l=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var a,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,k[I])}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),l++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=l,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var l=this.tbl.rows,a=[];e&&a.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n));var o=l[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===l[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;a.push(c)}}return a; +}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var l=0,a=i.options.length;a>l;l++)i.options[l].selected&&(e=e.concat(i.options[l].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,l=this.fltIds.length;l>s;s++){var a=this.getFilterType(s);if(a===f["default"].lower(t)){var n=e?s:this.fltIds[s];i.push(n)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sn;n++){var o=this.getCellData(a[n]);l[1].push(o)}i.push(l)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),l=0;ll;l++){var n=i[l],r=n[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",l=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",l),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;ta;a++){var r=i.options[a];(""===l||""===l[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(l,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),l=s.length>0,a=l?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;l?r=s[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),a.appendChild(r)),r.style.width=i[n]}l||e.insertBefore(a,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("cleared-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var l=this.activeFilterId.split("_")[0];l=l.split(this.prfxFlt)[1];for(var a=void 0,n=0,r=s.length;r>n;n++){var o=u["default"].id(this.fltIds[s[n]]);if(a=this.getFilterValue(s[n]),l!==s[n]||this.paging&&-1!=t.indexOf(s[n])&&l===s[n]||!this.paging&&(-1!=i.indexOf(s[n])||-1!=e.indexOf(s[n]))||a===this.displayAllText){if(-1!=i.indexOf(s[n])?this.Mod.checkList.checkListDiv[s[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[n])?this.Mod.checkList._build(s[n]):this.Mod.dropdown._build(s[n],!0),this.setFilterValue(s[n],a)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,l=i[s];if(!this.gridLayout)if(e.tHead){var a=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,a)}else l.parentNode.insertBefore(this.fltGridEl,l);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",l="script"==s?"src":"href",a=u["default"].tag(H,s),n=0,r=a.length;r>n;n++)if(void 0!==a[n][l]&&a[n][l].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var l=s?s:"script",a=this.isImported(e,l);if(!a){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(l)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var l=0;l0){var s=document.cookie,l=s.indexOf(i);if(-1!==l){l+=i.length;var a=s.indexOf(";",l);-1===a&&(a=s.length),e=unescape(s.substring(l,a))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var l=i(3),a=s(l);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,l=0;l2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,l=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,l=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,l=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,l=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&l.test(t)===!1)return!1;var a=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?a[0]:"M"===e.substring(1,2)?a[1]:a[2],r="D"===e.substring(0,1)?a[0]:"D"===e.substring(1,2)?a[1]:a[2],o="Y"===e.substring(0,1)?a[0]:"Y"===e.substring(1,2)?a[1]:a[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var l=void 0,a=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),l=new Date(i(a[2]),s(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(i(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(i(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),l=new Date(i(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(i(a[2]),a[1]-1,a[0])}return l}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var l=i(3),a=s(l);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===a["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,l=parseInt(s.getAttribute("ci"),10);if(this.closeAll(l),this.toggle(l),this.popUpFltAdjustToContainer){var a=this.popUpFltElms[l],n=this.tf.getHeaderElement(l),r=.95*n.clientWidth;a.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&l.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!l.paging||l.paging&&(!l.validRowsIndex||l.validRowsIndex&&-1!=l.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=l.validRowsIndex.indexOf(m)))){var w=l.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&l.disableExcludedOptions){var k=b[C];k||(k=l.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=l.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(l.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),l.sortNumAsc&&-1!=l.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&-1!=l.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,i,s,l,a){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==l[t]&&c===l[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(a,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==a.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var l=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(l)}if(e.enableNonEmptyOption){var a=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(a)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var l=i(3),a=s(l);e["default"]={ignoreCase:function(t,e){var i=a["default"].lower(t),s=a["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var i=0;i_;_++)if(t===_&&(!l.linkedFilters||l.linkedFilters&&l.disableExcludedOptions)||t===_&&l.linkedFilters&&(""===u[v].style.display&&!l.paging||l.paging&&(!f||f===t||f!=t&&-1!=l.validRowsIndex.indexOf(v)))){var y=l.getCellData(b[_]),C=d["default"].matchCase(y,l.matchCase);h["default"].has(this.opts,C,l.matchCase)||this.opts.push(y);var w=p[_];l.linkedFilters&&l.disableExcludedOptions&&(w||(w=l.getFilteredDataCol(_)),h["default"].has(w,C,l.matchCase)||h["default"].has(this.excludedOpts,C,l.matchCase)||l.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=l.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(l.sortSlc&&!this.isCustom&&(l.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),l.sortNumAsc&&-1!=l.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&-1!=l.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,l.separator),l.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,l=this.addTChecks(t,e),a=[],n=s.feature("store"),o=n?n.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?a.push(o):a=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),a=l+s.pagingLength-1<=e.nbVisibleRows?l+s.pagingLength-1:e.nbVisibleRows;i=l+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var l=i.refRow,r=i.nbRows;i.nbPages=Math.ceil((r-l)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var l=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),a=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)l.innerHTML=this.btnNextPageHtml,b["default"].add(l,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),l.appendChild(o)}if(this.btnPrevPageHtml)a.innerHTML=this.btnPrevPageHtml,b["default"].add(a,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),a.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(a);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(l),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf; +e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,s=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var l=0;la;a++){var r=e.validRowsIndex[a],o=i[r],h=o.getAttribute("validRow"),u=!1;a>=s&&l>a?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,a,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":l(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var l=this.resultsPerPage[0],a=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(l));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),l=d["default"].id(this.prfxBtnLastSpan+e.id),a=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),l&&(b["default"].remove(l,"click",h.last),d["default"].remove(l)),a&&(b["default"].remove(a,"click",h.first),d["default"].remove(a)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var l=i.firstChild;f["default"].add(l,"click",function(){t.onClick()})}else{var a=u["default"].create("a",["href","javascript:void(0);"]);a.className=e.btnResetCssClass,a.appendChild(u["default"].text(this.btnResetText)),i.appendChild(a),f["default"].add(a,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var l=this.tgtId?u["default"].id(this.tgtId):e.rDiv;l.appendChild(i);var a=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),a.appendChild(s)}else{a.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&a.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;in;n++){var r=i?n:e[n];this.setRowBg(r,a),a++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 42e6757d..ad70a2a7 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,8 +1,8 @@ /** - * tablefilter v0.1.2 by Max Guglielmi - * build date: 2015-12-31T04:17:24.900Z + * tablefilter v0.1.3 by Max Guglielmi + * build date: 2016-01-02T03:37:45.348Z * MIT License */ -webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),g=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+g?d[l+g]:[u-1]:l-g<=d[0]?d[0]:d[l-g],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var m=l+g;o=m>u-1?d[u-1]:d[m]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-g];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var g=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),g&&g.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(m){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off("after-filtering",function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off("after-filtering",function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/package.json b/package.json index 6f2b576b..eeb83dac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tablefilter", - "version": "0.1.2", + "version": "0.1.3", "description": "A Javascript library making HTML tables filterable and a bit more", "license": "MIT", "author": { diff --git a/src/extensions/sort/adapterSortabletable.js b/src/extensions/sort/adapterSortabletable.js index d5f7b19c..004cd6e8 100644 --- a/src/extensions/sort/adapterSortabletable.js +++ b/src/extensions/sort/adapterSortabletable.js @@ -46,6 +46,7 @@ export default class AdapterSortableTable{ opts.on_after_sort : null; this.tf = tf; + this.emitter = this.tf.emitter; } init(){ @@ -85,42 +86,6 @@ export default class AdapterSortableTable{ this.stt.onsort = function(){ adpt.sorted = true; - //rows alternating bg issue - // TODO: move into AlternateRows component - if(tf.alternateRows){ - let rows = tf.tbl.rows, c = 0; - - let setClass = function(row, i, removeOnly){ - if(Types.isUndef(removeOnly)){ - removeOnly = false; - } - let altRows = tf.feature('alternateRows'), - oddCls = altRows.oddCss, - evenCls = altRows.evenCss; - Dom.removeClass(row, oddCls); - Dom.removeClass(row, evenCls); - - if(!removeOnly){ - Dom.addClass(row, i % 2 ? oddCls : evenCls); - } - }; - - for (let i = tf.refRow; i < tf.nbRows; i++){ - let isRowValid = rows[i].getAttribute('validRow'); - if(tf.paging && rows[i].style.display === ''){ - setClass(rows[i], c); - c++; - } else { - if((isRowValid==='true' || isRowValid===null) && - rows[i].style.display === ''){ - setClass(rows[i], c); - c++; - } else { - setClass(rows[i], c, true); - } - } - } - } //sort behaviour for paging if(tf.paging){ let paginator = tf.feature('paging'); @@ -133,6 +98,8 @@ export default class AdapterSortableTable{ if(adpt.onAfterSort){ adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); } + + adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn); }; this.initialized = true; diff --git a/src/modules/alternateRows.js b/src/modules/alternateRows.js index 6f4ad86e..3afacd15 100644 --- a/src/modules/alternateRows.js +++ b/src/modules/alternateRows.js @@ -25,8 +25,23 @@ export class AlternateRows extends Feature { return; } + this.processAll(); + + this.emitter.on('row-processed', (tf, rowIndex, arrIndex, isValid)=> + this.processRow(rowIndex, arrIndex, isValid)); + this.emitter.on('row-paged', (tf, rowIndex, arrIndex, isValid)=> + this.processRow(rowIndex, arrIndex, isValid)); + this.emitter.on('column-sorted', ()=> this.processAll()); + + this.initialized = true; + } + + processAll() { + if(!this.isEnabled()){ + return; + } var tf = this.tf; - var validRowsIndex = tf.validRowsIndex; + var validRowsIndex = tf.getValidRows(true); var noValidRowsIndex = validRowsIndex.length === 0; //1st index var beginIndex = noValidRowsIndex ? tf.refRow : 0; @@ -42,11 +57,6 @@ export class AlternateRows extends Feature { this.setRowBg(rowIdx, idx); idx++; } - - this.emitter.on('row-processed', - (tf, rowIndex, isValid)=> this.processRow(rowIndex, isValid)); - - this.initialized = true; } /** @@ -54,9 +64,9 @@ export class AlternateRows extends Feature { * @param {Number} rowIdx Row index * @param {Boolean} isValid Valid row flag */ - processRow(rowIdx, isValid) { + processRow(rowIdx, arrIdx, isValid) { if(isValid){ - this.setRowBg(rowIdx, this.tf.validRowsIndex.length); + this.setRowBg(rowIdx, arrIdx); } else { this.removeRowBg(rowIdx); } @@ -106,8 +116,11 @@ export class AlternateRows extends Feature { this.removeRowBg(i); } - this.emitter.off('row-processed', - (tf, rowIndex, isValid)=> this.processRow(rowIndex, isValid)); + this.emitter.off('row-processed', (tf, rowIndex, arrIndex, isValid)=> + this.processRow(rowIndex, arrIndex, isValid)); + this.emitter.off('row-paged', (tf, rowIndex, arrIndex, isValid)=> + this.processRow(rowIndex, arrIndex, isValid)); + this.emitter.off('column-sorted', ()=> this.processAll()); this.initialized = false; } diff --git a/src/modules/paging.js b/src/modules/paging.js index 83e54ead..de75ec11 100644 --- a/src/modules/paging.js +++ b/src/modules/paging.js @@ -370,29 +370,13 @@ export class Paging extends Feature{ * Refresh paging select according to number of pages * @param {Array} validRows Collection of valid rows */ - setPagingInfo(validRows=[]){ + setPagingInfo(validRows){ var tf = this.tf; - var rows = tf.tbl.rows; var mdiv = !this.pagingTgtId ? tf.mDiv : Dom.id(this.pagingTgtId); var pgspan = Dom.id(this.prfxPgSpan+tf.id); //store valid rows indexes - tf.validRowsIndex = validRows; - - if(validRows.length === 0){ - //counts rows to be grouped - for(var j=tf.refRow; j=startPagingRow && h this.buildIcons()); this.emitter.on('after-filtering', ()=> this.closeAll()); + this.emitter.on('cell-processed', + (tf, cellIndex)=> this.buildIcon(cellIndex, true)); this.initialized = true; } @@ -208,7 +210,7 @@ export class PopupFilter extends Feature{ } /** - * Build specified icon + * Apply specified icon state * @param {Number} colIndex Column index * @param {Boolean} active Apply active state */ @@ -253,6 +255,8 @@ export class PopupFilter extends Feature{ // unsubscribe to events this.emitter.off('before-filtering', ()=> this.buildIcons()); this.emitter.off('after-filtering', ()=> this.closeAll()); + this.emitter.off('cell-processed', + (tf, cellIndex)=> this.buildIcon(cellIndex, true)); this.initialized = false; } diff --git a/src/tablefilter.js b/src/tablefilter.js index 94190129..cb2fee5b 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -931,10 +931,6 @@ export class TableFilter { Dom.addClass(this.tbl, this.prfxTf); } - if(this.loader){ - Mod.loader.show('none'); - } - /* Loads extensions */ if(this.hasExtensions){ this.initExtensions(); @@ -943,6 +939,8 @@ export class TableFilter { // Subscribe to events if(this.markActiveColumns){ this.emitter.on('before-filtering', ()=> this.clearActiveColumns()); + this.emitter.on('cell-processed', + (tf, colIndex)=> this.markActiveColumn(colIndex)); } if(this.linkedFilters){ this.emitter.on('after-filtering', ()=> this.linkFilters()); @@ -1210,6 +1208,8 @@ export class TableFilter { this.clearActiveColumns(); this.emitter.off('before-filtering', ()=> this.clearActiveColumns()); + this.emitter.off('cell-processed', + (tf, colIndex)=> this.markActiveColumn(colIndex)); } if(this.hasExtensions){ this.destroyExtensions(); @@ -1753,7 +1753,7 @@ export class TableFilter { for(let k=this.refRow; k Date: Sat, 2 Jan 2016 19:18:44 +1100 Subject: [PATCH 13/41] Initial commit --- package.json | 2 +- src/modules/checkList.js | 8 ++++---- src/tablefilter.js | 8 +++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index eeb83dac..99d6a24a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tablefilter", - "version": "0.1.3", + "version": "0.1.4", "description": "A Javascript library making HTML tables filterable and a bit more", "license": "MIT", "author": { diff --git a/src/modules/checkList.js b/src/modules/checkList.js index 9753834d..82a18792 100644 --- a/src/modules/checkList.js +++ b/src/modules/checkList.js @@ -258,10 +258,10 @@ export class CheckList{ li.className = this.checkListItemCssClass; if(tf.linkedFilters && tf.disableExcludedOptions && Arr.has(this.excludedOpts, - Str.matchCase(val, tf.matchCase), tf.matchCase)){ - Dom.addClass(li, this.checkListItemDisabledCssClass); - li.check.disabled = true; - li.disabled = true; + Str.matchCase(val, tf.matchCase), tf.matchCase)){ + Dom.addClass(li, this.checkListItemDisabledCssClass); + li.check.disabled = true; + li.disabled = true; } else { Event.add(li.check, 'click', (evt) => { this.optionClick(evt); }); diff --git a/src/tablefilter.js b/src/tablefilter.js index cb2fee5b..1f3ddbfb 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -2457,6 +2457,8 @@ export class TableFilter { } else { filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); } + + Dom.addClass(tbl, this.prfxTf); } // filters are appended in external placeholders elements @@ -2495,9 +2497,9 @@ export class TableFilter { Mod.popupFilter.reset(); } - if(!this.gridLayout){ - Dom.addClass(this.tbl, this.prfxTf); - } + // if(!this.gridLayout){ + // Dom.addClass(this.tbl, this.prfxTf); + // } this._hasGrid = true; } From ea478ec500663046aaf8573ac65e6eb7b342102f Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Sun, 3 Jan 2016 01:33:31 +1100 Subject: [PATCH 14/41] Continued refactoring EvtManager --- dist/starter.html | 4 +- dist/tablefilter/style/colsVisibility.css | 4 +- dist/tablefilter/style/filtersVisibility.css | 4 +- dist/tablefilter/style/tablefilter.css | 4 +- .../style/themes/default/default.css | 4 +- .../style/themes/mytheme/mytheme.css | 4 +- .../style/themes/skyblue/skyblue.css | 4 +- dist/tablefilter/tablefilter.js | 12 +- dist/tablefilter/tf-1.js | 4 +- src/modules/checkList.js | 21 +- src/modules/dropdown.js | 31 +- src/modules/loader.js | 67 +++- src/modules/paging.js | 86 +++-- src/modules/statusBar.js | 106 ++++++- src/tablefilter.js | 297 +++++++++--------- test/test-case-sensitive-query.js | 8 +- test/test-exact-query-match.js | 8 +- test/test-highlight-keywords.js | 8 +- test/test-linked-filters.js | 8 +- test/test-load-filters-on-demand.js | 2 +- test/test-no-results-message.js | 6 +- 21 files changed, 441 insertions(+), 251 deletions(-) diff --git a/dist/starter.html b/dist/starter.html index 3a4514b3..a5588fbc 100644 --- a/dist/starter.html +++ b/dist/starter.html @@ -1,10 +1,10 @@ - tablefilter v0.1.3 - Starter + tablefilter v0.1.4 - Starter -

tablefilter v0.1.3

+

tablefilter v0.1.4

diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index c0dca7c7..80688d82 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.3 by Max Guglielmi - * build date: 2016-01-02T03:37:45.442Z + * tablefilter v0.1.4 by Max Guglielmi + * build date: 2016-01-02T14:26:21.155Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 14c64b57..ba14da32 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.3 by Max Guglielmi - * build date: 2016-01-02T03:37:45.442Z + * tablefilter v0.1.4 by Max Guglielmi + * build date: 2016-01-02T14:26:21.155Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 2f351ed7..ce164e94 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.3 by Max Guglielmi - * build date: 2016-01-02T03:37:45.442Z + * tablefilter v0.1.4 by Max Guglielmi + * build date: 2016-01-02T14:26:21.155Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 646fa406..0a266cb1 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.3 by Max Guglielmi - * build date: 2016-01-02T03:37:45.442Z + * tablefilter v0.1.4 by Max Guglielmi + * build date: 2016-01-02T14:26:21.155Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 6a71af8e..248861ee 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.3 by Max Guglielmi - * build date: 2016-01-02T03:37:45.442Z + * tablefilter v0.1.4 by Max Guglielmi + * build date: 2016-01-02T14:26:21.155Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 350f86c3..f96ae82f 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.3 by Max Guglielmi - * build date: 2016-01-02T03:37:45.442Z + * tablefilter v0.1.4 by Max Guglielmi + * build date: 2016-01-02T14:26:21.155Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index b592b6b4..5f528a45 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,10 @@ /** - * tablefilter v0.1.3 by Max Guglielmi - * build date: 2016-01-02T03:37:45.348Z + * tablefilter v0.1.4 by Max Guglielmi + * build date: 2016-01-02T14:26:21.070Z * MIT License */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var l=s[i]={exports:{},id:i,loaded:!1};return t[i].call(l.exports,l,l.exports,e),l.loaded=!0,l.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,a){for(var n,r,o=0,h=[];on;n++)s[n]=arguments[n];if(0!==s.length){if(this.id=null,this.version="0.1.3",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":l(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.msgFilter=r.msg_filter||"Filtering data...",this.msgPopulate=r.msg_populate||"Populating filter...",this.msgPopulateCheckList=r.msg_populate_checklist||"Populating list...",this.msgChangePage=r.msg_change_page||"Collecting paging data...",this.msgClear=r.msg_clear||"Clearing filters...",this.msgChangeResults=r.msg_change_results||"Changing results per page...",this.msgResetValues=r.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=r.msg_reset_page||"Re-setting page...",this.msgResetPageLength=r.msg_reset_page_length||"Re-setting page length...",this.msgSort=r.msg_sort||"Sorting data...",this.msgLoadExtensions=r.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=r.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={name:{filter:"Filter",dropdown:"DropDown",checklist:"CheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),l=s._ezEditTable;s.cfg.editable&&l.Editable.Remove(),s.cfg.selection&&l.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown._build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList._build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return n(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new k.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new T.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var l=void 0;if(!this.gridLayout){var a=u["default"].tag(this.tbl,"thead");l=a.length>0?a[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,l.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(l.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var n=0;i>n;n++){this.popupFilters&&e.popupFilter.build(n);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(n),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[n]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||l.appendChild(r),s=n==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+n+"_"+this.id],["ct",n],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||c._build(n),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+n+"_"+this.id],["ct",n],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[n]=b,this.fltIds.push(this.prfxFlt+n+"_"+this.id),this.loadFltOnDemand||v._build(n),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",_=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+n+"_"+this.id],["type",m],["ct",n]);if("hidden"!==m&&this.watermark&&_.setAttribute("placeholder",this.isWatermarkArray?this.watermark[n]||"":this.watermark),_.className=s,o["default"].add(_,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(_),this.externalFltEls.push(_)):r.appendChild(_),this.fltIds.push(this.prfxFlt+n+"_"+this.id),o["default"].add(_,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(_,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(_,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(_,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[n]&&this.setFilterValue(n,y[n],!1)}}if(n==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+n+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new M.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new N.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new D.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.emitter.on("cell-processed",function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?r.dropdown._build(s,!0):r.dropdown._build(s,!1,l,a);break;case e.checklist:r.checkList._build(s,l,a);break;case e.changepage:r.paging._changePage(n);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:r.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:r.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:r.paging._resetPageLength(this.pgLenCookie);break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&r.statusBar.message(""),this.loader&&r.loader.show("none")}var i=arguments.length<=1||void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],s=i.slcIndex,l=i.slcExternal,a=i.slcId,n=i.pgIndex,r=this.Mod;this.loader||this.statusBar||this.linkedFilters?(this.loader&&r.loader.show(""),this.statusBar&&r.statusBar.message(this["msg"+t]),A.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,l=t.path,a=void 0;s&&l?a=t.path+s:(s=s.replace(".js",""),a="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var l=[i(26)("./"+a)];(function(i){var l=new i["default"](e,t);l.init(),e.ExtRegistry[s]=l}).apply(null,l)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],l=this.ExtRegistry[s.name];l&&(l.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){this.EvtManager(this.Evt.name.loadthemes)}},{key:"_loadThemes",value:function(){var t=this.themes;if(this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var l=t[i],a=l.name,n=l.path,r=this.prfxTf+a;a&&!n?n=this.themesPath+a+"/"+a+".css":!a&&l.path&&(a="theme{0}".replace("{0}",i)),this.isImported(n,"link")||this["import"](r,n,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this._clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()}),this.emitter.off("cell-processed",function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],l=u["default"].id(s);l&&(l.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],l=[],a=i.indexOf(t),n=e.values[a],r=e.texts[a],o=e.sorts[a],h=0,u=n.length;u>h;h++)l.push(n[h]),r[h]?s.push(r[h]):s.push(n[h]);return o&&(l.sort(),s.sort()),[l,s]}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Mod.paging&&this.Mod.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Mod.paging&&this.Mod.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var l=0;lh;h++)""!==a[h]&&(n=u["default"].createOpt(a[h],a[h],!0),o.appendChild(n),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[l];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[l]],["colIndex",l]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[l]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),a=e[l].split(" "+this.orOperator+" ");for(var h=0,d=a.length;d>h;h++)if(""!==a[h]){var v=u["default"].createCheckItem(this.fltIds[l]+"_"+(h+1),a[h],a[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){this.EvtManager(this.Evt.name.filter)}},{key:"_filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var l=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(l=u["default"].getText(i)),""!==l&&s.highlightKeyword.highlight(i,l,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,l=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),k=d.test(t),T=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=_===t,M=C.test(t),N=u&&y["default"].isValid(t.replace(h,""),O),D=x&&y["default"].isValid(t.replace(r,""),O),B=k&&y["default"].isValid(t.replace(d,""),O),A=T&&y["default"].isValid(t.replace(o,""),O),H=R&&y["default"].isValid(t.replace(c,""),O),j=P&&y["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(y["default"].isValid(e,O))V=y["default"].format(e,O),N?(U=y["default"].format(t.replace(h,""),O),s=U>V):D?(U=y["default"].format(t.replace(r,""),O),s=U>=V):A?(U=y["default"].format(t.replace(o,""),O),s=V>=U):B?(U=y["default"].format(t.replace(d,""),O),s=V>U):H?(U=y["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=y["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):y["default"].isValid(t,O)?(U=y["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(a=l(e,this.colNbFormat[i]),n=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=l(e,"us"),n="us"):(a=l(e,"eu"),n="eu"),x)s=a<=l(t.replace(r,""),n);else if(T)s=a>=l(t.replace(o,""),n);else if(u)s=al(t.replace(d,""),n);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(M)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,l=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var a,n,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,_=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(k[I]),this.caseSensitive),L=S.split(this.orOperator),M=L.length>1?!0:!1,N=S.split(this.anOperator),D=N.length>1?!0:!1;if(M||D){for(var B=void 0,A=!1,H=M?L:N,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,k[I]),!M||!A)&&(!D||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],k[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,k[I])}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),l++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=l,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var l=this.tbl.rows,a=[];e&&a.push(this.getHeadersText()[t]);for(var n=this.refRow;n0&&(r=-1!=s.indexOf(n));var o=l[n].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===l[n].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;a.push(c)}}return a; -}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var l=0,a=i.options.length;a>l;l++)i.options[l].selected&&(e=e.concat(i.options[l].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,l=this.fltIds.length;l>s;s++){var a=this.getFilterType(s);if(a===f["default"].lower(t)){var n=e?s:this.fltIds[s];i.push(n)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sn;n++){var o=this.getCellData(a[n]);l[1].push(o)}i.push(l)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),l=0;ll;l++){var n=i[l],r=n[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",l=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",l),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;ta;a++){var r=i.options[a];(""===l||""===l[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(l,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),l=s.length>0,a=l?null:H.createDocumentFragment(),n=0;t>n;n++){var r=void 0;l?r=s[n]:(r=u["default"].create("col",["id",this.id+"_col_"+n]),a.appendChild(r)),r.style.width=i[n]}l||e.insertBefore(a,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){this.EvtManager(this.Evt.name.clear)}},{key:"_clearFilters",value:function(){if(this.fltGrid){this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("cleared-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var l=this.activeFilterId.split("_")[0];l=l.split(this.prfxFlt)[1];for(var a=void 0,n=0,r=s.length;r>n;n++){var o=u["default"].id(this.fltIds[s[n]]);if(a=this.getFilterValue(s[n]),l!==s[n]||this.paging&&-1!=t.indexOf(s[n])&&l===s[n]||!this.paging&&(-1!=i.indexOf(s[n])||-1!=e.indexOf(s[n]))||a===this.displayAllText){if(-1!=i.indexOf(s[n])?this.Mod.checkList.checkListDiv[s[n]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[n])?this.Mod.checkList._build(s[n]):this.Mod.dropdown._build(s[n],!0),this.setFilterValue(s[n],a)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,l=i[s];if(!this.gridLayout)if(e.tHead){var a=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,a)}else l.parentNode.insertBefore(this.fltGridEl,l);if(this.isExternalFlt)for(var n=this.externalFltTgtIds,r=0,o=n.length;o>r;r++){var h=u["default"].id(n[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",l="script"==s?"src":"href",a=u["default"].tag(H,s),n=0,r=a.length;r>n;n++)if(void 0!==a[n][l]&&a[n][l].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var l=s?s:"script",a=this.isImported(e,l);if(!a){var n=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(l)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,n))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var l=0;l0){var s=document.cookie,l=s.indexOf(i);if(-1!==l){l+=i.length;var a=s.indexOf(";",l);-1===a&&(a=s.length),e=unescape(s.substring(l,a))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var l=i(3),a=s(l);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,l=0;l2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,l=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,l=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,l=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,l=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&l.test(t)===!1)return!1;var a=t.split(RegExp.$1),n=void 0,r=void 0,o=void 0;n="M"===e.substring(0,1)?a[0]:"M"===e.substring(1,2)?a[1]:a[2],r="D"===e.substring(0,1)?a[0]:"D"===e.substring(1,2)?a[1]:a[2],o="Y"===e.substring(0,1)?a[0]:"Y"===e.substring(1,2)?a[1]:a[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(n,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var l=void 0,a=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),l=new Date(i(a[2]),s(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(i(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(i(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),l=new Date(i(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(i(a[2]),a[1]-1,a[0])}return l}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var l=i(3),a=s(l);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===a["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return n(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,l=parseInt(s.getAttribute("ci"),10);if(this.closeAll(l),this.toggle(l),this.popUpFltAdjustToContainer){var a=this.popUpFltElms[l],n=this.tf.getHeaderElement(l),r=.95*n.clientWidth;a.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&l.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!l.paging||l.paging&&(!l.validRowsIndex||l.validRowsIndex&&-1!=l.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=l.validRowsIndex.indexOf(m)))){var w=l.getCellData(_[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&l.disableExcludedOptions){var k=b[C];k||(k=l.getFilteredDataCol(C)),h["default"].has(k,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var T=l.getCustomOptions(t);this.opts=T[0],this.optsTxt=T[1]}if(l.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),l.sortNumAsc&&-1!=l.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&-1!=l.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,n,e,v,p,g)}}},{key:"addOptions",value:function(t,e,i,s,l,a){var n=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=n.loadFltOnDemand&&u===this.opts[f]&&n.getFilterType(t)===n.fltTypeSlc?r["default"].createOpt(p,c,!0):n.getFilterType(t)!==n.fltTypeMulti?r["default"].createOpt(p,c," "!==l[t]&&c===l[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(a,d["default"].matchCase(this.opts[f],n.matchCase),n.matchCase)||-1!==a.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var l=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(l)}if(e.enableNonEmptyOption){var a=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(a)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var l=i(3),a=s(l);e["default"]={ignoreCase:function(t,e){var i=a["default"].lower(t),s=a["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var i=0;i_;_++)if(t===_&&(!l.linkedFilters||l.linkedFilters&&l.disableExcludedOptions)||t===_&&l.linkedFilters&&(""===u[v].style.display&&!l.paging||l.paging&&(!f||f===t||f!=t&&-1!=l.validRowsIndex.indexOf(v)))){var y=l.getCellData(b[_]),C=d["default"].matchCase(y,l.matchCase);h["default"].has(this.opts,C,l.matchCase)||this.opts.push(y);var w=p[_];l.linkedFilters&&l.disableExcludedOptions&&(w||(w=l.getFilteredDataCol(_)),h["default"].has(w,C,l.matchCase)||h["default"].has(this.excludedOpts,C,l.matchCase)||l.isFirstLoad||this.excludedOpts.push(y))}}if(this.isCustom){var x=l.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(l.sortSlc&&!this.isCustom&&(l.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),l.sortNumAsc&&-1!=l.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&-1!=l.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,l.separator),l.loadFltOnDemand&&(n.innerHTML=""),n.appendChild(o),n.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,l=this.addTChecks(t,e),a=[],n=s.feature("store"),o=n?n.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?a.push(o):a=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),a=l+s.pagingLength-1<=e.nbVisibleRows?l+s.pagingLength-1:e.nbVisibleRows;i=l+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var l=i.refRow,r=i.nbRows;i.nbPages=Math.ceil((r-l)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var l=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),a=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),n=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)l.innerHTML=this.btnNextPageHtml,b["default"].add(l,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),l.appendChild(o)}if(this.btnPrevPageHtml)a.innerHTML=this.btnPrevPageHtml,b["default"].add(a,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),a.appendChild(h)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,b["default"].add(n,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),n.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(a);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(l),c.appendChild(n),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf; -e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,s=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var l=0;la;a++){var r=e.validRowsIndex[a],o=i[r],h=o.getAttribute("validRow"),u=!1;a>=s&&l>a?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,a,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":l(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var l=this.resultsPerPage[0],a=this.resultsPerPage[1],n=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(d["default"].text(l));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(n,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(n),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),l=d["default"].id(this.prfxBtnLastSpan+e.id),a=d["default"].id(this.prfxBtnFirstSpan+e.id),n=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),l&&(b["default"].remove(l,"click",h.last),d["default"].remove(l)),a&&(b["default"].remove(a,"click",h.first),d["default"].remove(a)),n&&d["default"].remove(n),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return n(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var l=i.firstChild;f["default"].add(l,"click",function(){t.onClick()})}else{var a=u["default"].create("a",["href","javascript:void(0);"]);a.className=e.btnResetCssClass,a.appendChild(u["default"].text(this.btnResetText)),i.appendChild(a),f["default"].add(a,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return n(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var l=this.tgtId?u["default"].id(this.tgtId):e.rDiv;l.appendChild(i);var a=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.toggle()}),a.appendChild(s)}else{a.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&a.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;in;n++){var r=i?n:e[n];this.setRowBg(r,a),a++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,a){for(var r,l,o=0,h=[];or;r++)s[r]=arguments[r];if(0!==s.length){if(this.id=null,this.version="0.1.4",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var l=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=l.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=l.grid===!1?!1:!0,this.gridLayout=Boolean(l.grid_layout),this.filtersRowIndex=isNaN(l.filters_row_index)?0:l.filters_row_index,this.headersRow=isNaN(l.headers_row_index)?0===this.filtersRowIndex?1:0:l.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==l.filters_cell_tag||"td"!==l.filters_cell_tag?"td":l.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=l.inf_div_css_class||"inf",this.lDivCssClass=l.left_div_css_class||"ldiv",this.rDivCssClass=l.right_div_css_class||"rdiv",this.mDivCssClass=l.middle_div_css_class||"mdiv",this.contDivCssClass=l.content_div_css_class||"cont",this.stylePath=l.style_path||this.basePath+"style/",this.stylesheet=l.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=l.flts_row_css_class||"fltrow",this.enableIcons=l.enable_icons===!1?!1:!0,this.alternateRows=Boolean(l.alternate_rows),this.hasColWidths=v["default"].isArray(l.col_widths),this.colWidths=this.hasColWidths?l.col_widths:null,this.fltCssClass=l.flt_css_class||"flt",this.fltMultiCssClass=l.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=l.flt_small_css_class||"flt_s",this.singleFltCssClass=l.single_flt_css_class||"single_flt",this.enterKey=l.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(l.on_before_filter)?l.on_before_filter:null,this.onAfterFilter=v["default"].isFn(l.on_after_filter)?l.on_after_filter:null,this.caseSensitive=Boolean(l.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(l.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?l.columns_exact_match:[],this.exactMatch=Boolean(l.exact_match),this.linkedFilters=Boolean(l.linked_filters),this.disableExcludedOptions=Boolean(l.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(l.rows_always_visible),this.visibleRows=this.hasVisibleRows?l.rows_always_visible:[],this.isExternalFlt=Boolean(l.external_flt_grid),this.externalFltTgtIds=l.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(l.exec_delay)?100:parseInt(l.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(l.on_filters_loaded)?l.on_filters_loaded:null,this.singleSearchFlt=Boolean(l.single_filter),this.onRowValidated=v["default"].isFn(l.on_row_validated)?l.on_row_validated:null,this.customCellDataCols=l.custom_cell_data_cols?l.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(l.custom_cell_data)?l.custom_cell_data:null,this.watermark=l.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=l.toolbar_target_id||null,this.help=v["default"].isUndef(l.help_instructions)?void 0:Boolean(l.help_instructions),this.popupFilters=Boolean(l.popup_filters),this.markActiveColumns=Boolean(l.mark_active_columns),this.activeColumnsCssClass=l.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(l.on_before_active_column)?l.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(l.on_after_active_column)?l.on_after_active_column:null,this.displayAllText=l.display_all_text||"Clear",this.enableEmptyOption=Boolean(l.enable_empty_option),this.emptyText=l.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(l.enable_non_empty_option),this.nonEmptyText=l.non_empty_text||"(Non empty)",this.onSlcChange=l.on_change===!1?!1:!0,this.sortSlc=l.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(l.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?l.sort_num_asc:null,this.isSortNumDesc=Boolean(l.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?l.sort_num_desc:null,this.loadFltOnDemand=Boolean(l.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(l.custom_options),this.customOptions=l.custom_options,this.rgxOperator=l.regexp_operator||"rgx:",this.emOperator=l.empty_operator||"[empty]",this.nmOperator=l.nonempty_operator||"[nonempty]",this.orOperator=l.or_operator||"||",this.anOperator=l.and_operator||"&&",this.grOperator=l.greater_operator||">",this.lwOperator=l.lower_operator||"<",this.leOperator=l.lower_equal_operator||"<=",this.geOperator=l.greater_equal_operator||">=",this.dfOperator=l.different_operator||"!",this.lkOperator=l.like_operator||"*",this.eqOperator=l.equal_operator||"=",this.stOperator=l.start_with_operator||"{",this.enOperator=l.end_with_operator||"}",this.curExp=l.cur_exp||"^[¥£€$]",this.separator=l.separator||",",this.rowsCounter=Boolean(l.rows_counter),this.statusBar=Boolean(l.status_bar),this.loader=Boolean(l.loader),this.displayBtn=Boolean(l.btn),this.btnText=l.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=l.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(l.btn_reset),this.btnResetCssClass=l.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(l.on_before_reset)?l.on_before_reset:null,this.onAfterReset=v["default"].isFn(l.on_after_reset)?l.on_after_reset:null,this.paging=Boolean(l.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(l.auto_filter),this.autoFilterDelay=isNaN(l.auto_filter_delay)?900:l.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(l.highlight_keywords),this.noResults=v["default"].isObj(l.no_results_message)||Boolean(l.no_results_message),this.defaultDateType=l.default_date_type||"DMY",this.thousandsSeparator=l.thousands_separator||",",this.decimalSeparator=l.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(l.col_number_format),this.colNbFormat=this.hasColNbFormat?l.col_number_format:null,this.hasColDateType=v["default"].isArray(l.col_date_type),this.colDateType=this.hasColDateType?l.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(l.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&l.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&l.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=l.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(l.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(l.themes),this.themes=l.themes||[],this.themesPath=l.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),n=s._ezEditTable;s.cfg.editable&&n.Editable.Remove(),s.cfg.selection&&n.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown.build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList.build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return r(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=void 0;if(!this.gridLayout){var a=u["default"].tag(this.tbl,"thead");n=a.length>0?a[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,n.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(n.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var r=0;i>r;r++){this.popupFilters&&e.popupFilter.build(r);var l=u["default"].create(this.fltCellTag),h=this.getFilterType(r),f=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[r]:null;if(this.singleSearchFlt&&(l.colSpan=this.nbCells),this.gridLayout||n.appendChild(l),s=r==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+r+"_"+this.id],["ct",r],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=d["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,f?(u["default"].id(f).appendChild(p),this.externalFltEls.push(p)):l.appendChild(p),this.fltIds.push(this.prfxFlt+r+"_"+this.id),this.loadFltOnDemand||c.build(r),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+r+"_"+this.id],["ct",r],["filled","0"]);b.className=v.checkListDivCssClass,f?(u["default"].id(f).appendChild(b),this.externalFltEls.push(b)):l.appendChild(b),v.checkListDiv[r]=b,this.fltIds.push(this.prfxFlt+r+"_"+this.id),this.loadFltOnDemand||v.build(r),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",y=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+r+"_"+this.id],["type",m],["ct",r]);if("hidden"!==m&&this.watermark&&y.setAttribute("placeholder",this.isWatermarkArray?this.watermark[r]||"":this.watermark),y.className=s,o["default"].add(y,"focus",this.Evt.onInpFocus.bind(this)),f?(u["default"].id(f).appendChild(y),this.externalFltEls.push(y)):l.appendChild(y),this.fltIds.push(this.prfxFlt+r+"_"+this.id),o["default"].add(y,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(y,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(y,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(y,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var _=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=_[r]&&this.setFilterValue(r,_[r],!1)}}if(r==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+r+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,f?u["default"].id(f).appendChild(C):l.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new M.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.emitter.on("cell-processed",function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;this.emitter.emit("before-loading-extensions",this);for(var e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,a=void 0;s&&n?a=t.path+s:(s=s.replace(".js",""),a="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var n=[i(26)("./"+a)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],a=n.name,r=n.path,l=this.prfxTf+a;a&&!r?r=this.themesPath+a+"/"+a+".css":!a&&n.path&&(a="theme{0}".replace("{0}",i)),this.isImported(r,"link")||this["import"](l,r,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()}),this.emitter.off("cell-processed",function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],a=i.indexOf(t),r=e.values[a],l=e.texts[a],o=e.sorts[a],h=0,u=r.length;u>h;h++)n.push(r[h]),l[h]?s.push(l[h]):s.push(r[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==a[h]&&(r=u["default"].createOpt(a[h],a[h],!0),o.appendChild(r),this.hasStoredValues=!0)}}else if(l===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),a=e[n].split(" "+this.orOperator+" ");for(var h=0,f=a.length;f>h;h++)if(""!==a[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),a[h],a[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(l.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=l.test(t),T=f.test(t),k=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),M=x&&_["default"].isValid(t.replace(l,""),O),B=T&&_["default"].isValid(t.replace(f,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=R&&_["default"].isValid(t.replace(c,""),O),j=P&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):M?(U=_["default"].format(t.replace(l,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):B?(U=_["default"].format(t.replace(f,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(a=n(e,this.colNbFormat[i]),r=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=n(e,"us"),r="us"):(a=n(e,"eu"),r="eu"),x)s=a<=n(t.replace(l,""),r);else if(k)s=a>=n(t.replace(o,""),r);else if(u)s=an(t.replace(f,""),r);else if(R)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var a,r,l=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),M=D.length>1?!0:!1;if(N||M){for(var B=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(B=d["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,T[I]),!N||!A)&&(!M||A);j++);R[I]=A}else R[I]=e.call(this,d["default"].trim(S),E,I),t.call(this,S,R[I],T[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,a=[];e&&a.push(this.getHeadersText()[t]);for(var r=this.refRow;r0&&(l=-1!=s.indexOf(r));var o=n[r].cells,h=o.length;if(h===this.nbCells&&!l)for(var u=0;h>u;u++)if(u==t&&""===n[r].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;a.push(c)}}return a}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,a=i.options.length;a>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var a=this.getFilterType(s);if(a===d["default"].lower(t)){var r=e?s:this.fltIds[s];i.push(r)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sr;r++){var o=this.getCellData(a[r]);n[1].push(o)}i.push(n)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),n=0;nn;n++){var r=i[n],l=r[1],o=l[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;ta;a++){var l=i.options[a];(""===n||""===n[0])&&(l.selected=!1),""===l.value&&(l.selected=!1),""!==l.value&&m["default"].has(n,l.value,!0)&&(l.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,a=n?null:H.createDocumentFragment(),r=0;t>r;r++){var l=void 0;n?l=s[r]:(l=u["default"].create("col",["id",this.id+"_col_"+r]),a.appendChild(l)),l.style.width=i[r]}n||e.insertBefore(a,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var a=void 0,r=0,l=s.length;l>r;r++){var o=u["default"].id(this.fltIds[s[r]]);if(a=this.getFilterValue(s[r]),n!==s[r]||this.paging&&-1!=t.indexOf(s[r])&&n===s[r]||!this.paging&&(-1!=i.indexOf(s[r])||-1!=e.indexOf(s[r]))||a===this.displayAllText){if(-1!=i.indexOf(s[r])?this.Mod.checkList.checkListDiv[s[r]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[r])?this.Mod.checkList.build(s[r]):this.Mod.dropdown.build(s[r],!0),this.setFilterValue(s[r],a)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var a=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,a)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var r=this.externalFltTgtIds,l=0,o=r.length;o>l;l++){var h=u["default"].id(r[l]);if(h){var f=this.externalFltEls[l];h.appendChild(f);var d=this.getFilterType(l);this.gridLayout&&""===f.innerHTML&&d!==this.fltTypeInp&&((d===this.fltTypeSlc||d===this.fltTypeMulti)&&t.dropdown.build(l),d===this.fltTypeCheckList&&t.checkList.build(l))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",a=u["default"].tag(H,s),r=0,l=a.length;l>r;r++)if(void 0!==a[r][n]&&a[r][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",a=this.isImported(e,n);if(!a){var r=this,l=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(l=!0,"function"==typeof i&&i.call(null,r))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var a=s.indexOf(";",n);-1===a&&(a=s.length),e=unescape(s.substring(n,a))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var a=t.split(RegExp.$1),r=void 0,l=void 0,o=void 0;r="M"===e.substring(0,1)?a[0]:"M"===e.substring(1,2)?a[1]:a[2],l="D"===e.substring(0,1)?a[0]:"D"===e.substring(1,2)?a[1]:a[2],o="Y"===e.substring(0,1)?a[0]:"Y"===e.substring(1,2)?a[1]:a[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(r,10)-1,parseInt(l,10),0,0,0,0);return parseInt(l,10)!=h.getDate()?!1:parseInt(r,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,a=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(a[2]),s(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===a["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return r(i,e),l(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var a=this.popUpFltElms[n],r=this.tf.getHeaderElement(n),l=.95*r.clientWidth;a.style.width=parseInt(l,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&n.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(m))&&(void 0===d||d==t||d!=t&&-1!=n.validRowsIndex.indexOf(m)))){var w=n.getCellData(y[C]),x=f["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&n.disableExcludedOptions){var T=b[C];T||(T=n.getFilteredDataCol(C)),h["default"].has(T,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var k=n.getCustomOptions(t);this.opts=k[0],this.optsTxt=k[1]}if(n.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,r,e,v,p,g),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addOptions",value:function(t,e,i,s,n,a){var r=this.tf,o=f["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var d=0;d"+p+""}else{var b;b=r.loadFltOnDemand&&u===this.opts[d]&&r.getFilterType(t)===r.fltTypeSlc?l["default"].createOpt(p,c,!0):r.getFilterType(t)!==r.fltTypeMulti?l["default"].createOpt(p,c," "!==n[t]&&c===n[t]?!0:!1):l["default"].createOpt(p,c,h["default"].has(a,f["default"].matchCase(this.opts[d],r.matchCase),r.matchCase)||-1!==a.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=f["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=l["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=l["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var a=l["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(a)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={ignoreCase:function(t,e){var i=a["default"].lower(t),s=a["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===u[v].style.display&&!n.paging||n.paging&&(!d||d===t||d!=t&&-1!=n.validRowsIndex.indexOf(v)))){var _=n.getCellData(b[y]),C=f["default"].matchCase(_,n.matchCase);h["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=p[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),h["default"].has(w,C,n.matchCase)||h["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,n.separator),n.loadFltOnDemand&&(r.innerHTML=""),r.appendChild(o),r.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,n=this.addTChecks(t,e),a=[],r=s.feature("store"),o=r?r.getFilterValues(s.fltsValuesCookie)[t]:null;o&&f["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?a.push(o):a=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),a=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,l=t.nbRows;i.nbPages=Math.ceil((l-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return l(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0], +this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)a.innerHTML=this.btnPrevPageHtml,b["default"].add(a,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),a.appendChild(h)}if(this.btnLastPageHtml)r.innerHTML=this.btnLastPageHtml,b["default"].add(r,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),r.appendChild(u)}if(this.btnFirstPageHtml)l.innerHTML=this.btnFirstPageHtml,b["default"].add(l,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),l.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(l),c.appendChild(a);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(r),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.emitter.on("initialized",function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;na;a++){var l=e.validRowsIndex[a],o=i[l],h=o.getAttribute("validRow"),u=!1;a>=s&&n>a?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,l,a,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],a=this.resultsPerPage[1],r=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);r.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var l=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;r.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(r,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(l.appendChild(r),l.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),a=f["default"].id(this.prfxBtnFirstSpan+e.id),r=f["default"].id(this.prfxPgBeforeSpan+e.id),l=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),a&&(b["default"].remove(a,"click",h.first),f["default"].remove(a)),r&&f["default"].remove(r),l&&f["default"].remove(l),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.emitter.off("initialized",function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return r(e,t),l(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var a=u["default"].create("a",["href","javascript:void(0);"]);a.className=e.btnResetCssClass,a.appendChild(u["default"].text(this.btnResetText)),i.appendChild(a),d["default"].add(a,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return r(e,t),l(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var a=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var r=i.firstChild;d["default"].add(r,"click",function(){t.toggle()}),a.appendChild(s)}else{a.appendChild(s);var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=this.btnCssClass,l.appendChild(u["default"].text(this.btnText)),i.appendChild(l),d["default"].add(l,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&a.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=function(){function t(t,e){for(var i=0;ir;r++){var l=i?r:e[r];this.setRowBg(l,a),a++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index ad70a2a7..30d62f37 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.3 by Max Guglielmi - * build date: 2016-01-02T03:37:45.348Z + * tablefilter v0.1.4 by Max Guglielmi + * build date: 2016-01-02T14:26:21.070Z * MIT License */ diff --git a/src/modules/checkList.js b/src/modules/checkList.js index 82a18792..f2e8becd 100644 --- a/src/modules/checkList.js +++ b/src/modules/checkList.js @@ -44,6 +44,7 @@ export class CheckList{ this.excludedOpts = null; this.tf = tf; + this.emitter = tf.emitter; } // TODO: move event here @@ -65,13 +66,13 @@ export class CheckList{ * @param {Boolean} isExternal Render in external container * @param {String} extFltId External container id */ - build(colIndex, isExternal, extFltId){ - var tf = this.tf; - tf.EvtManager( - tf.Evt.name.checklist, - { slcIndex:colIndex, slcExternal:isExternal, slcId:extFltId } - ); - } + // build(colIndex, isExternal, extFltId){ + // var tf = this.tf; + // tf.EvtManager( + // tf.Evt.name.checklist, + // { slcIndex:colIndex, slcExternal:isExternal, slcId:extFltId } + // ); + // } /** * Build checklist UI @@ -79,10 +80,12 @@ export class CheckList{ * @param {Boolean} isExternal Render in external container * @param {String} extFltId External container id */ - _build(colIndex, isExternal=false, extFltId=null){ + build(colIndex, isExternal=false, extFltId=null){ var tf = this.tf; colIndex = parseInt(colIndex, 10); + this.emitter.emit('before-populating-filter', tf, colIndex); + this.opts = []; this.optsTxt = []; @@ -227,6 +230,8 @@ export class CheckList{ } flt.appendChild(ul); flt.setAttribute('filled', '1'); + + this.emitter.emit('after-populating-filter', tf, colIndex); } /** diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index a033e650..a10a500a 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -32,6 +32,7 @@ export class Dropdown{ this.slcInnerHtml = null; this.tf = tf; + this.emitter = tf.emitter; } /** @@ -41,18 +42,18 @@ export class Dropdown{ * @param {Boolean} isExternal Render in external container * @param {String} extSlcId External container id */ - build(colIndex, isLinked, isExternal, extSlcId){ - var tf = this.tf; - tf.EvtManager( - tf.Evt.name.dropdown, - { - slcIndex: colIndex, - slcRefreshed: isLinked, - slcExternal: isExternal, - slcId: extSlcId - } - ); - } + // build(colIndex, isLinked, isExternal, extSlcId){ + // var tf = this.tf; + // tf.EvtManager( + // tf.Evt.name.dropdown, + // { + // slcIndex: colIndex, + // slcRefreshed: isLinked, + // slcExternal: isExternal, + // slcId: extSlcId + // } + // ); + // } /** * Build drop-down filter UI @@ -61,10 +62,12 @@ export class Dropdown{ * @param {Boolean} isExternal Render in external container * @param {String} extSlcId External container id */ - _build(colIndex, isLinked=false, isExternal=false, extSlcId=null){ + build(colIndex, isLinked=false, isExternal=false, extSlcId=null){ var tf = this.tf; colIndex = parseInt(colIndex, 10); + this.emitter.emit('before-populating-filter', tf, colIndex); + this.opts = []; this.optsTxt = []; this.slcInnerHtml = ''; @@ -226,6 +229,8 @@ export class Dropdown{ //populates drop-down this.addOptions( colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr); + + this.emitter.emit('after-populating-filter', tf, colIndex); } /** diff --git a/src/modules/loader.js b/src/modules/loader.js index 875a18fa..0b8da01a 100644 --- a/src/modules/loader.js +++ b/src/modules/loader.js @@ -2,7 +2,7 @@ import {Feature} from './feature'; import Dom from '../dom'; import Types from '../types'; -var global = window; +let global = window; export class Loader extends Feature{ @@ -10,11 +10,11 @@ export class Loader extends Feature{ * Loading message/spinner * @param {Object} tf TableFilter instance */ - constructor(tf){ + constructor(tf) { super(tf, 'loader'); // TableFilter configuration - var f = this.config; + let f = this.config; //id of container element this.loaderTgtId = f.loader_target_id || null; @@ -27,7 +27,7 @@ export class Loader extends Feature{ //defines css class for loader div this.loaderCssClass = f.loader_css_class || 'loader'; //delay for hiding loader - this.loaderCloseDelay = 200; + this.loaderCloseDelay = 250; //callback function before loader is displayed this.onShowLoader = Types.isFn(f.on_show_loader) ? f.on_show_loader : null; @@ -43,12 +43,13 @@ export class Loader extends Feature{ return; } - var tf = this.tf; + let tf = this.tf; + let emitter = this.emitter; - var containerDiv = Dom.create('div', ['id', this.prfxLoader+tf.id]); + let containerDiv = Dom.create('div', ['id', this.prfxLoader+tf.id]); containerDiv.className = this.loaderCssClass; - var targetEl = !this.loaderTgtId ? + let targetEl = !this.loaderTgtId ? tf.tbl.parentNode : Dom.id(this.loaderTgtId); if(!this.loaderTgtId){ targetEl.insertBefore(containerDiv, tf.tbl); @@ -63,15 +64,36 @@ export class Loader extends Feature{ } this.show('none'); + + // Subscribe to events + emitter.on('before-filtering', ()=> this.show('')); + emitter.on('after-filtering', ()=> this.show('none')); + emitter.on('before-populating-filter', ()=> this.show('')); + emitter.on('after-populating-filter', ()=> this.show('none')); + emitter.on('before-changing-page', ()=> this.show('')); + emitter.on('after-changing-page', ()=> this.show('none')); + emitter.on('before-clearing-filters', ()=> this.show('')); + emitter.on('after-clearing-filters', ()=> this.show('none')); + emitter.on('before-changing-results-per-page', ()=> this.show('')); + emitter.on('after-changing-results-per-page', ()=> this.show('none')); + emitter.on('before-reset-page', ()=> this.show('')); + emitter.on('after-reset-page', ()=> this.show('none')); + emitter.on('before-reset-page-length', ()=> this.show('')); + emitter.on('after-reset-page-length', ()=> this.show('none')); + emitter.on('before-loading-extensions', ()=> this.show('')); + emitter.on('after-loading-extensions', ()=> this.show('none')); + emitter.on('before-loading-themes', ()=> this.show('')); + emitter.on('after-loading-themes', ()=> this.show('none')); + this.initialized = true; } show(p) { - if(!this.isEnabled() || this.loaderDiv.style.display === p){ + if(!this.isEnabled() /*|| this.loaderDiv.style.display === p*/){ return; } - var displayLoader = () => { + let displayLoader = () => { if(!this.loaderDiv){ return; } @@ -84,17 +106,40 @@ export class Loader extends Feature{ } }; - var t = p === 'none' ? this.loaderCloseDelay : 1; + let t = p === 'none' ? this.loaderCloseDelay : 1; global.setTimeout(displayLoader, t); } - destroy(){ + destroy() { if(!this.initialized){ return; } + let emitter = this.emitter; + Dom.remove(this.loaderDiv); this.loaderDiv = null; + + // Unsubscribe to events + emitter.off('before-filtering', ()=> this.show('')); + emitter.off('after-filtering', ()=> this.show('none')); + emitter.off('before-populating-filter', ()=> this.show('')); + emitter.off('after-populating-filter', ()=> this.show('none')); + emitter.off('before-changing-page', ()=> this.show('')); + emitter.off('after-changing-page', ()=> this.show('none')); + emitter.off('before-clearing-filters', ()=> this.show('')); + emitter.off('after-clearing-filters', ()=> this.show('none')); + emitter.off('before-changing-results-per-page', ()=> this.show('')); + emitter.off('after-changing-results-per-page', ()=> this.show('none')); + emitter.off('before-reset-page', ()=> this.show('')); + emitter.off('after-reset-page', ()=> this.show('none')); + emitter.off('before-reset-page-length', ()=> this.show('')); + emitter.off('after-reset-page-length', ()=> this.show('none')); + emitter.off('before-loading-extensions', ()=> this.show('')); + emitter.off('after-loading-extensions', ()=> this.show('none')); + emitter.off('before-loading-themes', ()=> this.show('')); + emitter.off('after-loading-themes', ()=> this.show('none')); + this.initialized = false; } } diff --git a/src/modules/paging.js b/src/modules/paging.js index de75ec11..8551e150 100644 --- a/src/modules/paging.js +++ b/src/modules/paging.js @@ -120,8 +120,8 @@ export class Paging extends Feature{ //span following pages select (contains ' of ') this.prfxPgAfterSpan = 'pgafterspan_'; - var start_row = this.refRow; - var nrows = this.nbRows; + var start_row = tf.refRow; + var nrows = tf.nbRows; //calculates page nb this.nbPages = Math.ceil((nrows-start_row)/this.pagingLength); @@ -335,6 +335,7 @@ export class Paging extends Feature{ } this.emitter.on('after-filtering', ()=> this.resetPagingInfo()); + this.emitter.on('initialized', ()=> this.resetValues()); this.initialized = true; } @@ -565,49 +566,52 @@ export class Paging extends Feature{ * Change the page asynchronously according to passed index * @param {Number} index Index of the page (0-n) */ - changePage(index){ - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.changepage, { pgIndex:index }); - } + // changePage(index){ + // var tf = this.tf; + // var evt = tf.Evt; + // tf.EvtManager(evt.name.changepage, { pgIndex:index }); + // } /** * Change rows asynchronously according to page results */ - changeResultsPerPage(){ - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.changeresultsperpage); - } + // changeResultsPerPage(){ + // var tf = this.tf; + // var evt = tf.Evt; + // tf.EvtManager(evt.name.changeresultsperpage); + // } /** * Re-set asynchronously page nb at page re-load */ - resetPage(){ - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.resetpage); - } + // resetPage(){ + // var tf = this.tf; + // var evt = tf.Evt; + // tf.EvtManager(evt.name.resetpage); + // } /** * Re-set asynchronously page length at page re-load */ - resetPageLength(){ - var tf = this.tf; - var evt = tf.Evt; - tf.EvtManager(evt.name.resetpagelength); - } + // resetPageLength(){ + // var tf = this.tf; + // var evt = tf.Evt; + // tf.EvtManager(evt.name.resetpagelength); + // } /** * Change the page according to passed index * @param {Number} index Index of the page (0-n) */ - _changePage(index){ + changePage(index){ var tf = this.tf; if(!this.isEnabled()){ return; } + + this.emitter.emit('before-changing-page', tf, index); + if(index === null){ index = this.pageSelectorType===tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : (this.pagingSlc.value-1); @@ -635,18 +639,23 @@ export class Paging extends Feature{ this.onAfterChangePage.call(null, this, index); } } + + this.emitter.emit('after-changing-page', tf, index); } /** * Change rows according to page results drop-down * TODO: accept a parameter setting the results per page length */ - _changeResultsPerPage(){ + changeResultsPerPage(){ var tf = this.tf; if(!this.isEnabled()){ return; } + + this.emitter.emit('before-changing-results-per-page', tf); + var slcR = this.resultsPerPageSlc; var slcPagesSelIndex = (this.pageSelectorType===tf.fltTypeSlc) ? this.pagingSlc.selectedIndex : @@ -670,33 +679,55 @@ export class Paging extends Feature{ tf.feature('store').savePageLength(tf.pgLenCookie); } } + + this.emitter.emit('after-changing-results-per-page', tf); + } + + /** + * Re-set persisted pagination info + */ + resetValues(){ + var tf = this.tf; + if(tf.rememberPageLen){ + this.resetPageLength(tf.pgLenCookie); + } + if(tf.rememberPageNb){ + this.resetPage(tf.pgNbCookie); + } } /** * Re-set page nb at page re-load */ - _resetPage(name){ + resetPage(name){ var tf = this.tf; + if(!this.isEnabled()){ + return; + } + this.emitter.emit('before-reset-page', tf); var pgnb = tf.feature('store').getPageNb(name); - if(pgnb!==''){ + if(pgnb !== ''){ this.changePage((pgnb-1)); } + this.emitter.emit('after-reset-page', tf, pgnb); } /** * Re-set page length value at page re-load */ - _resetPageLength(name){ + resetPageLength(name){ var tf = this.tf; if(!this.isEnabled()){ return; } + this.emitter.emit('before-reset-page-length', tf); var pglenIndex = tf.feature('store').getPageLength(name); if(pglenIndex!==''){ this.resultsPerPageSlc.options[pglenIndex].selected = true; this.changeResultsPerPage(); } + this.emitter.emit('after-reset-page-length', tf, pglenIndex); } /** @@ -769,6 +800,7 @@ export class Paging extends Feature{ } this.emitter.off('after-filtering', ()=> this.resetPagingInfo()); + this.emitter.off('initialized', ()=> this.resetValues()); this.pagingSlc = null; this.nbPages = 0; diff --git a/src/modules/statusBar.js b/src/modules/statusBar.js index e5764727..9901a7b3 100644 --- a/src/modules/statusBar.js +++ b/src/modules/statusBar.js @@ -2,7 +2,7 @@ import {Feature} from './feature'; import Dom from '../dom'; import Types from '../types'; -var global = window; +let global = window; export class StatusBar extends Feature{ @@ -14,7 +14,7 @@ export class StatusBar extends Feature{ super(tf, 'statusBar'); // Configuration object - var f = this.config; + let f = this.config; //id of custom container element this.statusBarTgtId = f.status_bar_target_id || null; @@ -38,6 +38,36 @@ export class StatusBar extends Feature{ this.onAfterShowMsg = Types.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + //status messages + 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)...'; + // status bar div this.prfxStatus = 'status_'; // status bar label @@ -51,16 +81,17 @@ export class StatusBar extends Feature{ return; } - var tf = this.tf; + let tf = this.tf; + let emitter = this.emitter; //status bar container - var statusDiv = Dom.create('div', ['id', this.prfxStatus+tf.id]); + let statusDiv = Dom.create('div', ['id', this.prfxStatus+tf.id]); statusDiv.className = this.statusBarCssClass; //status bar label - var statusSpan = Dom.create('span', ['id', this.prfxStatusSpan+tf.id]); + let statusSpan = Dom.create('span', ['id', this.prfxStatusSpan+tf.id]); //preceding text - var statusSpanText = Dom.create('span', + let statusSpanText = Dom.create('span', ['id', this.prfxStatusTxt+tf.id]); statusSpanText.appendChild(Dom.text(this.statusBarText)); @@ -68,7 +99,7 @@ export class StatusBar extends Feature{ if(!this.statusBarTgtId){ tf.setToolbar(); } - var targetEl = (!this.statusBarTgtId) ? + let targetEl = (!this.statusBarTgtId) ? tf.lDiv : Dom.id(this.statusBarTgtId); //default container: 'lDiv' @@ -86,6 +117,32 @@ export class StatusBar extends Feature{ this.statusBarSpan = statusSpan; this.statusBarSpanText = statusSpanText; + // Subscribe to events + emitter.on('before-filtering', ()=> this.message(this.msgFilter)); + emitter.on('after-filtering', ()=> this.message('')); + emitter.on('before-populating-filter', + ()=> this.message(this.msgPopulate)); + emitter.on('after-populating-filter', ()=> this.message('')); + emitter.on('before-changing-page', + ()=> this.message(this.msgChangePage)); + emitter.on('after-changing-page', ()=> this.message('')); + emitter.on('before-clearing-filters', ()=> this.message(this.msgClear)); + emitter.on('after-clearing-filters', ()=> this.message('')); + emitter.on('before-changing-results-per-page', + ()=> this.message(this.msgChangeResults)); + emitter.on('after-changing-results-per-page', ()=> this.message('')); + emitter.on('before-reset-page', ()=> this.message(this.msgResetPage)); + emitter.on('after-reset-page', ()=> this.message('')); + emitter.on('before-reset-page-length', + ()=> this.message(this.msgResetPageLength)); + emitter.on('after-reset-page-length', ()=> this.message('')); + emitter.on('before-loading-extensions', + ()=> this.message(this.msgLoadExtensions)); + emitter.on('after-loading-extensions', ()=> this.message('')); + emitter.on('before-loading-themes', + ()=> this.message(this.msgLoadThemes)); + emitter.on('after-loading-themes', ()=> this.message('')); + this.initialized = true; } @@ -98,8 +155,11 @@ export class StatusBar extends Feature{ this.onBeforeShowMsg.call(null, this.tf, t); } - var d = t==='' ? this.statusBarCloseDelay : 1; + let d = t==='' ? this.statusBarCloseDelay : 1; global.setTimeout(() => { + if(!this.initialized){ + return; + } this.statusBarSpan.innerHTML = t; if(this.onAfterShowMsg){ this.onAfterShowMsg.call(null, this.tf, t); @@ -112,11 +172,41 @@ export class StatusBar extends Feature{ return; } + let emitter = this.emitter; + this.statusBarDiv.innerHTML = ''; Dom.remove(this.statusBarDiv); this.statusBarSpan = null; this.statusBarSpanText = null; this.statusBarDiv = null; + + // Unsubscribe to events + emitter.off('before-filtering', ()=> this.message(this.msgFilter)); + emitter.off('after-filtering', ()=> this.message('')); + emitter.off('before-populating-filter', + ()=> this.message(this.msgPopulate)); + emitter.off('after-populating-filter', ()=> this.message('')); + emitter.off('before-changing-page', + ()=> this.message(this.msgChangePage)); + emitter.off('after-changing-page', ()=> this.message('')); + emitter.off('before-clearing-filters', + ()=> this.message(this.msgClear)); + emitter.off('after-clearing-filters', ()=> this.message('')); + emitter.off('before-changing-results-per-page', + ()=> this.message(this.msgChangeResults)); + emitter.off('after-changing-results-per-page', ()=> this.message('')); + emitter.off('before-reset-page', ()=> this.message(this.msgResetPage)); + emitter.off('after-reset-page', ()=> this.message('')); + emitter.off('before-reset-page-length', + ()=> this.message(this.msgResetPageLength)); + emitter.off('after-reset-page-length', ()=> this.message('')); + emitter.off('before-loading-extensions', + ()=> this.message(this.msgLoadExtensions)); + emitter.off('after-loading-extensions', ()=> this.message('')); + emitter.off('before-loading-themes', + ()=> this.message(this.msgLoadThemes)); + emitter.off('after-loading-themes', ()=> this.message('')); + this.initialized = false; } diff --git a/src/tablefilter.js b/src/tablefilter.js index 1f3ddbfb..117d6ce4 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -370,34 +370,34 @@ export class TableFilter { /*** 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)...'; + // 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 @@ -457,19 +457,19 @@ export class TableFilter { /*** TF events ***/ this.Evt = { - name: { - filter: 'Filter', - dropdown: 'DropDown', - checklist: 'CheckList', - changepage: 'ChangePage', - clear: 'Clear', - changeresultsperpage: 'ChangeResults', - resetvalues: 'ResetValues', - resetpage: 'ResetPage', - resetpagelength: 'ResetPageLength', - loadextensions: 'LoadExtensions', - loadthemes: 'LoadThemes' - }, + // name: { + // //filter: 'Filter', + // //dropdown: 'DropDown', + // // checklist: 'CheckList', + // // changepage: 'ChangePage', + // // clear: 'Clear', + // // changeresultsperpage: 'ChangeResults', + // // resetvalues: 'ResetValues', + // // resetpage: 'ResetPage', + // // resetpagelength: 'ResetPageLength', + // // loadextensions: 'LoadExtensions', + // // loadthemes: 'LoadThemes' + // }, // Detect key detectKey(e) { @@ -573,7 +573,7 @@ export class TableFilter { // select is populated when element has focus if(this.loadFltOnDemand && elm.getAttribute('filled') === '0'){ let ct = elm.getAttribute('ct'); - this.Mod.dropdown._build(ct); + this.Mod.dropdown.build(ct); } if(this.popupFilters){ Event.cancel(_ev); @@ -593,7 +593,7 @@ export class TableFilter { let elm = Event.target(_ev); if(this.loadFltOnDemand && elm.getAttribute('filled') === '0'){ let ct = elm.getAttribute('ct'); - this.Mod.checkList._build(ct); + this.Mod.checkList.build(ct); this.Mod.checkList.checkListDiv[ct].onclick = null; this.Mod.checkList.checkListDiv[ct].title = ''; } @@ -759,7 +759,7 @@ export class TableFilter { this.fltIds.push(this.prfxFlt+i+'_'+this.id); if(!this.loadFltOnDemand){ - dropdown._build(i); + dropdown.build(i); } Event.add(slc, 'keypress', @@ -797,7 +797,7 @@ export class TableFilter { checkList.checkListDiv[i] = divCont; this.fltIds.push(this.prfxFlt+i+'_'+this.id); if(!this.loadFltOnDemand){ - checkList._build(i); + checkList.build(i); } if(this.loadFltOnDemand){ @@ -958,80 +958,81 @@ export class TableFilter { * @param {String} evt Event name * @param {Object} cfg Config object */ - EvtManager(evt, - cfg={ slcIndex: null, slcExternal: false, slcId: null, pgIndex: null }){ - let slcIndex = cfg.slcIndex; - let slcExternal = cfg.slcExternal; - let slcId = cfg.slcId; - let pgIndex = cfg.pgIndex; - let cpt = this.Mod; + // EvtManager(evt/*, + // cfg={ slcIndex: null, slcExternal: false, slcId: null, pgIndex: null } + // */){ + // // let slcIndex = cfg.slcIndex; + // // let slcExternal = cfg.slcExternal; + // // let slcId = cfg.slcId; + // // let pgIndex = cfg.pgIndex; + // let cpt = this.Mod; - function efx(){ - /*jshint validthis:true */ - let ev = this.Evt.name; + // function efx(){ + // /*jshint validthis:true */ + // // let ev = this.Evt.name; - switch(evt){ - case ev.filter: - this._filter(); - break; - case ev.dropdown: - if(this.linkedFilters){ - cpt.dropdown._build(slcIndex, true); - } else { - cpt.dropdown._build( - slcIndex, false, slcExternal, slcId); - } - break; - case ev.checklist: - cpt.checkList._build(slcIndex, slcExternal, slcId); - break; - case ev.changepage: - cpt.paging._changePage(pgIndex); - break; - case ev.clear: - this._clearFilters(); - this._filter(); - break; - case ev.changeresultsperpage: - cpt.paging._changeResultsPerPage(); - break; - case ev.resetvalues: - this._resetValues(); - this._filter(); - break; - case ev.resetpage: - cpt.paging._resetPage(this.pgNbCookie); - break; - case ev.resetpagelength: - cpt.paging._resetPageLength(this.pgLenCookie); - break; - case ev.loadextensions: - this._loadExtensions(); - break; - case ev.loadthemes: - this._loadThemes(); - break; - } - if(this.statusBar){ - cpt.statusBar.message(''); - } - if(this.loader){ - cpt.loader.show('none'); - } - } + // // switch(evt){ + // // case ev.filter: + // // this._filter(); + // // break; + // // case ev.dropdown: + // // if(this.linkedFilters){ + // // cpt.dropdown._build(slcIndex, true); + // // } else { + // // cpt.dropdown._build( + // // slcIndex, false, slcExternal, slcId); + // // } + // // break; + // // case ev.checklist: + // // cpt.checkList._build(slcIndex, slcExternal, slcId); + // // break; + // // case ev.changepage: + // // cpt.paging._changePage(pgIndex); + // // break; + // // case ev.clear: + // // this._clearFilters(); + // // this.filter(); + // // break; + // // case ev.changeresultsperpage: + // // cpt.paging._changeResultsPerPage(); + // // break; + // // case ev.resetvalues: + // // this._resetValues(); + // // this.filter(); + // // break; + // // case ev.resetpage: + // // cpt.paging._resetPage(this.pgNbCookie); + // // break; + // // case ev.resetpagelength: + // // cpt.paging._resetPageLength(this.pgLenCookie); + // // break; + // // case ev.loadextensions: + // // this._loadExtensions(); + // // break; + // // case ev.loadthemes: + // // this._loadThemes(); + // // break; + // // } + // if(this.statusBar){ + // cpt.statusBar.message(''); + // } + // if(this.loader){ + // cpt.loader.show('none'); + // } + // } - if(!this.loader && !this.statusBar && !this.linkedFilters) { - efx.call(this); - } else { - if(this.loader){ - cpt.loader.show(''); - } - if(this.statusBar){ - cpt.statusBar.message(this['msg'+evt]); - } - global.setTimeout(efx.bind(this), this.execDelay); - } - } + // if(!this.loader && !this.statusBar && !this.linkedFilters) { + // efx.call(this); + // } else { + // if(this.loader){ + // cpt.loader.show(''); + // } + // if(this.statusBar){ + // cpt.statusBar.message(this['msg'+evt]); + // } + // global.setTimeout(efx.bind(this), this.execDelay); + // } + // } /** * Return a feature instance for a given name @@ -1048,12 +1049,14 @@ export class TableFilter { initExtensions(){ let exts = this.extensions; + this.emitter.emit('before-loading-extensions', this); for(let i=0, len=exts.length; i0, true, 'Matches'); }); test('After filtering with `ade`', function() { tf.setFilterValue(0, 'ade'); - tf._filter(); + tf.filter(); deepEqual(tf.getValidRows().length, 0, 'No matches'); }); test('After filtering with `Ade`', function() { tf.setFilterValue(0, 'Ade'); - tf._filter(); + tf.filter(); deepEqual(tf.getValidRows().length>0, true, 'Matches'); }); diff --git a/test/test-exact-query-match.js b/test/test-exact-query-match.js index c4254a4c..7d5683b6 100644 --- a/test/test-exact-query-match.js +++ b/test/test-exact-query-match.js @@ -14,13 +14,13 @@ module('Behaviour'); test('After filtering with `syd`', function() { tf.setFilterValue(0, 'syd'); - tf._filter(); + tf.filter(); deepEqual(tf.getValidRows().length, 0, 'No matches'); }); test('After filtering with `sydney`', function() { tf.setFilterValue(0, 'sydney'); - tf._filter(); + tf.filter(); deepEqual(tf.getValidRows().length>0, true, 'Matches'); }); @@ -42,14 +42,14 @@ test('After filtering with `syd`', function() { tf.setFilterValue(0, 'syd'); tf.setFilterValue(1, 'bris'); - tf._filter(); + tf.filter(); deepEqual(tf.getValidRows().length, 0, 'No matches'); }); test('After filtering with `sydney`', function() { tf.clearFilters(); tf.setFilterValue(0, 'sydney'); - tf._filter(); + tf.filter(); deepEqual(tf.getValidRows().length>0, true, 'Matches'); }); diff --git a/test/test-highlight-keywords.js b/test/test-highlight-keywords.js index 05618f6b..98a9ae0c 100644 --- a/test/test-highlight-keywords.js +++ b/test/test-highlight-keywords.js @@ -16,12 +16,12 @@ test('HighlightKeyword component', function() { test('Highlighted keywords', function() { tf.setFilterValue(1, 'Perth'); tf.setFilterValue(3, '3.1'); - tf._filter(); + tf.filter(); deepEqual(highlightKeyword.highlightedNodes.length, 2, 'Number of highlighted words'); - tf._clearFilters(); - tf._filter(); + tf.clearFilters(); + tf.filter(); deepEqual(highlightKeyword.highlightedNodes.length, 0, 'Number of highlighted words'); }); @@ -29,7 +29,7 @@ test('Highlighted keywords', function() { module('Tear-down'); test('can destroy TableFilter DOM elements', function() { tf.setFilterValue(1, 'Perth'); - tf._filter(); + tf.filter(); tf.destroy(); deepEqual(tf.hasGrid(), false, 'Filters removed'); deepEqual(highlightKeyword.highlightedNodes.length, diff --git a/test/test-linked-filters.js b/test/test-linked-filters.js index ec73b3b2..bab19248 100644 --- a/test/test-linked-filters.js +++ b/test/test-linked-filters.js @@ -12,14 +12,14 @@ tf.init(); tf.setFilterValue(0, 'Sydney'); tf.getFilterElement(0).focus(); - tf._filter(); + tf.filter(); module('Sanity checks'); test('Linked filters feature', function() { deepEqual(tf instanceof TableFilter, true, 'TableFilter instantiated'); deepEqual(tf.linkedFilters, true, 'Linked filters enabled'); - tf._clearFilters(); + tf.clearFilters(); tf.onAfterFilter = null; tf.destroy(); tf = null; @@ -54,7 +54,7 @@ tf.init(); tf.setFilterValue(0, 'Sydney'); tf.getFilterElement(0).focus(); - tf._filter(); + tf.filter(); } function testExcludedOptions(tf){ @@ -75,7 +75,7 @@ }); tf.onAfterFilter = null; - tf.clearFilters(); + setTimeout(tf.clearFilters, 0); } // Tests for https://github.com/koalyptus/TableFilter/pull/42 issue diff --git a/test/test-load-filters-on-demand.js b/test/test-load-filters-on-demand.js index 77ea1c90..e01faba9 100644 --- a/test/test-load-filters-on-demand.js +++ b/test/test-load-filters-on-demand.js @@ -18,7 +18,7 @@ var flt3Cont = id(flt3ContId); function buildChecklist(tf, colIdx){ var checkList = tf.feature('checkList'); - checkList._build(colIdx); + checkList.build(colIdx); checkList.checkListDiv[colIdx].onclick = null; checkList.checkListDiv[colIdx].title = ''; } diff --git a/test/test-no-results-message.js b/test/test-no-results-message.js index 7bf45cf2..58de2aa0 100644 --- a/test/test-no-results-message.js +++ b/test/test-no-results-message.js @@ -62,7 +62,7 @@ test('No Results Feature', function() { module('Behaviour'); test('Can display no results message', function() { tf.setFilterValue(0, 'sadasd'); - tf._filter(); + tf.filter(); deepEqual(tf.getValidRows().length, 0, 'Filtered rows number'); deepEqual(noResults.cont.innerHTML, 'No results', 'No results message'); deepEqual(noResults.cont.style.display, 'block', @@ -107,7 +107,7 @@ test('External container sanity checks', function() { test('Can display external no results message', function() { tfCustom.setFilterValue(0, 'sadasd'); - tfCustom._filter(); + tfCustom.filter(); deepEqual(noResultsCustom.cont.innerHTML, '

No results found

', 'No results message markup'); deepEqual(noResultsCustom.cont.style.display, 'block', @@ -147,7 +147,7 @@ test('Sanity checks', function() { test('Can display no results message in grid layout', function() { tfGl.setFilterValue(0, 'sadasd'); - tfGl._filter(); + tfGl.filter(); deepEqual(noResultsGl.cont.innerHTML, 'No results', 'No results message'); deepEqual(noResultsGl.cont.style.display, 'block', From fd8d5c759c24c51a5bbc3655ea5acc0e2f0459a9 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Sun, 3 Jan 2016 13:49:04 +1100 Subject: [PATCH 15/41] Improved emitter logic --- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 10 +- dist/tablefilter/tf-1.js | 4 +- src/emitter.js | 31 ++-- src/extensions/colOps/colOps.js | 4 +- src/extensions/sort/adapterSortabletable.js | 2 +- src/modules/alternateRows.js | 20 +- src/modules/checkList.js | 14 -- src/modules/dropdown.js | 20 -- src/modules/highlightKeywords.js | 4 +- src/modules/loader.js | 88 +++++---- src/modules/noResults.js | 5 +- src/modules/paging.js | 45 +---- src/modules/popupFilter.js | 12 +- src/modules/rowsCounter.js | 22 +-- src/modules/statusBar.js | 87 +++++---- src/modules/store.js | 4 +- src/tablefilter.js | 171 ++---------------- test/test-emitter.js | 8 +- 24 files changed, 183 insertions(+), 380 deletions(-) diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 80688d82..3779b3ab 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-02T14:26:21.155Z + * build date: 2016-01-03T02:45:10.758Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index ba14da32..67cc527c 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-02T14:26:21.155Z + * build date: 2016-01-03T02:45:10.758Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index ce164e94..2a89b76b 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-02T14:26:21.155Z + * build date: 2016-01-03T02:45:10.758Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 0a266cb1..7872e7dd 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-02T14:26:21.155Z + * build date: 2016-01-03T02:45:10.758Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 248861ee..0a3e5b6f 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-02T14:26:21.155Z + * build date: 2016-01-03T02:45:10.758Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index f96ae82f..4ec95869 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-02T14:26:21.155Z + * build date: 2016-01-03T02:45:10.758Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 5f528a45..ee3c1c89 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,10 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-02T14:26:21.070Z + * build date: 2016-01-03T02:45:10.664Z * MIT License */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,a){for(var r,l,o=0,h=[];or;r++)s[r]=arguments[r];if(0!==s.length){if(this.id=null,this.version="0.1.4",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var l=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=l.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=l.grid===!1?!1:!0,this.gridLayout=Boolean(l.grid_layout),this.filtersRowIndex=isNaN(l.filters_row_index)?0:l.filters_row_index,this.headersRow=isNaN(l.headers_row_index)?0===this.filtersRowIndex?1:0:l.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==l.filters_cell_tag||"td"!==l.filters_cell_tag?"td":l.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=l.inf_div_css_class||"inf",this.lDivCssClass=l.left_div_css_class||"ldiv",this.rDivCssClass=l.right_div_css_class||"rdiv",this.mDivCssClass=l.middle_div_css_class||"mdiv",this.contDivCssClass=l.content_div_css_class||"cont",this.stylePath=l.style_path||this.basePath+"style/",this.stylesheet=l.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=l.flts_row_css_class||"fltrow",this.enableIcons=l.enable_icons===!1?!1:!0,this.alternateRows=Boolean(l.alternate_rows),this.hasColWidths=v["default"].isArray(l.col_widths),this.colWidths=this.hasColWidths?l.col_widths:null,this.fltCssClass=l.flt_css_class||"flt",this.fltMultiCssClass=l.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=l.flt_small_css_class||"flt_s",this.singleFltCssClass=l.single_flt_css_class||"single_flt",this.enterKey=l.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(l.on_before_filter)?l.on_before_filter:null,this.onAfterFilter=v["default"].isFn(l.on_after_filter)?l.on_after_filter:null,this.caseSensitive=Boolean(l.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(l.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?l.columns_exact_match:[],this.exactMatch=Boolean(l.exact_match),this.linkedFilters=Boolean(l.linked_filters),this.disableExcludedOptions=Boolean(l.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(l.rows_always_visible),this.visibleRows=this.hasVisibleRows?l.rows_always_visible:[],this.isExternalFlt=Boolean(l.external_flt_grid),this.externalFltTgtIds=l.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(l.exec_delay)?100:parseInt(l.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(l.on_filters_loaded)?l.on_filters_loaded:null,this.singleSearchFlt=Boolean(l.single_filter),this.onRowValidated=v["default"].isFn(l.on_row_validated)?l.on_row_validated:null,this.customCellDataCols=l.custom_cell_data_cols?l.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(l.custom_cell_data)?l.custom_cell_data:null,this.watermark=l.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=l.toolbar_target_id||null,this.help=v["default"].isUndef(l.help_instructions)?void 0:Boolean(l.help_instructions),this.popupFilters=Boolean(l.popup_filters),this.markActiveColumns=Boolean(l.mark_active_columns),this.activeColumnsCssClass=l.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(l.on_before_active_column)?l.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(l.on_after_active_column)?l.on_after_active_column:null,this.displayAllText=l.display_all_text||"Clear",this.enableEmptyOption=Boolean(l.enable_empty_option),this.emptyText=l.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(l.enable_non_empty_option),this.nonEmptyText=l.non_empty_text||"(Non empty)",this.onSlcChange=l.on_change===!1?!1:!0,this.sortSlc=l.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(l.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?l.sort_num_asc:null,this.isSortNumDesc=Boolean(l.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?l.sort_num_desc:null,this.loadFltOnDemand=Boolean(l.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(l.custom_options),this.customOptions=l.custom_options,this.rgxOperator=l.regexp_operator||"rgx:",this.emOperator=l.empty_operator||"[empty]",this.nmOperator=l.nonempty_operator||"[nonempty]",this.orOperator=l.or_operator||"||",this.anOperator=l.and_operator||"&&",this.grOperator=l.greater_operator||">",this.lwOperator=l.lower_operator||"<",this.leOperator=l.lower_equal_operator||"<=",this.geOperator=l.greater_equal_operator||">=",this.dfOperator=l.different_operator||"!",this.lkOperator=l.like_operator||"*",this.eqOperator=l.equal_operator||"=",this.stOperator=l.start_with_operator||"{",this.enOperator=l.end_with_operator||"}",this.curExp=l.cur_exp||"^[¥£€$]",this.separator=l.separator||",",this.rowsCounter=Boolean(l.rows_counter),this.statusBar=Boolean(l.status_bar),this.loader=Boolean(l.loader),this.displayBtn=Boolean(l.btn),this.btnText=l.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=l.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(l.btn_reset),this.btnResetCssClass=l.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(l.on_before_reset)?l.on_before_reset:null,this.onAfterReset=v["default"].isFn(l.on_after_reset)?l.on_after_reset:null,this.paging=Boolean(l.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(l.auto_filter),this.autoFilterDelay=isNaN(l.auto_filter_delay)?900:l.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(l.highlight_keywords),this.noResults=v["default"].isObj(l.no_results_message)||Boolean(l.no_results_message),this.defaultDateType=l.default_date_type||"DMY",this.thousandsSeparator=l.thousands_separator||",",this.decimalSeparator=l.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(l.col_number_format),this.colNbFormat=this.hasColNbFormat?l.col_number_format:null,this.hasColDateType=v["default"].isArray(l.col_date_type),this.colDateType=this.hasColDateType?l.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(l.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&l.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&l.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=l.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(l.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(l.themes),this.themes=l.themes||[],this.themesPath=l.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),n=s._ezEditTable;s.cfg.editable&&n.Editable.Remove(),s.cfg.selection&&n.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown.build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList.build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return r(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=void 0;if(!this.gridLayout){var a=u["default"].tag(this.tbl,"thead");n=a.length>0?a[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,n.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(n.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var r=0;i>r;r++){this.popupFilters&&e.popupFilter.build(r);var l=u["default"].create(this.fltCellTag),h=this.getFilterType(r),f=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[r]:null;if(this.singleSearchFlt&&(l.colSpan=this.nbCells),this.gridLayout||n.appendChild(l),s=r==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+r+"_"+this.id],["ct",r],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=d["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,f?(u["default"].id(f).appendChild(p),this.externalFltEls.push(p)):l.appendChild(p),this.fltIds.push(this.prfxFlt+r+"_"+this.id),this.loadFltOnDemand||c.build(r),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+r+"_"+this.id],["ct",r],["filled","0"]);b.className=v.checkListDivCssClass,f?(u["default"].id(f).appendChild(b),this.externalFltEls.push(b)):l.appendChild(b),v.checkListDiv[r]=b,this.fltIds.push(this.prfxFlt+r+"_"+this.id),this.loadFltOnDemand||v.build(r),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",y=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+r+"_"+this.id],["type",m],["ct",r]);if("hidden"!==m&&this.watermark&&y.setAttribute("placeholder",this.isWatermarkArray?this.watermark[r]||"":this.watermark),y.className=s,o["default"].add(y,"focus",this.Evt.onInpFocus.bind(this)),f?(u["default"].id(f).appendChild(y),this.externalFltEls.push(y)):l.appendChild(y),this.fltIds.push(this.prfxFlt+r+"_"+this.id),o["default"].add(y,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(y,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(y,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(y,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var _=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=_[r]&&this.setFilterValue(r,_[r],!1)}}if(r==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+r+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,f?u["default"].id(f).appendChild(C):l.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on("after-filtering",function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new M.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on("before-filtering",function(){return t.clearActiveColumns()}),this.emitter.on("cell-processed",function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on("after-filtering",function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;this.emitter.emit("before-loading-extensions",this);for(var e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,a=void 0;s&&n?a=t.path+s:(s=s.replace(".js",""),a="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var n=[i(26)("./"+a)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],a=n.name,r=n.path,l=this.prfxTf+a;a&&!r?r=this.themesPath+a+"/"+a+".css":!a&&n.path&&(a="theme{0}".replace("{0}",i)),this.isImported(r,"link")||this["import"](l,r,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off("before-filtering",function(){return t.clearActiveColumns()}),this.emitter.off("cell-processed",function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],a=i.indexOf(t),r=e.values[a],l=e.texts[a],o=e.sorts[a],h=0,u=r.length;u>h;h++)n.push(r[h]),l[h]?s.push(l[h]):s.push(r[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==a[h]&&(r=u["default"].createOpt(a[h],a[h],!0),o.appendChild(r),this.hasStoredValues=!0)}}else if(l===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),a=e[n].split(" "+this.orOperator+" ");for(var h=0,f=a.length;f>h;h++)if(""!==a[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),a[h],a[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(l.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=l.test(t),T=f.test(t),k=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),M=x&&_["default"].isValid(t.replace(l,""),O),B=T&&_["default"].isValid(t.replace(f,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=R&&_["default"].isValid(t.replace(c,""),O),j=P&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):M?(U=_["default"].format(t.replace(l,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):B?(U=_["default"].format(t.replace(f,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(a=n(e,this.colNbFormat[i]),r=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=n(e,"us"),r="us"):(a=n(e,"eu"),r="eu"),x)s=a<=n(t.replace(l,""),r);else if(k)s=a>=n(t.replace(o,""),r);else if(u)s=an(t.replace(f,""),r);else if(R)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var a,r,l=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),M=D.length>1?!0:!1;if(N||M){for(var B=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(B=d["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,T[I]),!N||!A)&&(!M||A);j++);R[I]=A}else R[I]=e.call(this,d["default"].trim(S),E,I),t.call(this,S,R[I],T[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,a=[];e&&a.push(this.getHeadersText()[t]);for(var r=this.refRow;r0&&(l=-1!=s.indexOf(r));var o=n[r].cells,h=o.length;if(h===this.nbCells&&!l)for(var u=0;h>u;u++)if(u==t&&""===n[r].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;a.push(c)}}return a}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,a=i.options.length;a>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var a=this.getFilterType(s);if(a===d["default"].lower(t)){var r=e?s:this.fltIds[s];i.push(r)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sr;r++){var o=this.getCellData(a[r]);n[1].push(o)}i.push(n)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),n=0;nn;n++){var r=i[n],l=r[1],o=l[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;ta;a++){var l=i.options[a];(""===n||""===n[0])&&(l.selected=!1),""===l.value&&(l.selected=!1),""!==l.value&&m["default"].has(n,l.value,!0)&&(l.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,a=n?null:H.createDocumentFragment(),r=0;t>r;r++){var l=void 0;n?l=s[r]:(l=u["default"].create("col",["id",this.id+"_col_"+r]),a.appendChild(l)),l.style.width=i[r]}n||e.insertBefore(a,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var a=void 0,r=0,l=s.length;l>r;r++){var o=u["default"].id(this.fltIds[s[r]]);if(a=this.getFilterValue(s[r]),n!==s[r]||this.paging&&-1!=t.indexOf(s[r])&&n===s[r]||!this.paging&&(-1!=i.indexOf(s[r])||-1!=e.indexOf(s[r]))||a===this.displayAllText){if(-1!=i.indexOf(s[r])?this.Mod.checkList.checkListDiv[s[r]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[r])?this.Mod.checkList.build(s[r]):this.Mod.dropdown.build(s[r],!0),this.setFilterValue(s[r],a)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var a=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,a)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var r=this.externalFltTgtIds,l=0,o=r.length;o>l;l++){var h=u["default"].id(r[l]);if(h){var f=this.externalFltEls[l];h.appendChild(f);var d=this.getFilterType(l);this.gridLayout&&""===f.innerHTML&&d!==this.fltTypeInp&&((d===this.fltTypeSlc||d===this.fltTypeMulti)&&t.dropdown.build(l),d===this.fltTypeCheckList&&t.checkList.build(l))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",a=u["default"].tag(H,s),r=0,l=a.length;l>r;r++)if(void 0!==a[r][n]&&a[r][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",a=this.isImported(e,n);if(!a){var r=this,l=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(l=!0,"function"==typeof i&&i.call(null,r))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var a=s.indexOf(";",n);-1===a&&(a=s.length),e=unescape(s.substring(n,a))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var a=t.split(RegExp.$1),r=void 0,l=void 0,o=void 0;r="M"===e.substring(0,1)?a[0]:"M"===e.substring(1,2)?a[1]:a[2],l="D"===e.substring(0,1)?a[0]:"D"===e.substring(1,2)?a[1]:a[2],o="Y"===e.substring(0,1)?a[0]:"Y"===e.substring(1,2)?a[1]:a[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(r,10)-1,parseInt(l,10),0,0,0,0);return parseInt(l,10)!=h.getDate()?!1:parseInt(r,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,a=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(a[2]),s(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===a["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return r(i,e),l(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var a=this.popUpFltElms[n],r=this.tf.getHeaderElement(n),l=.95*r.clientWidth;a.style.width=parseInt(l,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&n.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(m))&&(void 0===d||d==t||d!=t&&-1!=n.validRowsIndex.indexOf(m)))){var w=n.getCellData(y[C]),x=f["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&n.disableExcludedOptions){var T=b[C];T||(T=n.getFilteredDataCol(C)),h["default"].has(T,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var k=n.getCustomOptions(t);this.opts=k[0],this.optsTxt=k[1]}if(n.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,r,e,v,p,g),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addOptions",value:function(t,e,i,s,n,a){var r=this.tf,o=f["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var d=0;d"+p+""}else{var b;b=r.loadFltOnDemand&&u===this.opts[d]&&r.getFilterType(t)===r.fltTypeSlc?l["default"].createOpt(p,c,!0):r.getFilterType(t)!==r.fltTypeMulti?l["default"].createOpt(p,c," "!==n[t]&&c===n[t]?!0:!1):l["default"].createOpt(p,c,h["default"].has(a,f["default"].matchCase(this.opts[d],r.matchCase),r.matchCase)||-1!==a.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=f["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=l["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=l["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var a=l["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(a)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={ignoreCase:function(t,e){var i=a["default"].lower(t),s=a["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===u[v].style.display&&!n.paging||n.paging&&(!d||d===t||d!=t&&-1!=n.validRowsIndex.indexOf(v)))){var _=n.getCellData(b[y]),C=f["default"].matchCase(_,n.matchCase);h["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=p[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),h["default"].has(w,C,n.matchCase)||h["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,n.separator),n.loadFltOnDemand&&(r.innerHTML=""),r.appendChild(o),r.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,n=this.addTChecks(t,e),a=[],r=s.feature("store"),o=r?r.getFilterValues(s.fltsValuesCookie)[t]:null;o&&f["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?a.push(o):a=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),a=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off("after-filtering",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("grouped-by-page",function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off("rows-changed",function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,l=t.nbRows;i.nbPages=Math.ceil((l-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return l(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0], -this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)a.innerHTML=this.btnPrevPageHtml,b["default"].add(a,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),a.appendChild(h)}if(this.btnLastPageHtml)r.innerHTML=this.btnLastPageHtml,b["default"].add(r,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),r.appendChild(u)}if(this.btnFirstPageHtml)l.innerHTML=this.btnFirstPageHtml,b["default"].add(l,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),l.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(l),c.appendChild(a);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(r),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on("after-filtering",function(){return e.resetPagingInfo()}),this.emitter.on("initialized",function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;na;a++){var l=e.validRowsIndex[a],o=i[l],h=o.getAttribute("validRow"),u=!1;a>=s&&n>a?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,l,a,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],a=this.resultsPerPage[1],r=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);r.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var l=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;r.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(r,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(l.appendChild(r),l.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),a=f["default"].id(this.prfxBtnFirstSpan+e.id),r=f["default"].id(this.prfxPgBeforeSpan+e.id),l=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),a&&(b["default"].remove(a,"click",h.first),f["default"].remove(a)),r&&f["default"].remove(r),l&&f["default"].remove(l),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off("after-filtering",function(){return t.resetPagingInfo()}),this.emitter.off("initialized",function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return r(e,t),l(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var a=u["default"].create("a",["href","javascript:void(0);"]);a.className=e.btnResetCssClass,a.appendChild(u["default"].text(this.btnResetText)),i.appendChild(a),d["default"].add(a,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return r(e,t),l(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var a=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var r=i.firstChild;d["default"].add(r,"click",function(){t.toggle()}),a.appendChild(s)}else{a.appendChild(s);var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=this.btnCssClass,l.appendChild(u["default"].text(this.btnText)),i.appendChild(l),d["default"].add(l,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&a.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=function(){function t(t,e){for(var i=0;ir;r++){var l=i?r:e[r];this.setRowBg(l,a),a++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off("after-filtering",function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,a){for(var l,r,o=0,h=[];ol;l++)s[l]=arguments[l];if(0!==s.length){if(this.id=null,this.version="0.1.4",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),n=s._ezEditTable;s.cfg.editable&&n.Editable.Remove(),s.cfg.selection&&n.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown.build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList.build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return l(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=void 0;if(!this.gridLayout){var a=u["default"].tag(this.tbl,"thead");n=a.length>0?a[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,n.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(n.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.popupFilters&&e.popupFilter.build(l);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(l),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[l]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||n.appendChild(r),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+l+"_"+this.id],["ct",l],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+l+"_"+this.id),this.loadFltOnDemand||c.build(l),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+l+"_"+this.id],["ct",l],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[l]=b,this.fltIds.push(this.prfxFlt+l+"_"+this.id),this.loadFltOnDemand||v.build(l),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",y=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+l+"_"+this.id],["type",m],["ct",l]);if("hidden"!==m&&this.watermark&&y.setAttribute("placeholder",this.isWatermarkArray?this.watermark[l]||"":this.watermark),y.className=s,o["default"].add(y,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(y),this.externalFltEls.push(y)):r.appendChild(y),this.fltIds.push(this.prfxFlt+l+"_"+this.id),o["default"].add(y,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(y,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(y,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(y,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var _=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=_[l]&&this.setFilterValue(l,_[l],!1)}}if(l==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+l+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new M.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;this.emitter.emit("before-loading-extensions",this);for(var e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,a=void 0;s&&n?a=t.path+s:(s=s.replace(".js",""),a="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var n=[i(26)("./"+a)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],a=n.name,l=n.path,r=this.prfxTf+a;a&&!l?l=this.themesPath+a+"/"+a+".css":!a&&n.path&&(a="theme{0}".replace("{0}",i)),this.isImported(l,"link")||this["import"](r,l,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],a=i.indexOf(t),l=e.values[a],r=e.texts[a],o=e.sorts[a],h=0,u=l.length;u>h;h++)n.push(l[h]),r[h]?s.push(r[h]):s.push(l[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==a[h]&&(l=u["default"].createOpt(a[h],a[h],!0),o.appendChild(l),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),a=e[n].split(" "+this.orOperator+" ");for(var h=0,d=a.length;d>h;h++)if(""!==a[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),a[h],a[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=d.test(t),k=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),M=x&&_["default"].isValid(t.replace(r,""),O),B=T&&_["default"].isValid(t.replace(d,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=R&&_["default"].isValid(t.replace(c,""),O),j=P&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):M?(U=_["default"].format(t.replace(r,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):B?(U=_["default"].format(t.replace(d,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(a=n(e,this.colNbFormat[i]),l=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=n(e,"us"),l="us"):(a=n(e,"eu"),l="eu"),x)s=a<=n(t.replace(r,""),l);else if(k)s=a>=n(t.replace(o,""),l);else if(u)s=an(t.replace(d,""),l);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var a,l,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),M=D.length>1?!0:!1;if(N||M){for(var B=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,T[I]),!N||!A)&&(!M||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],T[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,a=[];e&&a.push(this.getHeadersText()[t]);for(var l=this.refRow;l0&&(r=-1!=s.indexOf(l));var o=n[l].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[l].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;a.push(c)}}return a}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,a=i.options.length;a>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var a=this.getFilterType(s);if(a===f["default"].lower(t)){var l=e?s:this.fltIds[s];i.push(l)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sl;l++){var o=this.getCellData(a[l]);n[1].push(o)}i.push(n)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),n=0;nn;n++){var l=i[n],r=l[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;ta;a++){var r=i.options[a];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,a=n?null:H.createDocumentFragment(),l=0;t>l;l++){var r=void 0;n?r=s[l]:(r=u["default"].create("col",["id",this.id+"_col_"+l]),a.appendChild(r)),r.style.width=i[l]}n||e.insertBefore(a,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var a=void 0,l=0,r=s.length;r>l;l++){var o=u["default"].id(this.fltIds[s[l]]);if(a=this.getFilterValue(s[l]),n!==s[l]||this.paging&&-1!=t.indexOf(s[l])&&n===s[l]||!this.paging&&(-1!=i.indexOf(s[l])||-1!=e.indexOf(s[l]))||a===this.displayAllText){if(-1!=i.indexOf(s[l])?this.Mod.checkList.checkListDiv[s[l]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[l])?this.Mod.checkList.build(s[l]):this.Mod.dropdown.build(s[l],!0),this.setFilterValue(s[l],a)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var a=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,a)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var l=this.externalFltTgtIds,r=0,o=l.length;o>r;r++){var h=u["default"].id(l[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",a=u["default"].tag(H,s),l=0,r=a.length;r>l;l++)if(void 0!==a[l][n]&&a[l][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",a=this.isImported(e,n);if(!a){var l=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,l))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var a=s.indexOf(";",n);-1===a&&(a=s.length),e=unescape(s.substring(n,a))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var a=t.split(RegExp.$1),l=void 0,r=void 0,o=void 0;l="M"===e.substring(0,1)?a[0]:"M"===e.substring(1,2)?a[1]:a[2],r="D"===e.substring(0,1)?a[0]:"D"===e.substring(1,2)?a[1]:a[2],o="Y"===e.substring(0,1)?a[0]:"Y"===e.substring(1,2)?a[1]:a[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(l,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(l,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,a=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(a[2]),s(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===a["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return l(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var a=this.popUpFltElms[n],l=this.tf.getHeaderElement(n),r=.95*l.clientWidth;a.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&n.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=n.validRowsIndex.indexOf(m)))){var w=n.getCellData(y[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&n.disableExcludedOptions){var T=b[C];T||(T=n.getFilteredDataCol(C)),h["default"].has(T,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var k=n.getCustomOptions(t);this.opts=k[0],this.optsTxt=k[1]}if(n.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,l,e,v,p,g),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addOptions",value:function(t,e,i,s,n,a){var l=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=l.loadFltOnDemand&&u===this.opts[f]&&l.getFilterType(t)===l.fltTypeSlc?r["default"].createOpt(p,c,!0):l.getFilterType(t)!==l.fltTypeMulti?r["default"].createOpt(p,c," "!==n[t]&&c===n[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(a,d["default"].matchCase(this.opts[f],l.matchCase),l.matchCase)||-1!==a.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var a=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(a)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={ignoreCase:function(t,e){var i=a["default"].lower(t),s=a["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===u[v].style.display&&!n.paging||n.paging&&(!f||f===t||f!=t&&-1!=n.validRowsIndex.indexOf(v)))){var _=n.getCellData(b[y]),C=d["default"].matchCase(_,n.matchCase);h["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=p[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),h["default"].has(w,C,n.matchCase)||h["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,n.separator),n.loadFltOnDemand&&(l.innerHTML=""),l.appendChild(o),l.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,n=this.addTChecks(t,e),a=[],l=s.feature("store"),o=l?l.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?a.push(o):a=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),a=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),a=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)a.innerHTML=this.btnPrevPageHtml,b["default"].add(a,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),a.appendChild(h)}if(this.btnLastPageHtml)l.innerHTML=this.btnLastPageHtml,b["default"].add(l,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),l.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml, +b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(a);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(l),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,s=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;na;a++){var r=e.validRowsIndex[a],o=i[r],h=o.getAttribute("validRow"),u=!1;a>=s&&n>a?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,a,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],a=this.resultsPerPage[1],l=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);l.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;l.appendChild(d["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(l,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(l),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),n=d["default"].id(this.prfxBtnLastSpan+e.id),a=d["default"].id(this.prfxBtnFirstSpan+e.id),l=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),d["default"].remove(n)),a&&(b["default"].remove(a,"click",h.first),d["default"].remove(a)),l&&d["default"].remove(l),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return l(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.onClick()})}else{var a=u["default"].create("a",["href","javascript:void(0);"]);a.className=e.btnResetCssClass,a.appendChild(u["default"].text(this.btnResetText)),i.appendChild(a),f["default"].add(a,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return l(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var a=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var l=i.firstChild;f["default"].add(l,"click",function(){t.toggle()}),a.appendChild(s)}else{a.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&a.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;il;l++){var r=i?l:e[l];this.setRowBg(r,a),a++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 30d62f37..8f69e4e4 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,8 +1,8 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-02T14:26:21.070Z + * build date: 2016-01-03T02:45:10.664Z * MIT License */ -webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off("after-filtering",function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/src/emitter.js b/src/emitter.js index 5357bb6f..1e677b6d 100644 --- a/src/emitter.js +++ b/src/emitter.js @@ -12,23 +12,27 @@ export class Emitter { /** * Subscribe to an event - * @param {String} evt Event name + * @param {Array} evts Collection of event names * @param {Function} fn Function invoked when event is emitted */ - on(evt, fn) { - this.events[evt] = this.events[evt] || []; - this.events[evt].push(fn); + on(evts, fn) { + evts.forEach((evt)=> { + this.events[evt] = this.events[evt] || []; + this.events[evt].push(fn); + }); } /** * Unsubscribe to an event - * @param {String} evt Event name + * @param {Array} evts Collection of event names * @param {Function} fn Function invoked when event is emitted */ - off(evt, fn) { - if(evt in this.events) { - this.events[evt].splice(this.events[evt].indexOf(fn), 1); - } + off(evts, fn) { + evts.forEach((evt)=> { + if(evt in this.events) { + this.events[evt].splice(this.events[evt].indexOf(fn), 1); + } + }); } /** @@ -37,11 +41,10 @@ export class Emitter { * the invoked function */ emit(evt /*, args...*/) { - if(evt in this.events === false) { - return; - } - for(var i = 0; i < this.events[evt].length; i++) { - this.events[evt][i].apply(this, [].slice.call(arguments, 1)); + if(evt in this.events) { + for(let i = 0; i < this.events[evt].length; i++) { + this.events[evt][i].apply(this, [].slice.call(arguments, 1)); + } } } } diff --git a/src/extensions/colOps/colOps.js b/src/extensions/colOps/colOps.js index 899345d7..17fb63db 100644 --- a/src/extensions/colOps/colOps.js +++ b/src/extensions/colOps/colOps.js @@ -23,7 +23,7 @@ export default class ColOps{ init(){ // subscribe to events - this.tf.emitter.on('after-filtering', ()=> this.calc()); + this.tf.emitter.on(['after-filtering'], ()=> this.calc()); this.calc(); } @@ -315,7 +315,7 @@ export default class ColOps{ destroy(){ // unsubscribe to events - this.tf.emitter.off('after-filtering', ()=> this.calc()); + this.tf.emitter.off(['after-filtering'], ()=> this.calc()); } } diff --git a/src/extensions/sort/adapterSortabletable.js b/src/extensions/sort/adapterSortabletable.js index 004cd6e8..26eded55 100644 --- a/src/extensions/sort/adapterSortabletable.js +++ b/src/extensions/sort/adapterSortabletable.js @@ -46,7 +46,7 @@ export default class AdapterSortableTable{ opts.on_after_sort : null; this.tf = tf; - this.emitter = this.tf.emitter; + this.emitter = tf.emitter; } init(){ diff --git a/src/modules/alternateRows.js b/src/modules/alternateRows.js index 3afacd15..7abbeaf0 100644 --- a/src/modules/alternateRows.js +++ b/src/modules/alternateRows.js @@ -27,11 +27,11 @@ export class AlternateRows extends Feature { this.processAll(); - this.emitter.on('row-processed', (tf, rowIndex, arrIndex, isValid)=> - this.processRow(rowIndex, arrIndex, isValid)); - this.emitter.on('row-paged', (tf, rowIndex, arrIndex, isValid)=> - this.processRow(rowIndex, arrIndex, isValid)); - this.emitter.on('column-sorted', ()=> this.processAll()); + // Subscribe to events + this.emitter.on(['row-processed', 'row-paged'], + (tf, rowIndex, arrIndex, isValid)=> + this.processRow(rowIndex, arrIndex, isValid)); + this.emitter.on(['column-sorted'], ()=> this.processAll()); this.initialized = true; } @@ -116,11 +116,11 @@ export class AlternateRows extends Feature { this.removeRowBg(i); } - this.emitter.off('row-processed', (tf, rowIndex, arrIndex, isValid)=> - this.processRow(rowIndex, arrIndex, isValid)); - this.emitter.off('row-paged', (tf, rowIndex, arrIndex, isValid)=> - this.processRow(rowIndex, arrIndex, isValid)); - this.emitter.off('column-sorted', ()=> this.processAll()); + // Unsubscribe to events + this.emitter.off(['row-processed', 'row-paged'], + (tf, rowIndex, arrIndex, isValid)=> + this.processRow(rowIndex, arrIndex, isValid)); + this.emitter.off(['column-sorted'], ()=> this.processAll()); this.initialized = false; } diff --git a/src/modules/checkList.js b/src/modules/checkList.js index f2e8becd..9e4f9a3c 100644 --- a/src/modules/checkList.js +++ b/src/modules/checkList.js @@ -60,20 +60,6 @@ export class CheckList{ this.onChange(evt); } - /** - * Build checklist UI asynchronously - * @param {Number} colIndex Column index - * @param {Boolean} isExternal Render in external container - * @param {String} extFltId External container id - */ - // build(colIndex, isExternal, extFltId){ - // var tf = this.tf; - // tf.EvtManager( - // tf.Evt.name.checklist, - // { slcIndex:colIndex, slcExternal:isExternal, slcId:extFltId } - // ); - // } - /** * Build checklist UI * @param {Number} colIndex Column index diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index a10a500a..c21b450f 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -35,26 +35,6 @@ export class Dropdown{ this.emitter = tf.emitter; } - /** - * Build drop-down filter UI asynchronously - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Boolean} isExternal Render in external container - * @param {String} extSlcId External container id - */ - // build(colIndex, isLinked, isExternal, extSlcId){ - // var tf = this.tf; - // tf.EvtManager( - // tf.Evt.name.dropdown, - // { - // slcIndex: colIndex, - // slcRefreshed: isLinked, - // slcExternal: isExternal, - // slcId: extSlcId - // } - // ); - // } - /** * Build drop-down filter UI * @param {Number} colIndex Column index diff --git a/src/modules/highlightKeywords.js b/src/modules/highlightKeywords.js index 67170570..22d574e2 100644 --- a/src/modules/highlightKeywords.js +++ b/src/modules/highlightKeywords.js @@ -18,7 +18,7 @@ export class HighlightKeyword{ } init(){ - this.emitter.on('before-filtering', ()=> this.unhighlightAll()); + this.emitter.on(['before-filtering'], ()=> this.unhighlightAll()); } /** @@ -112,6 +112,6 @@ export class HighlightKeyword{ } destroy(){ - this.emitter.off('before-filtering', ()=> this.unhighlightAll()); + this.emitter.off(['before-filtering'], ()=> this.unhighlightAll()); } } \ No newline at end of file diff --git a/src/modules/loader.js b/src/modules/loader.js index 0b8da01a..dbe583b6 100644 --- a/src/modules/loader.js +++ b/src/modules/loader.js @@ -66,24 +66,32 @@ export class Loader extends Feature{ this.show('none'); // Subscribe to events - emitter.on('before-filtering', ()=> this.show('')); - emitter.on('after-filtering', ()=> this.show('none')); - emitter.on('before-populating-filter', ()=> this.show('')); - emitter.on('after-populating-filter', ()=> this.show('none')); - emitter.on('before-changing-page', ()=> this.show('')); - emitter.on('after-changing-page', ()=> this.show('none')); - emitter.on('before-clearing-filters', ()=> this.show('')); - emitter.on('after-clearing-filters', ()=> this.show('none')); - emitter.on('before-changing-results-per-page', ()=> this.show('')); - emitter.on('after-changing-results-per-page', ()=> this.show('none')); - emitter.on('before-reset-page', ()=> this.show('')); - emitter.on('after-reset-page', ()=> this.show('none')); - emitter.on('before-reset-page-length', ()=> this.show('')); - emitter.on('after-reset-page-length', ()=> this.show('none')); - emitter.on('before-loading-extensions', ()=> this.show('')); - emitter.on('after-loading-extensions', ()=> this.show('none')); - emitter.on('before-loading-themes', ()=> this.show('')); - emitter.on('after-loading-themes', ()=> this.show('none')); + emitter.on([ + 'before-filtering', + 'before-populating-filter', + 'before-changing-page', + 'before-clearing-filters', + 'before-changing-results-per-page', + 'before-reset-page', + 'before-reset-page-length', + 'before-loading-extensions', + 'before-loading-themes' + ], + ()=> this.show('') + ); + emitter.on([ + 'after-filtering', + 'after-populating-filter', + 'after-changing-page', + 'after-clearing-filters', + 'after-changing-results-per-page', + 'after-reset-page', + 'after-reset-page-length', + 'after-loading-extensions', + 'after-loading-themes' + ], + ()=> this.show('none') + ); this.initialized = true; } @@ -121,24 +129,32 @@ export class Loader extends Feature{ this.loaderDiv = null; // Unsubscribe to events - emitter.off('before-filtering', ()=> this.show('')); - emitter.off('after-filtering', ()=> this.show('none')); - emitter.off('before-populating-filter', ()=> this.show('')); - emitter.off('after-populating-filter', ()=> this.show('none')); - emitter.off('before-changing-page', ()=> this.show('')); - emitter.off('after-changing-page', ()=> this.show('none')); - emitter.off('before-clearing-filters', ()=> this.show('')); - emitter.off('after-clearing-filters', ()=> this.show('none')); - emitter.off('before-changing-results-per-page', ()=> this.show('')); - emitter.off('after-changing-results-per-page', ()=> this.show('none')); - emitter.off('before-reset-page', ()=> this.show('')); - emitter.off('after-reset-page', ()=> this.show('none')); - emitter.off('before-reset-page-length', ()=> this.show('')); - emitter.off('after-reset-page-length', ()=> this.show('none')); - emitter.off('before-loading-extensions', ()=> this.show('')); - emitter.off('after-loading-extensions', ()=> this.show('none')); - emitter.off('before-loading-themes', ()=> this.show('')); - emitter.off('after-loading-themes', ()=> this.show('none')); + emitter.off([ + 'before-filtering', + 'before-populating-filter', + 'before-changing-page', + 'before-clearing-filters', + 'before-changing-results-per-page', + 'before-reset-page', + 'before-reset-page-length', + 'before-loading-extensions', + 'before-loading-themes' + ], + ()=> this.show('') + ); + emitter.off([ + 'after-filtering', + 'after-populating-filter', + 'after-changing-page', + 'after-clearing-filters', + 'after-changing-results-per-page', + 'after-reset-page', + 'after-reset-page-length', + 'after-loading-extensions', + 'after-loading-themes' + ], + ()=> this.show('none') + ); this.initialized = false; } diff --git a/src/modules/noResults.js b/src/modules/noResults.js index b1e58c33..e64e169d 100644 --- a/src/modules/noResults.js +++ b/src/modules/noResults.js @@ -61,7 +61,7 @@ export class NoResults extends Feature{ this.cont = cont; // subscribe to after-filtering event - this.emitter.on('after-filtering', ()=> this.toggle()); + this.emitter.on(['after-filtering'], ()=> this.toggle()); this.initialized = true; this.hide(); @@ -128,7 +128,8 @@ export class NoResults extends Feature{ Dom.remove(this.cont); this.cont = null; // unsubscribe to after-filtering event - this.emitter.off('after-filtering', ()=> this.toggle()); + this.emitter.off(['after-filtering'], ()=> this.toggle()); + this.initialized = false; } } diff --git a/src/modules/paging.js b/src/modules/paging.js index 8551e150..f569a3c5 100644 --- a/src/modules/paging.js +++ b/src/modules/paging.js @@ -334,8 +334,8 @@ export class Paging extends Feature{ this.setPagingInfo(tf.validRowsIndex); } - this.emitter.on('after-filtering', ()=> this.resetPagingInfo()); - this.emitter.on('initialized', ()=> this.resetValues()); + this.emitter.on(['after-filtering'], ()=> this.resetPagingInfo()); + this.emitter.on(['initialized'], ()=> this.resetValues()); this.initialized = true; } @@ -562,43 +562,6 @@ export class Paging extends Feature{ this.resultsPerPageSlc = null; } - /** - * Change the page asynchronously according to passed index - * @param {Number} index Index of the page (0-n) - */ - // changePage(index){ - // var tf = this.tf; - // var evt = tf.Evt; - // tf.EvtManager(evt.name.changepage, { pgIndex:index }); - // } - - /** - * Change rows asynchronously according to page results - */ - // changeResultsPerPage(){ - // var tf = this.tf; - // var evt = tf.Evt; - // tf.EvtManager(evt.name.changeresultsperpage); - // } - - /** - * Re-set asynchronously page nb at page re-load - */ - // resetPage(){ - // var tf = this.tf; - // var evt = tf.Evt; - // tf.EvtManager(evt.name.resetpage); - // } - - /** - * Re-set asynchronously page length at page re-load - */ - // resetPageLength(){ - // var tf = this.tf; - // var evt = tf.Evt; - // tf.EvtManager(evt.name.resetpagelength); - // } - /** * Change the page according to passed index * @param {Number} index Index of the page (0-n) @@ -799,8 +762,8 @@ export class Paging extends Feature{ this.removeResultsPerPage(); } - this.emitter.off('after-filtering', ()=> this.resetPagingInfo()); - this.emitter.off('initialized', ()=> this.resetValues()); + this.emitter.off(['after-filtering'], ()=> this.resetPagingInfo()); + this.emitter.off(['initialized'], ()=> this.resetValues()); this.pagingSlc = null; this.nbPages = 0; diff --git a/src/modules/popupFilter.js b/src/modules/popupFilter.js index 5e458194..a50a4ee5 100644 --- a/src/modules/popupFilter.js +++ b/src/modules/popupFilter.js @@ -102,9 +102,9 @@ export class PopupFilter extends Feature{ } // subscribe to events - this.emitter.on('before-filtering', ()=> this.buildIcons()); - this.emitter.on('after-filtering', ()=> this.closeAll()); - this.emitter.on('cell-processed', + this.emitter.on(['before-filtering'], ()=> this.buildIcons()); + this.emitter.on(['after-filtering'], ()=> this.closeAll()); + this.emitter.on(['cell-processed'], (tf, cellIndex)=> this.buildIcon(cellIndex, true)); this.initialized = true; @@ -253,9 +253,9 @@ export class PopupFilter extends Feature{ this.popUpFltImgs = []; // unsubscribe to events - this.emitter.off('before-filtering', ()=> this.buildIcons()); - this.emitter.off('after-filtering', ()=> this.closeAll()); - this.emitter.off('cell-processed', + this.emitter.off(['before-filtering'], ()=> this.buildIcons()); + this.emitter.off(['after-filtering'], ()=> this.closeAll()); + this.emitter.off(['cell-processed'], (tf, cellIndex)=> this.buildIcon(cellIndex, true)); this.initialized = false; diff --git a/src/modules/rowsCounter.js b/src/modules/rowsCounter.js index e9c0df17..f5cf36cb 100644 --- a/src/modules/rowsCounter.js +++ b/src/modules/rowsCounter.js @@ -76,12 +76,10 @@ export class RowsCounter extends Feature{ this.rowsCounterDiv = countDiv; this.rowsCounterSpan = countSpan; - // subscribe to after-filtering event - this.emitter.on('after-filtering', ()=> this.refresh(tf.nbVisibleRows)); - // subscribe to grouped-by-page event - this.emitter.on('grouped-by-page', ()=> this.refresh(tf.nbVisibleRows)); - // subscribe to rows-changed event - this.emitter.on('rows-changed', ()=> this.refresh()); + // subscribe to events + this.emitter.on(['after-filtering', 'grouped-by-page'], + ()=> this.refresh(tf.nbVisibleRows)); + this.emitter.on(['rows-changed'], ()=> this.refresh()); this.initialized = true; this.refresh(); @@ -141,15 +139,9 @@ export class RowsCounter extends Feature{ this.rowsCounterDiv = null; // unsubscribe to events - this.emitter.off( - 'after-filtering', - ()=> this.refresh(tf.nbVisibleRows) - ); - this.emitter.off( - 'grouped-by-page', - ()=> this.refresh(tf.nbVisibleRows) - ); - this.emitter.off('rows-changed', ()=> this.refresh()); + this.emitter.off(['after-filtering', 'grouped-by-page'], + ()=> this.refresh(tf.nbVisibleRows)); + this.emitter.off(['rows-changed'], ()=> this.refresh()); this.initialized = false; } diff --git a/src/modules/statusBar.js b/src/modules/statusBar.js index 9901a7b3..203e918a 100644 --- a/src/modules/statusBar.js +++ b/src/modules/statusBar.js @@ -52,9 +52,6 @@ export class StatusBar extends Feature{ //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 @@ -118,30 +115,36 @@ export class StatusBar extends Feature{ this.statusBarSpanText = statusSpanText; // Subscribe to events - emitter.on('before-filtering', ()=> this.message(this.msgFilter)); - emitter.on('after-filtering', ()=> this.message('')); - emitter.on('before-populating-filter', + emitter.on(['before-filtering'], ()=> this.message(this.msgFilter)); + emitter.on(['before-populating-filter'], ()=> this.message(this.msgPopulate)); - emitter.on('after-populating-filter', ()=> this.message('')); - emitter.on('before-changing-page', + emitter.on(['before-changing-page'], ()=> this.message(this.msgChangePage)); - emitter.on('after-changing-page', ()=> this.message('')); - emitter.on('before-clearing-filters', ()=> this.message(this.msgClear)); - emitter.on('after-clearing-filters', ()=> this.message('')); - emitter.on('before-changing-results-per-page', + emitter.on(['before-clearing-filters'], ()=> + this.message(this.msgClear)); + emitter.on(['before-changing-results-per-page'], ()=> this.message(this.msgChangeResults)); - emitter.on('after-changing-results-per-page', ()=> this.message('')); - emitter.on('before-reset-page', ()=> this.message(this.msgResetPage)); - emitter.on('after-reset-page', ()=> this.message('')); - emitter.on('before-reset-page-length', + emitter.on(['before-reset-page'], ()=> this.message(this.msgResetPage)); + emitter.on(['before-reset-page-length'], ()=> this.message(this.msgResetPageLength)); - emitter.on('after-reset-page-length', ()=> this.message('')); - emitter.on('before-loading-extensions', + emitter.on(['before-loading-extensions'], ()=> this.message(this.msgLoadExtensions)); - emitter.on('after-loading-extensions', ()=> this.message('')); - emitter.on('before-loading-themes', + emitter.on(['before-loading-themes'], ()=> this.message(this.msgLoadThemes)); - emitter.on('after-loading-themes', ()=> this.message('')); + + emitter.on([ + 'after-filtering', + 'after-populating-filter', + 'after-changing-page', + 'after-clearing-filters', + 'after-changing-results-per-page', + 'after-reset-page', + 'after-reset-page-length', + 'after-loading-extensions', + 'after-loading-themes' + ], + ()=> this.message('') + ); this.initialized = true; } @@ -181,31 +184,37 @@ export class StatusBar extends Feature{ this.statusBarDiv = null; // Unsubscribe to events - emitter.off('before-filtering', ()=> this.message(this.msgFilter)); - emitter.off('after-filtering', ()=> this.message('')); - emitter.off('before-populating-filter', + emitter.off(['before-filtering'], ()=> this.message(this.msgFilter)); + emitter.off(['before-populating-filter'], ()=> this.message(this.msgPopulate)); - emitter.off('after-populating-filter', ()=> this.message('')); - emitter.off('before-changing-page', + emitter.off(['before-changing-page'], ()=> this.message(this.msgChangePage)); - emitter.off('after-changing-page', ()=> this.message('')); - emitter.off('before-clearing-filters', + emitter.off(['before-clearing-filters'], ()=> this.message(this.msgClear)); - emitter.off('after-clearing-filters', ()=> this.message('')); - emitter.off('before-changing-results-per-page', + emitter.off(['before-changing-results-per-page'], ()=> this.message(this.msgChangeResults)); - emitter.off('after-changing-results-per-page', ()=> this.message('')); - emitter.off('before-reset-page', ()=> this.message(this.msgResetPage)); - emitter.off('after-reset-page', ()=> this.message('')); - emitter.off('before-reset-page-length', + emitter.off(['before-reset-page'], ()=> + this.message(this.msgResetPage)); + emitter.off(['before-reset-page-length'], ()=> this.message(this.msgResetPageLength)); - emitter.off('after-reset-page-length', ()=> this.message('')); - emitter.off('before-loading-extensions', + emitter.off(['before-loading-extensions'], ()=> this.message(this.msgLoadExtensions)); - emitter.off('after-loading-extensions', ()=> this.message('')); - emitter.off('before-loading-themes', + emitter.off(['before-loading-themes'], ()=> this.message(this.msgLoadThemes)); - emitter.off('after-loading-themes', ()=> this.message('')); + + emitter.off([ + 'after-filtering', + 'after-populating-filter', + 'after-changing-page', + 'after-clearing-filters', + 'after-changing-results-per-page', + 'after-reset-page', + 'after-reset-page-length', + 'after-loading-extensions', + 'after-loading-themes' + ], + ()=> this.message('') + ); this.initialized = false; } diff --git a/src/modules/store.js b/src/modules/store.js index dd796de5..50a4df94 100644 --- a/src/modules/store.js +++ b/src/modules/store.js @@ -19,7 +19,7 @@ export class Store{ } init(){ - this.emitter.on('after-filtering', + this.emitter.on(['after-filtering'], ()=> this.saveFilterValues(this.tf.fltsValuesCookie)); } @@ -104,7 +104,7 @@ export class Store{ } destroy(){ - this.emitter.off('after-filtering', + this.emitter.off(['after-filtering'], ()=> this.saveFilterValues(this.tf.fltsValuesCookie)); } } diff --git a/src/tablefilter.js b/src/tablefilter.js index 117d6ce4..da847338 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -368,37 +368,6 @@ export class TableFilter { //array containing columns date type this.colDateType = 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'; @@ -457,20 +426,6 @@ export class TableFilter { /*** TF events ***/ this.Evt = { - // name: { - // //filter: 'Filter', - // //dropdown: 'DropDown', - // // checklist: 'CheckList', - // // changepage: 'ChangePage', - // // clear: 'Clear', - // // changeresultsperpage: 'ChangeResults', - // // resetvalues: 'ResetValues', - // // resetpage: 'ResetPage', - // // resetpagelength: 'ResetPageLength', - // // loadextensions: 'LoadExtensions', - // // loadthemes: 'LoadThemes' - // }, - // Detect key detectKey(e) { if(!this.enterKey){ return; } @@ -630,7 +585,7 @@ export class TableFilter { this.import(this.stylesheetId, this.stylesheet, null, 'link'); //loads theme - if(this.hasThemes){ this._loadThemes(); } + if(this.hasThemes){ this.loadThemes(); } if(this.rememberGridValues || this.rememberPageNb || this.rememberPageLen){ @@ -876,7 +831,7 @@ export class TableFilter { /* Features */ if(this.hasVisibleRows){ - this.emitter.on('after-filtering', ()=> this.enforceVisibility()); + this.emitter.on(['after-filtering'], ()=> this.enforceVisibility()); this.enforceVisibility(); } if(this.rowsCounter){ @@ -938,12 +893,13 @@ export class TableFilter { // Subscribe to events if(this.markActiveColumns){ - this.emitter.on('before-filtering', ()=> this.clearActiveColumns()); - this.emitter.on('cell-processed', + this.emitter.on(['before-filtering'], + ()=> this.clearActiveColumns()); + this.emitter.on(['cell-processed'], (tf, colIndex)=> this.markActiveColumn(colIndex)); } if(this.linkedFilters){ - this.emitter.on('after-filtering', ()=> this.linkFilters()); + this.emitter.on(['after-filtering'], ()=> this.linkFilters()); } if(this.onFiltersLoaded){ @@ -953,87 +909,6 @@ export class TableFilter { this.emitter.emit('initialized', this); } - /** - * Manages state messages - * @param {String} evt Event name - * @param {Object} cfg Config object - */ - // EvtManager(evt/*, - // cfg={ slcIndex: null, slcExternal: false, slcId: null, pgIndex: null } - // */){ - // // let slcIndex = cfg.slcIndex; - // // let slcExternal = cfg.slcExternal; - // // let slcId = cfg.slcId; - // // let pgIndex = cfg.pgIndex; - // let cpt = this.Mod; - - // function efx(){ - // /*jshint validthis:true */ - // // let ev = this.Evt.name; - - // // switch(evt){ - // // case ev.filter: - // // this._filter(); - // // break; - // // case ev.dropdown: - // // if(this.linkedFilters){ - // // cpt.dropdown._build(slcIndex, true); - // // } else { - // // cpt.dropdown._build( - // // slcIndex, false, slcExternal, slcId); - // // } - // // break; - // // case ev.checklist: - // // cpt.checkList._build(slcIndex, slcExternal, slcId); - // // break; - // // case ev.changepage: - // // cpt.paging._changePage(pgIndex); - // // break; - // // case ev.clear: - // // this._clearFilters(); - // // this.filter(); - // // break; - // // case ev.changeresultsperpage: - // // cpt.paging._changeResultsPerPage(); - // // break; - // // case ev.resetvalues: - // // this._resetValues(); - // // this.filter(); - // // break; - // // case ev.resetpage: - // // cpt.paging._resetPage(this.pgNbCookie); - // // break; - // // case ev.resetpagelength: - // // cpt.paging._resetPageLength(this.pgLenCookie); - // // break; - // // case ev.loadextensions: - // // this._loadExtensions(); - // // break; - // // case ev.loadthemes: - // // this._loadThemes(); - // // break; - // // } - // if(this.statusBar){ - // cpt.statusBar.message(''); - // } - // if(this.loader){ - // cpt.loader.show('none'); - // } - // } - - // if(!this.loader && !this.statusBar && !this.linkedFilters) { - // efx.call(this); - // } else { - // if(this.loader){ - // cpt.loader.show(''); - // } - // if(this.statusBar){ - // cpt.statusBar.message(this['msg'+evt]); - // } - // global.setTimeout(efx.bind(this), this.execDelay); - // } - // } - /** * Return a feature instance for a given name * @param {String} name Name of the feature @@ -1123,10 +998,6 @@ export class TableFilter { } } - // loadThemes(){ - // this.EvtManager(this.Evt.name.loadthemes); - // } - /** * Load themes defined in the configuration object */ @@ -1213,9 +1084,9 @@ export class TableFilter { } if(this.markActiveColumns){ this.clearActiveColumns(); - this.emitter.off('before-filtering', + this.emitter.off(['before-filtering'], ()=> this.clearActiveColumns()); - this.emitter.off('cell-processed', + this.emitter.off(['cell-processed'], (tf, colIndex)=> this.markActiveColumn(colIndex)); } if(this.hasExtensions){ @@ -1248,10 +1119,11 @@ export class TableFilter { // unsubscribe to events if(this.hasVisibleRows){ - this.emitter.off('after-filtering', ()=> this.enforceVisibility()); + this.emitter.off(['after-filtering'], + ()=> this.enforceVisibility()); } if(this.linkedFilters){ - this.emitter.off('after-filtering', ()=> this.linkFilters()); + this.emitter.off(['after-filtering'], ()=> this.linkFilters()); } Dom.removeClass(this.tbl, this.prfxTf); @@ -1403,10 +1275,6 @@ export class TableFilter { return [optArray, optTxt]; } - // resetValues(){ - // this.EvtManager(this.Evt.name.resetvalues); - // } - /** * Reset persisted filter values */ @@ -1415,12 +1283,6 @@ export class TableFilter { if(this.rememberGridValues && this.loadFltOnDemand){ this._resetGridValues(this.fltsValuesCookie); } - // if(this.rememberPageLen && this.Mod.paging){ - // this.Mod.paging.resetPageLength(this.pgLenCookie); - // } - // if(this.rememberPageNb && this.Mod.paging){ - // this.Mod.paging.resetPage(this.pgNbCookie); - // } this.filter(); } @@ -1509,10 +1371,6 @@ export class TableFilter { }//end if } - // filter(){ - // this.EvtManager(this.Evt.name.filter); - // } - /** * Filter the table by retrieving the data from each cell in every single * row and comparing it to the search term for current column. A row is @@ -2331,10 +2189,6 @@ export class TableFilter { } } - // clearFilters(){ - // // this.EvtManager(this.Evt.name.clear); - // } - /** * Clear all the filters' values */ @@ -2510,9 +2364,6 @@ export class TableFilter { Mod.popupFilter.reset(); } - // if(!this.gridLayout){ - // Dom.addClass(this.tbl, this.prfxTf); - // } this._hasGrid = true; } diff --git a/test/test-emitter.js b/test/test-emitter.js index b3c4f9ce..523bf91a 100644 --- a/test/test-emitter.js +++ b/test/test-emitter.js @@ -17,7 +17,8 @@ module('Behaviour'); test('Can subscribe', function(){ var emitter = tf.emitter; var output = null; - emitter.on('before-filtering', function(){ output = 'before-filtering'; }); + emitter.on(['before-filtering'], + function(){ output = 'before-filtering'; }); tf.filter(); @@ -29,7 +30,8 @@ test('Can subscribe', function(){ test('Can unsubscribe', function(){ var emitter = tf.emitter; var output = null; - emitter.off('before-filtering', function(){ output = 'before-filtering'; }); + emitter.off(['before-filtering'], + function(){ output = 'before-filtering'; }); tf.filter(); @@ -41,7 +43,7 @@ test('Can unsubscribe', function(){ test('Can emit', function(){ var emitter = tf.emitter; var output = null; - emitter.on('hello', function(arg){ output = arg; }); + emitter.on(['hello'], function(arg){ output = arg; }); emitter.emit('hello', 'world'); From 1109888366e13ceb670c93ddbead92d490e1990f Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Sun, 3 Jan 2016 13:58:07 +1100 Subject: [PATCH 16/41] Reduced jshint cyclomatic complexity values --- .jshintrc | 4 ++-- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- dist/tablefilter/style/themes/default/default.css | 2 +- dist/tablefilter/style/themes/mytheme/mytheme.css | 2 +- dist/tablefilter/style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 2 +- dist/tablefilter/tf-1.js | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.jshintrc b/.jshintrc index e4e2728b..481af2c9 100644 --- a/.jshintrc +++ b/.jshintrc @@ -11,7 +11,7 @@ "trailing": true, "quotmark": "single", "immed": true, - "maxstatements": 198, + "maxstatements": 178, "maxdepth": 7, - "maxcomplexity": 104 + "maxcomplexity": 87 } \ No newline at end of file diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 3779b3ab..8727220e 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:45:10.758Z + * build date: 2016-01-03T02:53:59.298Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 67cc527c..736c934d 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:45:10.758Z + * build date: 2016-01-03T02:53:59.298Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 2a89b76b..f5684316 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:45:10.758Z + * build date: 2016-01-03T02:53:59.298Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 7872e7dd..8dbfc45b 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:45:10.758Z + * build date: 2016-01-03T02:53:59.298Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 0a3e5b6f..5522bad5 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:45:10.758Z + * build date: 2016-01-03T02:53:59.298Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 4ec95869..d55f3259 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:45:10.758Z + * build date: 2016-01-03T02:53:59.298Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index ee3c1c89..e57ad671 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:45:10.664Z + * build date: 2016-01-03T02:53:59.235Z * MIT License */ diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 8f69e4e4..b605f6f6 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,6 +1,6 @@ /** * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:45:10.664Z + * build date: 2016-01-03T02:53:59.235Z * MIT License */ From 2a0ed493145e619dbe0b11a9817add7b52262e48 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Mon, 4 Jan 2016 17:59:30 +1100 Subject: [PATCH 17/41] Initial commit --- dist/starter.html | 4 +- dist/tablefilter/style/colsVisibility.css | 4 +- dist/tablefilter/style/filtersVisibility.css | 4 +- dist/tablefilter/style/tablefilter.css | 4 +- .../style/themes/default/default.css | 4 +- .../style/themes/mytheme/mytheme.css | 4 +- .../style/themes/skyblue/skyblue.css | 4 +- dist/tablefilter/tablefilter.js | 12 +- dist/tablefilter/tf-1.js | 4 +- package.json | 2 +- src/modules/gridLayout.js | 87 ++++++------ src/modules/popupFilter.js | 8 ++ src/tablefilter.js | 124 +++++++++++------- test/test-grid-layout.js | 7 +- test/test-no-filters.js | 9 ++ test/test-popup-filter.js | 18 +-- 16 files changed, 181 insertions(+), 118 deletions(-) diff --git a/dist/starter.html b/dist/starter.html index a5588fbc..b59dfa1e 100644 --- a/dist/starter.html +++ b/dist/starter.html @@ -1,10 +1,10 @@ - tablefilter v0.1.4 - Starter + tablefilter v0.1.5 - Starter -

tablefilter v0.1.4

+

tablefilter v0.1.5

diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 8727220e..999c6073 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:53:59.298Z + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-04T06:55:19.313Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 736c934d..fc31b2d0 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:53:59.298Z + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-04T06:55:19.313Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index f5684316..60d0d8c6 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:53:59.298Z + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-04T06:55:19.313Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 8dbfc45b..49345403 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:53:59.298Z + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-04T06:55:19.313Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 5522bad5..4280d2f4 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:53:59.298Z + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-04T06:55:19.313Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index d55f3259..9b5534e3 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:53:59.298Z + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-04T06:55:19.313Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index e57ad671..823463cb 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,10 @@ /** - * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:53:59.235Z + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-04T06:55:19.228Z * MIT License */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,a){for(var l,r,o=0,h=[];ol;l++)s[l]=arguments[l];if(0!==s.length){if(this.id=null,this.version="0.1.4",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.gridLayout&&(this.headersRow>1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),n=s._ezEditTable;s.cfg.editable&&n.Editable.Remove(),s.cfg.selection&&n.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown.build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList.build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return l(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].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 e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=void 0;if(!this.gridLayout){var a=u["default"].tag(this.tbl,"thead");n=a.length>0?a[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popupFilters&&this.headersRow++,this.popupFilters&&this.headersRow++,n.className=this.fltsRowCssClass,(this.isExternalFlt||this.popupFilters)&&(n.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.popupFilters&&e.popupFilter.build(l);var r=u["default"].create(this.fltCellTag),h=this.getFilterType(l),d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[l]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||n.appendChild(r),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(h=this.fltTypeInp,s=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var c=e.dropdown,p=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+l+"_"+this.id],["ct",l],["filled","0"]);if(h===this.fltTypeMulti&&(p.multiple=this.fltTypeMulti,p.title=c.multipleSlcTooltip),p.className=f["default"].lower(h)===this.fltTypeSlc?s:this.fltMultiCssClass,d?(u["default"].id(d).appendChild(p),this.externalFltEls.push(p)):r.appendChild(p),this.fltIds.push(this.prfxFlt+l+"_"+this.id),this.loadFltOnDemand||c.build(l),o["default"].add(p,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(p,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(p,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var g=u["default"].createOpt(this.displayAllText,"");p.appendChild(g)}}else if(h===this.fltTypeCheckList){var v=void 0;e.checkList=new S.CheckList(this),v=e.checkList;var b=u["default"].create("div",["id",v.prfxCheckListDiv+l+"_"+this.id],["ct",l],["filled","0"]);b.className=v.checkListDivCssClass,d?(u["default"].id(d).appendChild(b),this.externalFltEls.push(b)):r.appendChild(b),v.checkListDiv[l]=b,this.fltIds.push(this.prfxFlt+l+"_"+this.id),this.loadFltOnDemand||v.build(l),this.loadFltOnDemand&&(o["default"].add(b,"click",this.Evt.onCheckListClick.bind(this)),b.appendChild(u["default"].text(v.activateCheckListTxt)))}else{var m=h===this.fltTypeInp?"text":"hidden",y=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+l+"_"+this.id],["type",m],["ct",l]);if("hidden"!==m&&this.watermark&&y.setAttribute("placeholder",this.isWatermarkArray?this.watermark[l]||"":this.watermark),y.className=s,o["default"].add(y,"focus",this.Evt.onInpFocus.bind(this)),d?(u["default"].id(d).appendChild(y),this.externalFltEls.push(y)):r.appendChild(y),this.fltIds.push(this.prfxFlt+l+"_"+this.id),o["default"].add(y,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(y,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(y,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(y,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var _=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=_[l]&&this.setFilterValue(l,_[l],!1)}}if(l==i-1&&this.displayBtn){var C=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+l+"_"+this.id],["type","button"],["value",this.btnText]);C.className=this.btnCssClass,d?u["default"].id(d).appendChild(C):r.appendChild(C),o["default"].add(C,"click",function(){return t.filter()})}}}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.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new M.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;this.emitter.emit("before-loading-extensions",this);for(var e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,a=void 0;s&&n?a=t.path+s:(s=s.replace(".js",""),a="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var n=[i(26)("./"+a)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],a=n.name,l=n.path,r=this.prfxTf+a;a&&!l?l=this.themesPath+a+"/"+a+".css":!a&&n.path&&(a="theme{0}".replace("{0}",i)),this.isImported(l,"link")||this["import"](r,l,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],a=i.indexOf(t),l=e.values[a],r=e.texts[a],o=e.sorts[a],h=0,u=l.length;u>h;h++)n.push(l[h]),r[h]?s.push(r[h]):s.push(l[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==a[h]&&(l=u["default"].createOpt(a[h],a[h],!0),o.appendChild(l),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),a=e[n].split(" "+this.orOperator+" ");for(var h=0,d=a.length;d>h;h++)if(""!==a[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),a[h],a[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=d.test(t),k=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),M=x&&_["default"].isValid(t.replace(r,""),O),B=T&&_["default"].isValid(t.replace(d,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=R&&_["default"].isValid(t.replace(c,""),O),j=P&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):M?(U=_["default"].format(t.replace(r,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):B?(U=_["default"].format(t.replace(d,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(a=n(e,this.colNbFormat[i]),l=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=n(e,"us"),l="us"):(a=n(e,"eu"),l="eu"),x)s=a<=n(t.replace(r,""),l);else if(k)s=a>=n(t.replace(o,""),l);else if(u)s=an(t.replace(d,""),l);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var a,l,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),M=D.length>1?!0:!1;if(N||M){for(var B=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,T[I]),!N||!A)&&(!M||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],T[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,a=[];e&&a.push(this.getHeadersText()[t]);for(var l=this.refRow;l0&&(r=-1!=s.indexOf(l));var o=n[l].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[l].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;a.push(c)}}return a}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,a=i.options.length;a>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var a=this.getFilterType(s);if(a===f["default"].lower(t)){var l=e?s:this.fltIds[s];i.push(l)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sl;l++){var o=this.getCellData(a[l]);n[1].push(o)}i.push(n)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),n=0;nn;n++){var l=i[n],r=l[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;ta;a++){var r=i.options[a];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,a=n?null:H.createDocumentFragment(),l=0;t>l;l++){var r=void 0;n?r=s[l]:(r=u["default"].create("col",["id",this.id+"_col_"+l]),a.appendChild(r)),r.style.width=i[l]}n||e.insertBefore(a,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var a=void 0,l=0,r=s.length;r>l;l++){var o=u["default"].id(this.fltIds[s[l]]);if(a=this.getFilterValue(s[l]),n!==s[l]||this.paging&&-1!=t.indexOf(s[l])&&n===s[l]||!this.paging&&(-1!=i.indexOf(s[l])||-1!=e.indexOf(s[l]))||a===this.displayAllText){if(-1!=i.indexOf(s[l])?this.Mod.checkList.checkListDiv[s[l]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[l])?this.Mod.checkList.build(s[l]):this.Mod.dropdown.build(s[l],!0),this.setFilterValue(s[l],a)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var a=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,a)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var l=this.externalFltTgtIds,r=0,o=l.length;o>r;r++){var h=u["default"].id(l[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",a=u["default"].tag(H,s),l=0,r=a.length;r>l;l++)if(void 0!==a[l][n]&&a[l][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",a=this.isImported(e,n);if(!a){var l=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,l))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var a=s.indexOf(";",n);-1===a&&(a=s.length),e=unescape(s.substring(n,a))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var a=t.split(RegExp.$1),l=void 0,r=void 0,o=void 0;l="M"===e.substring(0,1)?a[0]:"M"===e.substring(1,2)?a[1]:a[2],r="D"===e.substring(0,1)?a[0]:"D"===e.substring(1,2)?a[1]:a[2],o="Y"===e.substring(0,1)?a[0]:"Y"===e.substring(1,2)?a[1]:a[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(l,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(l,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,a=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(a[2]),s(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===a["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return l(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var a=this.popUpFltElms[n],l=this.tf.getHeaderElement(n),r=.95*l.clientWidth;a.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){for(var e=this.tf,i=0;iC;C++)if(t===C&&(!e||e&&n.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=n.validRowsIndex.indexOf(m)))){var w=n.getCellData(y[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&n.disableExcludedOptions){var T=b[C];T||(T=n.getFilteredDataCol(C)),h["default"].has(T,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var k=n.getCustomOptions(t);this.opts=k[0],this.optsTxt=k[1]}if(n.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,l,e,v,p,g),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addOptions",value:function(t,e,i,s,n,a){var l=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=l.loadFltOnDemand&&u===this.opts[f]&&l.getFilterType(t)===l.fltTypeSlc?r["default"].createOpt(p,c,!0):l.getFilterType(t)!==l.fltTypeMulti?r["default"].createOpt(p,c," "!==n[t]&&c===n[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(a,d["default"].matchCase(this.opts[f],l.matchCase),l.matchCase)||-1!==a.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var a=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(a)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={ignoreCase:function(t,e){var i=a["default"].lower(t),s=a["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===u[v].style.display&&!n.paging||n.paging&&(!f||f===t||f!=t&&-1!=n.validRowsIndex.indexOf(v)))){var _=n.getCellData(b[y]),C=d["default"].matchCase(_,n.matchCase);h["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=p[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),h["default"].has(w,C,n.matchCase)||h["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,n.separator),n.loadFltOnDemand&&(l.innerHTML=""),l.appendChild(o),l.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,n=this.addTChecks(t,e),a=[],l=s.feature("store"),o=l?l.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?a.push(o):a=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),a=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),a=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)a.innerHTML=this.btnPrevPageHtml,b["default"].add(a,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),a.appendChild(h)}if(this.btnLastPageHtml)l.innerHTML=this.btnLastPageHtml,b["default"].add(l,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),l.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml, -b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(a);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(l),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,s=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;na;a++){var r=e.validRowsIndex[a],o=i[r],h=o.getAttribute("validRow"),u=!1;a>=s&&n>a?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,a,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],a=this.resultsPerPage[1],l=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);l.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;l.appendChild(d["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(l,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(l),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),n=d["default"].id(this.prfxBtnLastSpan+e.id),a=d["default"].id(this.prfxBtnFirstSpan+e.id),l=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),d["default"].remove(n)),a&&(b["default"].remove(a,"click",h.first),d["default"].remove(a)),l&&d["default"].remove(l),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return l(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.onClick()})}else{var a=u["default"].create("a",["href","javascript:void(0);"]);a.className=e.btnResetCssClass,a.appendChild(u["default"].text(this.btnResetText)),i.appendChild(a),f["default"].add(a,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return l(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var a=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var l=i.firstChild;f["default"].add(l,"click",function(){t.toggle()}),a.appendChild(s)}else{a.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&a.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;il;l++){var r=i?l:e[l];this.setRowBg(r,a),a++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,a){for(var l,r,o=0,h=[];ol;l++)s[l]=arguments[l];if(0!==s.length){if(this.id=null,this.version="0.1.5",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),n=s._ezEditTable;s.cfg.editable&&n.Editable.Remove(),s.cfg.selection&&n.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown.build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList.build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return l(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].id(this.id));var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var a=0;i>a;a++){this.popupFilters&&e.popupFilter.build(a);var l=u["default"].create(this.fltCellTag),r=this.getFilterType(a),h=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[a]:null;if(this.singleSearchFlt&&(l.colSpan=this.nbCells),this.gridLayout||n.appendChild(l),s=a==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var d=e.dropdown,c=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+a+"_"+this.id],["ct",a],["filled","0"]);if(r===this.fltTypeMulti&&(c.multiple=this.fltTypeMulti,c.title=d.multipleSlcTooltip),c.className=f["default"].lower(r)===this.fltTypeSlc?s:this.fltMultiCssClass,h?(u["default"].id(h).appendChild(c),this.externalFltEls.push(c)):l.appendChild(c),this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.loadFltOnDemand||d.build(a),o["default"].add(c,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(c,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(c,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var p=u["default"].createOpt(this.displayAllText,"");c.appendChild(p)}}else if(r===this.fltTypeCheckList){var g=void 0;e.checkList=new S.CheckList(this),g=e.checkList;var v=u["default"].create("div",["id",g.prfxCheckListDiv+a+"_"+this.id],["ct",a],["filled","0"]);v.className=g.checkListDivCssClass,h?(u["default"].id(h).appendChild(v),this.externalFltEls.push(v)):l.appendChild(v),g.checkListDiv[a]=v,this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.loadFltOnDemand||g.build(a),this.loadFltOnDemand&&(o["default"].add(v,"click",this.Evt.onCheckListClick.bind(this)),v.appendChild(u["default"].text(g.activateCheckListTxt)))}else{var b=r===this.fltTypeInp?"text":"hidden",m=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+a+"_"+this.id],["type",b],["ct",a]);if("hidden"!==b&&this.watermark&&m.setAttribute("placeholder",this.isWatermarkArray?this.watermark[a]||"":this.watermark),m.className=s,o["default"].add(m,"focus",this.Evt.onInpFocus.bind(this)),h?(u["default"].id(h).appendChild(m),this.externalFltEls.push(m)):l.appendChild(m),this.fltIds.push(this.prfxFlt+a+"_"+this.id),o["default"].add(m,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(m,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(m,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(m,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[a]&&this.setFilterValue(a,y[a],!1)}}if(a==i-1&&this.displayBtn){var _=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+a+"_"+this.id],["type","button"],["value",this.btnText]);_.className=this.btnCssClass,h?u["default"].id(h).appendChild(_):l.appendChild(_),o["default"].add(_,"click",function(){return t.filter()})}}}else this._resetGrid();else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new M.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;this.emitter.emit("before-loading-extensions",this);for(var e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,a=void 0;s&&n?a=t.path+s:(s=s.replace(".js",""),a="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var n=[i(26)("./"+a)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],a=n.name,l=n.path,r=this.prfxTf+a;a&&!l?l=this.themesPath+a+"/"+a+".css":!a&&n.path&&(a="theme{0}".replace("{0}",i)),this.isImported(l,"link")||this["import"](r,l,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],a=i.indexOf(t),l=e.values[a],r=e.texts[a],o=e.sorts[a],h=0,u=l.length;u>h;h++)n.push(l[h]),r[h]?s.push(r[h]):s.push(l[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==a[h]&&(l=u["default"].createOpt(a[h],a[h],!0),o.appendChild(l),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),a=e[n].split(" "+this.orOperator+" ");for(var h=0,d=a.length;d>h;h++)if(""!==a[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),a[h],a[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=d.test(t),k=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),M=x&&_["default"].isValid(t.replace(r,""),O),B=T&&_["default"].isValid(t.replace(d,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=R&&_["default"].isValid(t.replace(c,""),O),j=P&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):M?(U=_["default"].format(t.replace(r,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):B?(U=_["default"].format(t.replace(d,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(a=n(e,this.colNbFormat[i]),l=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=n(e,"us"),l="us"):(a=n(e,"eu"),l="eu"),x)s=a<=n(t.replace(r,""),l);else if(k)s=a>=n(t.replace(o,""),l);else if(u)s=an(t.replace(d,""),l);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var a,l,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),M=D.length>1?!0:!1;if(N||M){for(var B=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,T[I]),!N||!A)&&(!M||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],T[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,a=[];e&&a.push(this.getHeadersText()[t]);for(var l=this.refRow;l0&&(r=-1!=s.indexOf(l));var o=n[l].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[l].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;a.push(c)}}return a}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,a=i.options.length;a>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var a=this.getFilterType(s);if(a===f["default"].lower(t)){var l=e?s:this.fltIds[s];i.push(l)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sl;l++){var o=this.getCellData(a[l]);n[1].push(o)}i.push(n)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),n=0;nn;n++){var l=i[n],r=l[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;ta;a++){var r=i.options[a];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,a=n?null:H.createDocumentFragment(),l=0;t>l;l++){var r=void 0;n?r=s[l]:(r=u["default"].create("col",["id",this.id+"_col_"+l]),a.appendChild(r)),r.style.width=i[l]}n||e.insertBefore(a,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var a=void 0,l=0,r=s.length;r>l;l++){var o=u["default"].id(this.fltIds[s[l]]);if(a=this.getFilterValue(s[l]),n!==s[l]||this.paging&&-1!=t.indexOf(s[l])&&n===s[l]||!this.paging&&(-1!=i.indexOf(s[l])||-1!=e.indexOf(s[l]))||a===this.displayAllText){if(-1!=i.indexOf(s[l])?this.Mod.checkList.checkListDiv[s[l]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[l])?this.Mod.checkList.build(s[l]):this.Mod.dropdown.build(s[l],!0),this.setFilterValue(s[l],a)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var a=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,a)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var l=this.externalFltTgtIds,r=0,o=l.length;o>r;r++){var h=u["default"].id(l[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",a=u["default"].tag(H,s),l=0,r=a.length;r>l;l++)if(void 0!==a[l][n]&&a[l][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",a=this.isImported(e,n);if(!a){var l=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,l))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var a=s.indexOf(";",n);-1===a&&(a=s.length),e=unescape(s.substring(n,a))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var a=t.split(RegExp.$1),l=void 0,r=void 0,o=void 0;l="M"===e.substring(0,1)?a[0]:"M"===e.substring(1,2)?a[1]:a[2],r="D"===e.substring(0,1)?a[0]:"D"===e.substring(1,2)?a[1]:a[2],o="Y"===e.substring(0,1)?a[0]:"Y"===e.substring(1,2)?a[1]:a[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(l,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(l,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,a=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(a[2]),s(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===a["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return l(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var a=this.popUpFltElms[n],l=this.tf.getHeaderElement(n),r=.95*l.clientWidth;a.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iC;C++)if(t===C&&(!e||e&&n.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=n.validRowsIndex.indexOf(m)))){var w=n.getCellData(y[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&n.disableExcludedOptions){var T=b[C];T||(T=n.getFilteredDataCol(C)),h["default"].has(T,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var k=n.getCustomOptions(t);this.opts=k[0],this.optsTxt=k[1]}if(n.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,l,e,v,p,g),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addOptions",value:function(t,e,i,s,n,a){var l=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=l.loadFltOnDemand&&u===this.opts[f]&&l.getFilterType(t)===l.fltTypeSlc?r["default"].createOpt(p,c,!0):l.getFilterType(t)!==l.fltTypeMulti?r["default"].createOpt(p,c," "!==n[t]&&c===n[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(a,d["default"].matchCase(this.opts[f],l.matchCase),l.matchCase)||-1!==a.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var a=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(a)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={ignoreCase:function(t,e){var i=a["default"].lower(t),s=a["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===u[v].style.display&&!n.paging||n.paging&&(!f||f===t||f!=t&&-1!=n.validRowsIndex.indexOf(v)))){var _=n.getCellData(b[y]),C=d["default"].matchCase(_,n.matchCase);h["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=p[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),h["default"].has(w,C,n.matchCase)||h["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,n.separator),n.loadFltOnDemand&&(l.innerHTML=""),l.appendChild(o),l.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,n=this.addTChecks(t,e),a=[],l=s.feature("store"),o=l?l.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?a.push(o):a=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),a=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),a=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)a.innerHTML=this.btnPrevPageHtml,b["default"].add(a,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),a.appendChild(h)}if(this.btnLastPageHtml)l.innerHTML=this.btnLastPageHtml,b["default"].add(l,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]); +u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),l.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(a);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(l),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,s=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;na;a++){var r=e.validRowsIndex[a],o=i[r],h=o.getAttribute("validRow"),u=!1;a>=s&&n>a?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,a,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],a=this.resultsPerPage[1],l=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);l.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;l.appendChild(d["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(l,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(l),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),n=d["default"].id(this.prfxBtnLastSpan+e.id),a=d["default"].id(this.prfxBtnFirstSpan+e.id),l=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),d["default"].remove(n)),a&&(b["default"].remove(a,"click",h.first),d["default"].remove(a)),l&&d["default"].remove(l),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return l(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.onClick()})}else{var a=u["default"].create("a",["href","javascript:void(0);"]);a.className=e.btnResetCssClass,a.appendChild(u["default"].text(this.btnResetText)),i.appendChild(a),f["default"].add(a,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return l(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var a=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var l=i.firstChild;f["default"].add(l,"click",function(){t.toggle()}),a.appendChild(s)}else{a.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&a.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;il;l++){var r=i?l:e[l];this.setRowBg(r,a),a++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index b605f6f6..6a0d5351 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,6 +1,6 @@ /** - * tablefilter v0.1.4 by Max Guglielmi - * build date: 2016-01-03T02:53:59.235Z + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-04T06:55:19.228Z * MIT License */ diff --git a/package.json b/package.json index 99d6a24a..fec939af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tablefilter", - "version": "0.1.4", + "version": "0.1.5", "description": "A Javascript library making HTML tables filterable and a bit more", "license": "MIT", "author": { diff --git a/src/modules/gridLayout.js b/src/modules/gridLayout.js index 3649dafc..01b50b67 100644 --- a/src/modules/gridLayout.js +++ b/src/modules/gridLayout.js @@ -13,7 +13,7 @@ export class GridLayout extends Feature{ constructor(tf){ super(tf, 'gridLayout'); - var f = this.config; + let f = this.config; //defines grid width this.gridWidth = f.grid_width || null; @@ -60,21 +60,26 @@ export class GridLayout extends Feature{ * Generates a grid with fixed headers */ init(){ - var tf = this.tf; - var f = this.config; - var tbl = tf.tbl; + let tf = this.tf; + let f = this.config; + let tbl = tf.tbl; if(this.initialized){ return; } + // Override reference rows indexes + tf.refRow = Types.isNull(tf.startRow) ? 0 : tf.startRow; + tf.headersRow = 0; + tf.filtersRowIndex = 1; + tf.isExternalFlt = true; // default width of 100px if column widths not set if(!tf.hasColWidths){ tf.colWidths = []; - for(var k=0; k0){ tbl.removeChild(thead[0]); } @@ -216,15 +221,15 @@ export class GridLayout extends Feature{ //scroll synchronisation Event.add(this.tblCont, 'scroll', (evt)=> { - var elm = Event.target(evt); - var scrollLeft = elm.scrollLeft; + let elm = Event.target(evt); + let scrollLeft = elm.scrollLeft; this.headTblCont.scrollLeft = scrollLeft; //New pointerX calc taking into account scrollLeft // if(!o.isPointerXOverwritten){ // try{ // o.Evt.pointerX = function(evt){ - // var e = evt || global.event; - // var bdScrollLeft = tf_StandardBody().scrollLeft + + // let e = evt || global.event; + // let bdScrollLeft = tf_StandardBody().scrollLeft + // scrollLeft; // return (e.pageX + scrollLeft) || // (e.clientX + bdScrollLeft); @@ -237,7 +242,7 @@ export class GridLayout extends Feature{ }); //Configure sort extension if any - var sort = (f.extensions || []).filter(function(itm){ + let sort = (f.extensions || []).filter(function(itm){ return itm.name === 'sort'; }); if(sort.length === 1){ @@ -250,9 +255,9 @@ export class GridLayout extends Feature{ //Col elements are enough to keep column widths after sorting and //filtering - var createColTags = function(){ - for(var k=(tf.nbCells-1); k>=0; k--){ - var col = Dom.create('col', ['id', tf.id+'_col_'+k]); + let createColTags = function(){ + for(let k=(tf.nbCells-1); k>=0; k--){ + let col = Dom.create('col', ['id', tf.id+'_col_'+k]); tbl.insertBefore(col, tbl.firstChild); col.style.width = tf.colWidths[k]; this.gridColElms[k] = col; @@ -263,26 +268,26 @@ export class GridLayout extends Feature{ if(!this.tblHasColTag){ createColTags.call(this); } else { - var cols = Dom.tag(tbl, 'col'); - for(var ii=0; ii this.closeAll()); this.emitter.on(['cell-processed'], (tf, cellIndex)=> this.buildIcon(cellIndex, true)); + this.emitter.on(['filters-row-inserted'], ()=> this.tf.headersRow++); this.initialized = true; } @@ -257,6 +264,7 @@ export class PopupFilter extends Feature{ this.emitter.off(['after-filtering'], ()=> this.closeAll()); this.emitter.off(['cell-processed'], (tf, cellIndex)=> this.buildIcon(cellIndex, true)); + this.emitter.off(['filters-row-inserted'], ()=> this.tf.headersRow++); this.initialized = false; } diff --git a/src/tablefilter.js b/src/tablefilter.js index da847338..380102d9 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -109,14 +109,14 @@ export class TableFilter { this.headersRow = isNaN(f.headers_row_index) ? (this.filtersRowIndex === 0 ? 1 : 0) : f.headers_row_index; - if(this.gridLayout){ - if(this.headersRow > 1){ - this.filtersRowIndex = this.headersRow+1; - } else { - this.filtersRowIndex = 1; - this.headersRow = 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' || @@ -568,14 +568,14 @@ export class TableFilter { 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; - } + // 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; + // } let Mod = this.Mod; let n = this.singleSearchFlt ? 1 : this.nbCells, @@ -619,39 +619,33 @@ export class TableFilter { //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; + this._initNoFilters(); } else { if(this.isFirstLoad){ - let fltrow; - if(!this.gridLayout){ - let thead = Dom.tag(this.tbl, 'thead'); - if(thead.length > 0){ - fltrow = thead[0].insertRow(this.filtersRowIndex); - } else { - fltrow = this.tbl.insertRow(this.filtersRowIndex); - } + let fltrow = this._insertFiltersRow(); + // if(!this.gridLayout){ + // let 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++; - } + // if(this.headersRow > 1 && + // this.filtersRowIndex <= this.headersRow && + // !this.popupFilters){ + // this.headersRow++; + // } + // if(this.popupFilters){ + // this.headersRow++; + // } - fltrow.className = this.fltsRowCssClass; + // fltrow.className = this.fltsRowCssClass; - if(this.isExternalFlt || this.popupFilters){ - fltrow.style.display = 'none'; - } - } + // if(this.isExternalFlt || this.popupFilters){ + // fltrow.style.display = 'none'; + // } + // } this.nbFilterableRows = this.getRowsNb(); this.nbVisibleRows = this.nbFilterableRows; @@ -909,6 +903,48 @@ export class TableFilter { this.emitter.emit('initialized', this); } + _insertFiltersRow() { + if(this.gridLayout){ + return; + } + let fltrow; + + let 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++; + } + + fltrow.className = this.fltsRowCssClass; + + if(this.isExternalFlt){ + fltrow.style.display = 'none'; + } + + this.emitter.emit('filters-row-inserted', this, fltrow); + + return fltrow; + } + + _initNoFilters(){ + if(this.fltGrid){ + return; + } + this.refRow = this.refRow > 0 ? this.refRow-1 : 0; + // if(this.gridLayout){ + // this.refRow = 0; + // } + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.nbFilterableRows + this.refRow; + } + /** * Return a feature instance for a given name * @param {String} name Name of the feature diff --git a/test/test-grid-layout.js b/test/test-grid-layout.js index 673b99ea..60130168 100644 --- a/test/test-grid-layout.js +++ b/test/test-grid-layout.js @@ -1,8 +1,7 @@ var tf = new TableFilter('demo', { base_path: '../dist/tablefilter/', - grid_layout: true, - sort: false + grid_layout: true }); tf.init(); @@ -14,6 +13,10 @@ test('GridLayout component', function() { notEqual(gridLayout.tblCont, null, 'GridLayout main HTML table container element'); notEqual(gridLayout.headTblCont, null, 'GridLayout headers container element'); notEqual(gridLayout.headTbl, null, 'GridLayout headers HTML table'); + deepEqual(tf.startRow, null, 'Optional startRow row index'); + deepEqual(tf.refRow, 0, 'Reference row index'); + deepEqual(tf.headersRow, 0, 'Headers row index'); + deepEqual(tf.filtersRowIndex, 1, 'Filters row index'); }); test('Destroy GridLayout component', function() { diff --git a/test/test-no-filters.js b/test/test-no-filters.js index 6958b10e..6b879f6f 100644 --- a/test/test-no-filters.js +++ b/test/test-no-filters.js @@ -11,6 +11,7 @@ deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated'); deepEqual(tf.getFilterElement(0), null, 'No filter element for column 0'); + deepEqual(tf.refRow, 1, 'Reference row index'); }); test('Paging with no filters', function() { @@ -25,6 +26,7 @@ tf.init(); deepEqual(tf.getFilterElement(4), null, 'No filter element for column 4'); + deepEqual(tf.refRow, 1, 'Reference row index'); }); test('Grid layout with no filters', function() { @@ -39,6 +41,13 @@ tf.init(); deepEqual(tf.getFilterElement(2), null, 'No filter element for column 2'); + deepEqual(tf.refRow, 0, 'Reference row index'); + }); + + module('Tear-down'); + test('TableFilter removed', function() { + tf.destroy(); + deepEqual(tf.hasGrid(), false, 'Filters removed'); }); })(window, TableFilter); diff --git a/test/test-popup-filter.js b/test/test-popup-filter.js index 0ba42de0..f6031440 100644 --- a/test/test-popup-filter.js +++ b/test/test-popup-filter.js @@ -16,6 +16,7 @@ test('Pop-up filter component', function() { notEqual(popupFilter, null, 'PopupFilter instanciated'); deepEqual(popupFilter.popUpFltElms instanceof Array, true, 'Type of popUpFltElms property'); + deepEqual(tf.headersRow, 1, 'Headers row index'); }); module('UI elements'); @@ -91,6 +92,7 @@ test('Re-instantiated with grid-layout', function() { notEqual(popupFilter, null, 'PopupFilter instanciated'); deepEqual(popupFilter.popUpFltElms instanceof Array, true, 'Type of popUpFltElms property'); + deepEqual(tf.headersRow, 0, 'Headers row index'); }); test('Pop-up filter UI elements with grid-layout', function() { @@ -158,11 +160,11 @@ test('Properties', function() { 'function', 'Feature enable method'); }); -module('Tear-down'); -test('TableFilter removed', function() { - tf.destroy(); - var fltIcn1 = popupFilter.popUpFltImgs[3]; - deepEqual(fltIcn1, undefined, 'Filter icon is removed'); - deepEqual(id(tf.fltIds[3]), null, 'Filter is removed'); - deepEqual(tf.hasGrid(), false, 'Filters removed'); -}); +// module('Tear-down'); +// test('TableFilter removed', function() { +// tf.destroy(); +// var fltIcn1 = popupFilter.popUpFltImgs[3]; +// deepEqual(fltIcn1, undefined, 'Filter icon is removed'); +// deepEqual(id(tf.fltIds[3]), null, 'Filter is removed'); +// deepEqual(tf.hasGrid(), false, 'Filters removed'); +// }); From 010d9add361250b4ca1d48e1095d94e11d476443 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Wed, 6 Jan 2016 18:12:16 +1100 Subject: [PATCH 18/41] Added init to drop-down and check-list filters --- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 7874 ++++++++++++++++- dist/tablefilter/tf-1.js | 2191 ++++- src/modules/checkList.js | 145 +- src/modules/dropdown.js | 105 +- src/modules/popupFilter.js | 6 +- src/tablefilter.js | 146 +- 12 files changed, 10312 insertions(+), 167 deletions(-) diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 999c6073..32a0cc1c 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-04T06:55:19.313Z + * build date: 2016-01-06T05:07:26.429Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index fc31b2d0..38f65843 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-04T06:55:19.313Z + * build date: 2016-01-06T05:07:26.429Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 60d0d8c6..1c396d27 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-04T06:55:19.313Z + * build date: 2016-01-06T05:07:26.429Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 49345403..4cf783f2 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-04T06:55:19.313Z + * build date: 2016-01-06T05:07:26.429Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 4280d2f4..6cdd9cdb 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-04T06:55:19.313Z + * build date: 2016-01-06T05:07:26.429Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 9b5534e3..50f88c01 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-04T06:55:19.313Z + * build date: 2016-01-06T05:07:26.429Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 823463cb..845e404d 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,7866 @@ -/** - * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-04T06:55:19.228Z - * MIT License - */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else { + var a = factory(); + for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; + } +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ var parentJsonpFunction = window["webpackJsonp"]; +/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, callbacks = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) +/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); +/******/ while(callbacks.length) +/******/ callbacks.shift().call(null, __webpack_require__); +/******/ +/******/ }; +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // object to store loaded and loading chunks +/******/ // "0" means "already loaded" +/******/ // Array means "loading", array contains callbacks +/******/ var installedChunks = { +/******/ 0:0 +/******/ }; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // This file contains only the entry chunk. +/******/ // The chunk loading function for additional chunks +/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { +/******/ // "0" is the signal for "already loaded" +/******/ if(installedChunks[chunkId] === 0) +/******/ return callback.call(null, __webpack_require__); +/******/ +/******/ // an array means "currently loading". +/******/ if(installedChunks[chunkId] !== undefined) { +/******/ installedChunks[chunkId].push(callback); +/******/ } else { +/******/ // start chunk loading +/******/ installedChunks[chunkId] = [callback]; +/******/ var head = document.getElementsByTagName('head')[0]; +/******/ var script = document.createElement('script'); +/******/ script.type = 'text/javascript'; +/******/ script.charset = 'utf-8'; +/******/ script.async = true; +/******/ +/******/ script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js"; +/******/ head.appendChild(script); +/******/ } +/******/ }; +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,a){for(var l,r,o=0,h=[];ol;l++)s[l]=arguments[l];if(0!==s.length){if(this.id=null,this.version="0.1.5",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),n=s._ezEditTable;s.cfg.editable&&n.Editable.Remove(),s.cfg.selection&&n.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown.build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}},onCheckListClick:function(t){var e=t||A.event,i=o["default"].target(e);if(this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.checkList.build(s),this.Mod.checkList.checkListDiv[s].onclick=null,this.Mod.checkList.checkListDiv[s].title=""}}}}}return l(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){this.tbl||(this.tbl=u["default"].id(this.id));var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new R.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new P.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var a=0;i>a;a++){this.popupFilters&&e.popupFilter.build(a);var l=u["default"].create(this.fltCellTag),r=this.getFilterType(a),h=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[a]:null;if(this.singleSearchFlt&&(l.colSpan=this.nbCells),this.gridLayout||n.appendChild(l),s=a==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti){e.dropdown||(e.dropdown=new I.Dropdown(this));var d=e.dropdown,c=u["default"].create(this.fltTypeSlc,["id",this.prfxFlt+a+"_"+this.id],["ct",a],["filled","0"]);if(r===this.fltTypeMulti&&(c.multiple=this.fltTypeMulti,c.title=d.multipleSlcTooltip),c.className=f["default"].lower(r)===this.fltTypeSlc?s:this.fltMultiCssClass,h?(u["default"].id(h).appendChild(c),this.externalFltEls.push(c)):l.appendChild(c),this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.loadFltOnDemand||d.build(a),o["default"].add(c,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(c,"change",this.Evt.onSlcChange.bind(this)),o["default"].add(c,"focus",this.Evt.onSlcFocus.bind(this)),this.loadFltOnDemand){var p=u["default"].createOpt(this.displayAllText,"");c.appendChild(p)}}else if(r===this.fltTypeCheckList){var g=void 0;e.checkList=new S.CheckList(this),g=e.checkList;var v=u["default"].create("div",["id",g.prfxCheckListDiv+a+"_"+this.id],["ct",a],["filled","0"]);v.className=g.checkListDivCssClass,h?(u["default"].id(h).appendChild(v),this.externalFltEls.push(v)):l.appendChild(v),g.checkListDiv[a]=v,this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.loadFltOnDemand||g.build(a),this.loadFltOnDemand&&(o["default"].add(v,"click",this.Evt.onCheckListClick.bind(this)),v.appendChild(u["default"].text(g.activateCheckListTxt)))}else{var b=r===this.fltTypeInp?"text":"hidden",m=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+a+"_"+this.id],["type",b],["ct",a]);if("hidden"!==b&&this.watermark&&m.setAttribute("placeholder",this.isWatermarkArray?this.watermark[a]||"":this.watermark),m.className=s,o["default"].add(m,"focus",this.Evt.onInpFocus.bind(this)),h?(u["default"].id(h).appendChild(m),this.externalFltEls.push(m)):l.appendChild(m),this.fltIds.push(this.prfxFlt+a+"_"+this.id),o["default"].add(m,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(m,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(m,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(m,"blur",this.Evt.onInpBlur.bind(this)),this.rememberGridValues){var y=this.Mod.store.getFilterValues(this.fltsValuesCookie);" "!=y[a]&&this.setFilterValue(a,y[a],!1)}}if(a==i-1&&this.displayBtn){var _=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+a+"_"+this.id],["type","button"],["value",this.btnText]);_.className=this.btnCssClass,h?u["default"].id(h).appendChild(_):l.appendChild(_),o["default"].add(_,"click",function(){return t.filter()})}}}else this._resetGrid();else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new M.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new B.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;this.emitter.emit("before-loading-extensions",this);for(var e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,a=void 0;s&&n?a=t.path+s:(s=s.replace(".js",""),a="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var n=[i(26)("./"+a)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],a=n.name,l=n.path,r=this.prfxTf+a;a&&!l?l=this.themesPath+a+"/"+a+".css":!a&&n.path&&(a="theme{0}".replace("{0}",i)),this.isImported(l,"link")||this["import"](r,l,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.clearFilters(),this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt&&this.externalFltTgtIds)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],a=i.indexOf(t),l=e.values[a],r=e.texts[a],o=e.sorts[a],h=0,u=l.length;u>h;h++)n.push(l[h]),r[h]?s.push(r[h]):s.push(l[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){this.rememberGridValues&&this.loadFltOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==a[h]&&(l=u["default"].createOpt(a[h],a[h],!0),o.appendChild(l),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var f=this.Mod.checkList,c=f.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=f.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=f.checkListItemCssClass,p.appendChild(g),c.appendChild(p),a=e[n].split(" "+this.orOperator+" ");for(var h=0,d=a.length;d>h;h++)if(""!==a[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),a[h],a[h]);v.className=f.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,f.setCheckListValues(v.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||d.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=d.test(t),k=o.test(t),R=c.test(t),P=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),M=x&&_["default"].isValid(t.replace(r,""),O),B=T&&_["default"].isValid(t.replace(d,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=R&&_["default"].isValid(t.replace(c,""),O),j=P&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):M?(U=_["default"].format(t.replace(r,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):B?(U=_["default"].format(t.replace(d,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?f["default"].isEmpty(e):L?!f["default"].isEmpty(e):f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(a=n(e,this.colNbFormat[i]),l=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=n(e,"us"),l="us"):(a=n(e,"eu"),l="eu"),x)s=a<=n(t.replace(r,""),l);else if(k)s=a>=n(t.replace(o,""),l);else if(u)s=an(t.replace(d,""),l);else if(R)s=f["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=f["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(P)s=f["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=f["default"].isEmpty(e);else if(L)s=!f["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=f["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var a,l,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),d=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(f["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(f["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=f["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),M=D.length>1?!0:!1;if(N||M){for(var B=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(B=f["default"].trim(H[j]),A=e.call(this,B,E,I),t.call(this,B,A,T[I]),!N||!A)&&(!M||A);j++);R[I]=A}else R[I]=e.call(this,f["default"].trim(S),E,I),t.call(this,S,R[I],T[I]);R[I]||(P=!1),this.singleSearchFlt&&R[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(P=!0),P?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,P)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,a=[];e&&a.push(this.getHeadersText()[t]);for(var l=this.refRow;l0&&(r=-1!=s.indexOf(l));var o=n[l].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[l].style.display){var d=this.getCellData(o[u]),f=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(d,f):d;a.push(c)}}return a}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,a=i.options.length;a>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(f["default"].trim(f["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var a=this.getFilterType(s);if(a===f["default"].lower(t)){var l=e?s:this.fltIds[s];i.push(l)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.refRow;sl;l++){var o=this.getCellData(a[l]);n[1].push(o)}i.push(n)}return i}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0];if(!this.validRowsIndex)return[];var e=this.tbl.rows,i=[];t&&i.push([this.getHeadersRowIndex(),this.getHeadersText()]);for(var s=this.getValidRows(!0),n=0;nn;n++){var l=i[n],r=l[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;ta;a++){var r=i.options[a];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=f["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var d=0;h>d;d++){var c=u["default"].tag(i,"li")[d],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=f["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,a=n?null:H.createDocumentFragment(),l=0;t>l;l++){var r=void 0;n?r=s[l]:(r=u["default"].create("col",["id",this.id+"_col_"+l]),a.appendChild(r)),r.style.width=i[l]}n||e.insertBefore(a,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var a=void 0,l=0,r=s.length;r>l;l++){var o=u["default"].id(this.fltIds[s[l]]);if(a=this.getFilterValue(s[l]),n!==s[l]||this.paging&&-1!=t.indexOf(s[l])&&n===s[l]||!this.paging&&(-1!=i.indexOf(s[l])||-1!=e.indexOf(s[l]))||a===this.displayAllText){if(-1!=i.indexOf(s[l])?this.Mod.checkList.checkListDiv[s[l]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[l])?this.Mod.checkList.build(s[l]):this.Mod.dropdown.build(s[l],!0),this.setFilterValue(s[l],a)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var a=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,a)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var l=this.externalFltTgtIds,r=0,o=l.length;o>r;r++){var h=u["default"].id(l[r]);if(h){var d=this.externalFltEls[r];h.appendChild(d);var f=this.getFilterType(r);this.gridLayout&&""===d.innerHTML&&f!==this.fltTypeInp&&((f===this.fltTypeSlc||f===this.fltTypeMulti)&&t.dropdown.build(r),f===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",a=u["default"].tag(H,s),l=0,r=a.length;r>l;l++)if(void 0!==a[l][n]&&a[l][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",a=this.isImported(e,n);if(!a){var l=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===f["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,l))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var a=s.indexOf(";",n);-1===a&&(a=s.length),e=unescape(s.substring(n,a))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var a=t.split(RegExp.$1),l=void 0,r=void 0,o=void 0;l="M"===e.substring(0,1)?a[0]:"M"===e.substring(1,2)?a[1]:a[2],r="D"===e.substring(0,1)?a[0]:"D"===e.substring(1,2)?a[1]:a[2],o="Y"===e.substring(0,1)?a[0]:"Y"===e.substring(1,2)?a[1]:a[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(l,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(l,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,a=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(a[2]),s(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(a[2]),a[1]-1,a[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===a["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(R[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var P=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===P.length&&(P[0].async_sort=!0,P[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return l(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var a=this.popUpFltElms[n],l=this.tf.getHeaderElement(n),r=.95*l.clientWidth;a.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iC;C++)if(t===C&&(!e||e&&n.disableExcludedOptions)||t==C&&e&&(""===o[m].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(m))&&(void 0===f||f==t||f!=t&&-1!=n.validRowsIndex.indexOf(m)))){var w=n.getCellData(y[C]),x=d["default"].matchCase(w,u);if(h["default"].has(this.opts,x,u)||this.opts.push(w),e&&n.disableExcludedOptions){var T=b[C];T||(T=n.getFilteredDataCol(C)),h["default"].has(T,x,u)||h["default"].has(v,x,u)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var k=n.getCustomOptions(t);this.opts=k[0],this.optsTxt=k[1]}if(n.sortSlc&&!this.isCustom&&(u?(this.opts.sort(),v&&v.sort()):(this.opts.sort(c["default"].ignoreCase),v&&v.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(R){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,l,e,v,p,g),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addOptions",value:function(t,e,i,s,n,a){var l=this.tf,o=d["default"].lower(this.slcFillingMethod),u=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var f=0;f"+p+""}else{var b;b=l.loadFltOnDemand&&u===this.opts[f]&&l.getFilterType(t)===l.fltTypeSlc?r["default"].createOpt(p,c,!0):l.getFilterType(t)!==l.fltTypeMulti?r["default"].createOpt(p,c," "!==n[t]&&c===n[t]?!0:!1):r["default"].createOpt(p,c,h["default"].has(a,d["default"].matchCase(this.opts[f],l.matchCase),l.matchCase)||-1!==a.toString().indexOf(c)?!0:!1),g&&(b.disabled=!0),e.appendChild(b)}}"innerhtml"===o&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=d["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=r["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=r["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var a=r["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(a)}}return t}}]),t}()},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),a=s(n);e["default"]={ignoreCase:function(t,e){var i=a["default"].lower(t),s=a["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===u[v].style.display&&!n.paging||n.paging&&(!f||f===t||f!=t&&-1!=n.validRowsIndex.indexOf(v)))){var _=n.getCellData(b[y]),C=d["default"].matchCase(_,n.matchCase);h["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=p[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),h["default"].has(w,C,n.matchCase)||h["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(c["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(c["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,o,n.separator),n.loadFltOnDemand&&(l.innerHTML=""),l.appendChild(o),l.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t)}}},{key:"addChecks",value:function(t,e){var i=this,s=this.tf,n=this.addTChecks(t,e),a=[],l=s.feature("store"),o=l?l.getFilterValues(s.fltsValuesCookie)[t]:null;o&&d["default"].trim(o).length>0&&(s.hasCustomSlcOptions&&-1!=s.customSlcOptions.cols.indexOf(t)?a.push(o):a=o.split(" "+s.orOperator+" "));for(var u=0;u0?1:0),a=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=d["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=d["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=d["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),a=d["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),l=d["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=d["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=d["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)a.innerHTML=this.btnPrevPageHtml,b["default"].add(a,"click",s.prev);else{var h=d["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),a.appendChild(h)}if(this.btnLastPageHtml)l.innerHTML=this.btnLastPageHtml,b["default"].add(l,"click",s.last);else{var u=d["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]); -u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),l.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var f=d["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);f.className=this.btnPageCssClass,b["default"].add(f,"click",s.first),r.appendChild(f)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?d["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(a);var p=d["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(d["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=d["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(d["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=d["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(d["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(l),this.pagingSlc=d["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?d["default"].id(this.pagingTgtId):e.mDiv,s=d["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;na;a++){var r=e.validRowsIndex[a],o=i[r],h=o.getAttribute("validRow"),u=!1;a>=s&&n>a?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,a,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=d["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],a=this.resultsPerPage[1],l=d["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);l.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?d["default"].id(this.resultsPerPageTgtId):e.rDiv;l.appendChild(d["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(l,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(l),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=d["default"].id(this.prfxBtnNextSpan+e.id),s=d["default"].id(this.prfxBtnPrevSpan+e.id),n=d["default"].id(this.prfxBtnLastSpan+e.id),a=d["default"].id(this.prfxBtnFirstSpan+e.id),l=d["default"].id(this.prfxPgBeforeSpan+e.id),r=d["default"].id(this.prfxPgAfterSpan+e.id),o=d["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),d["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),d["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),d["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),d["default"].remove(n)),a&&(b["default"].remove(a,"click",h.first),d["default"].remove(a)),l&&d["default"].remove(l),r&&d["default"].remove(r),o&&d["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return l(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;f["default"].add(n,"click",function(){t.onClick()})}else{var a=u["default"].create("a",["href","javascript:void(0);"]);a.className=e.btnResetCssClass,a.appendChild(u["default"].text(this.btnResetText)),i.appendChild(a),f["default"].add(a,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return l(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var a=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var l=i.firstChild;f["default"].add(l,"click",function(){t.toggle()}),a.appendChild(s)}else{a.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),f["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&a.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,f["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,f["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;il;l++){var r=i?l:e[l];this.setRowBg(r,a),a++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + // Features + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.TableFilter = undefined; + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + var _emitter = __webpack_require__(9); + + var _store = __webpack_require__(10); + + var _gridLayout = __webpack_require__(11); + + var _loader = __webpack_require__(13); + + var _highlightKeywords = __webpack_require__(14); + + var _popupFilter = __webpack_require__(15); + + var _dropdown = __webpack_require__(16); + + var _checkList = __webpack_require__(18); + + var _rowsCounter = __webpack_require__(19); + + var _statusBar = __webpack_require__(20); + + var _paging = __webpack_require__(21); + + var _clearButton = __webpack_require__(22); + + var _help = __webpack_require__(23); + + var _alternateRows = __webpack_require__(24); + + var _noResults = __webpack_require__(25); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var global = window, + doc = global.document; + + var TableFilter = exports.TableFilter = (function () { + + /** + * TableFilter object constructor + * requires `table` or `id` arguments, `row` and `configuration` optional + * @param {DOMElement} table Table DOM element + * @param {String} id Table id + * @param {Number} row index indicating the 1st row + * @param {Object} configuration object + */ + + function TableFilter() { + var _this = this; + + _classCallCheck(this, TableFilter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (args.length === 0) { + return; + } + + this.id = null; + this.version = '0.1.5'; + this.year = new Date().getFullYear(); + this.tbl = null; + this.startRow = null; + this.refRow = null; + this.headersRow = null; + this.cfg = {}; + this.nbFilterableRows = null; + this.nbRows = null; + this.nbCells = null; + this._hasGrid = false; + + // TODO: use for-of with babel plug-in + args.forEach(function (arg) { + // for (let arg of args) { + var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); + if (argtype === 'object' && arg && arg.nodeName === 'TABLE') { + _this.tbl = arg; + _this.id = arg.id || 'tf_' + new Date().getTime() + '_'; + } else if (argtype === 'string') { + _this.id = arg; + _this.tbl = _dom2.default.id(arg); + } else if (argtype === 'number') { + _this.startRow = arg; + } else if (argtype === 'object') { + _this.cfg = arg; + } + // } + }); + + if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) { + throw new Error('Could not instantiate TableFilter: HTML table not found.'); + } + + // configuration object + var f = this.cfg; + + this.emitter = new _emitter.Emitter(); + + //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 || 'tablefilter/'; + + /*** filter types ***/ + this.fltTypeInp = 'input'; + this.fltTypeSlc = 'select'; + this.fltTypeMulti = 'multiple'; + this.fltTypeCheckList = 'checklist'; + this.fltTypeNone = 'none'; + + /*** filters' grid properties ***/ + + //enables/disables filter grid + this.fltGrid = f.grid === false ? false : true; + + //enables/disables grid layout (fixed headers) + this.gridLayout = Boolean(f.grid_layout); + + this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index; + this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index; + + // 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 valid rows indexes (rows visible upon filtering) + this.validRowsIndex = []; + //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; + + //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.stylePath = f.style_path || this.basePath + 'style/'; + this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows); + //defines widths of columns + this.hasColWidths = _types2.default.isArray(f.col_widths); + this.colWidths = this.hasColWidths ? f.col_widths : null; + //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'; + + /*** filters' grid behaviours ***/ + //enables/disables enter key + this.enterKey = f.enter_key === false ? false : true; + //calls function before filtering starts + this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null; + //calls function after filtering + this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null; + //enables/disables case sensitivity + this.caseSensitive = Boolean(f.case_sensitive); + //has exact match per column + this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match); + this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : []; + //enables/disbles exact match for search + this.exactMatch = Boolean(f.exact_match); + //refreshes drop-down lists upon validation + this.linkedFilters = Boolean(f.linked_filters); + //wheter excluded options are disabled + this.disableExcludedOptions = Boolean(f.disable_excluded_options); + //stores active filter element + this.activeFlt = null; + //id of active filter + this.activeFilterId = null; + //enables always visible rows + this.hasVisibleRows = Boolean(f.rows_always_visible); + //array containing always visible rows + this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; + //enables/disables external filters generation + this.isExternalFlt = Boolean(f.external_flt_grid); + //array containing ids of external elements containing filters + this.externalFltTgtIds = f.external_flt_grid_ids || []; + //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null; + //enables/disables single filter search + this.singleSearchFlt = Boolean(f.single_filter); + //calls function after row is validated + this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null; + //input watermark text array + this.watermark = f.watermark || ''; + this.isWatermarkArray = _types2.default.isArray(this.watermark); + //id of toolbar container element + this.toolBarTgtId = f.toolbar_target_id || null; + //enables/disables help div + this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions); + //popup filters + this.popupFilters = Boolean(f.popup_filters); + //active columns color + this.markActiveColumns = Boolean(f.mark_active_columns); + //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null; + //calls function after active column header is marked + this.onAfterActiveColumn = _types2.default.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 || 'Clear'; + //enables/disables empty option in combo-box filters + this.enableEmptyOption = Boolean(f.enable_empty_option); + //defines empty option text + this.emptyText = f.empty_text || '(Empty)'; + //enables/disables non empty option in combo-box filters + this.enableNonEmptyOption = Boolean(f.enable_non_empty_option); + //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 = Boolean(f.sort_num_asc); + this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null; + //enables/disables descending numeric options sorting + this.isSortNumDesc = Boolean(f.sort_num_desc); + this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null; + //Select filters are populated on demand + this.loadFltOnDemand = Boolean(f.load_filters_on_demand); + this.hasCustomOptions = _types2.default.isObj(f.custom_options); + this.customOptions = f.custom_options; + + /*** 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 || '^[¥£€$]'; + this.separator = f.separator || ','; + + /*** rows counter ***/ + //show/hides rows counter + this.rowsCounter = Boolean(f.rows_counter); + + /*** status bar ***/ + //show/hides status bar + this.statusBar = Boolean(f.status_bar); + + /*** loader ***/ + //enables/disables loader/spinner indicator + this.loader = Boolean(f.loader); + + /*** validation - reset buttons/links ***/ + //show/hides filter's validation button + this.displayBtn = Boolean(f.btn); + //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 = Boolean(f.btn_reset); + //defines css class for reset button + this.btnResetCssClass = f.btn_reset_css_class || 'reset'; + //callback function before filters are cleared + this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null; + //callback function after filters are cleared + this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null; + + /*** paging ***/ + //enables/disables table paging + this.paging = Boolean(f.paging); + this.nbVisibleRows = 0; //nb visible rows + this.nbHiddenRows = 0; //nb hidden rows + + /*** autofilter on typing ***/ + //enables/disables auto filtering, table is filtered when user stops + //typing + this.autoFilter = Boolean(f.auto_filter); + //onkeyup delay timer (msecs) + this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900; + //typing indicator + this.isUserTyping = null; + this.autoFilterTimer = null; + + /*** keyword highlighting ***/ + //enables/disables keyword highlighting + this.highlightKeywords = Boolean(f.highlight_keywords); + + /*** No results feature ***/ + this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message); + + /*** 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 = _types2.default.isArray(f.col_number_format); + //array containing columns nb formats + this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null; + //enables date type per column + this.hasColDateType = _types2.default.isArray(f.col_date_type); + //array containing columns date type + this.colDateType = this.hasColDateType ? f.col_date_type : null; + + /*** 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_'; + //filter values cookie + this.prfxCookieFltsValues = 'tf_flts_'; + //page nb cookie + this.prfxCookiePageNb = 'tf_pgnb_'; + //page length cookie + this.prfxCookiePageLen = 'tf_pglen_'; + + /*** cookies ***/ + this.hasStoredValues = false; + //remembers filters values on page load + this.rememberGridValues = Boolean(f.remember_grid_values); + //cookie storing filter values + this.fltsValuesCookie = this.prfxCookieFltsValues + this.id; + //remembers page nb on page load + this.rememberPageNb = this.paging && f.remember_page_number; + //cookie storing page nb + this.pgNbCookie = this.prfxCookiePageNb + this.id; + //remembers page length on page load + this.rememberPageLen = this.paging && f.remember_page_length; + //cookie storing page length + this.pgLenCookie = this.prfxCookiePageLen + this.id; + + /*** extensions ***/ + //imports external script + this.extensions = f.extensions; + this.hasExtensions = _types2.default.isArray(this.extensions); + + /*** themes ***/ + this.enableDefaultTheme = Boolean(f.enable_default_theme); + //imports themes + this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes); + this.themes = f.themes || []; + //themes path + this.themesPath = f.themes_path || this.stylePath + 'themes/'; + + // Features registry + this.Mod = {}; + + // Extensions registry + this.ExtRegistry = {}; + + /*** TF events ***/ + this.Evt = { + // Detect key + + detectKey: function detectKey(e) { + if (!this.enterKey) { + return; + } + var _ev = e || global.event; + if (_ev) { + var key = _event2.default.keyCode(_ev); + if (key === 13) { + this.filter(); + _event2.default.cancel(_ev); + _event2.default.stop(_ev); + } else { + this.isUserTyping = true; + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + } + }, + + // if auto-filter on, detect user is typing and filter columns + onKeyUp: function onKeyUp(e) { + if (!this.autoFilter) { + return; + } + var _ev = e || global.event; + var key = _event2.default.keyCode(_ev); + this.isUserTyping = false; + + function filter() { + /*jshint validthis:true */ + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + if (!this.isUserTyping) { + this.filter(); + this.isUserTyping = null; + } + } + + if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) { + if (this.autoFilterTimer === null) { + this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay); + } + } else { + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + }, + + // if auto-filter on, detect user is typing + onKeyDown: function onKeyDown() { + if (!this.autoFilter) { + return; + } + this.isUserTyping = true; + }, + + // if auto-filter on, clear interval on filter blur + onInpBlur: function onInpBlur() { + if (this.autoFilter) { + this.isUserTyping = false; + global.clearInterval(this.autoFilterTimer); + } + // TODO: hack to prevent ezEditTable enter key event hijaking. + // Needs to be fixed in the vendor's library + if (this.hasExtension('advancedGrid')) { + var advGrid = this.extension('advancedGrid'); + var ezEditTable = advGrid._ezEditTable; + if (advGrid.cfg.editable) { + ezEditTable.Editable.Set(); + } + if (advGrid.cfg.selection) { + ezEditTable.Selection.Set(); + } + } + }, + + // set focused text-box filter as active + onInpFocus: function onInpFocus(e) { + var _ev = e || global.event; + var elm = _event2.default.target(_ev); + this.activeFilterId = elm.getAttribute('id'); + this.activeFlt = _dom2.default.id(this.activeFilterId); + if (this.popupFilters) { + _event2.default.cancel(_ev); + _event2.default.stop(_ev); + } + // TODO: hack to prevent ezEditTable enter key event hijaking. + // Needs to be fixed in the vendor's library + if (this.hasExtension('advancedGrid')) { + var advGrid = this.extension('advancedGrid'); + var ezEditTable = advGrid._ezEditTable; + if (advGrid.cfg.editable) { + ezEditTable.Editable.Remove(); + } + if (advGrid.cfg.selection) { + ezEditTable.Selection.Remove(); + } + } + }, + + // set focused drop-down filter as active + onSlcFocus: function onSlcFocus(e) { + var _ev = e || global.event; + var elm = _event2.default.target(_ev); + this.activeFilterId = elm.getAttribute('id'); + this.activeFlt = _dom2.default.id(this.activeFilterId); + // select is populated when element has focus + if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + this.Mod.dropdown.build(ct); + } + if (this.popupFilters) { + _event2.default.cancel(_ev); + _event2.default.stop(_ev); + } + }, + + // filter columns on drop-down filter change + onSlcChange: function onSlcChange(e) { + if (!this.activeFlt) { + return; + } + var _ev = e || global.event; + if (this.popupFilters) { + _event2.default.stop(_ev); + } + if (this.onSlcChange) { + this.filter(); + } + } /*, + // fill checklist filter on click if required + onCheckListClick(e) { + let _ev = e || global.event; + let elm = Event.target(_ev); + if(this.loadFltOnDemand && elm.getAttribute('filled') === '0'){ + let ct = elm.getAttribute('ct'); + this.Mod.checkList.build(ct); + this.Mod.checkList.checkListDiv[ct].onclick = null; + this.Mod.checkList.checkListDiv[ct].title = ''; + } + }*/ + + }; + } + + /** + * Initialise filtering grid bar behaviours and layout + * + * TODO: decompose in smaller methods + */ + + _createClass(TableFilter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this._hasGrid) { + return; + } + if (!this.tbl) { + this.tbl = _dom2.default.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 Mod = this.Mod; + var n = this.singleSearchFlt ? 1 : this.nbCells, + inpclass = undefined; + + //loads stylesheet if not imported + this.import(this.stylesheetId, this.stylesheet, null, 'link'); + + //loads theme + if (this.hasThemes) { + this.loadThemes(); + } + + if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { + Mod.store = new _store.Store(this); + Mod.store.init(); + } + + if (this.gridLayout) { + Mod.gridLayout = new _gridLayout.GridLayout(this); + Mod.gridLayout.init(); + } + + if (this.loader) { + if (!Mod.loader) { + Mod.loader = new _loader.Loader(this); + } + Mod.loader.init(); + } + + if (this.highlightKeywords) { + Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this); + Mod.highlightKeyword.init(); + } + + if (this.popupFilters) { + if (!Mod.popupFilter) { + Mod.popupFilter = new _popupFilter.PopupFilter(this); + } + Mod.popupFilter.init(); + } + + //filters grid is not generated + if (!this.fltGrid) { + this._initNoFilters(); + } else { + if (this.isFirstLoad) { + var fltrow = this._insertFiltersRow(); + // if(!this.gridLayout){ + // let 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.popupFilters){ + // fltrow.style.display = 'none'; + // } + // } + + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.tbl.rows.length; + + // Generate filters + for (var i = 0; i < n; i++) { + + // if(this.popupFilters){ + // Mod.popupFilter.build(i); + // } + this.emitter.emit('before-filter-init', this, i); + + var fltcell = _dom2.default.create(this.fltCellTag), + col = this.getFilterType(i), + externalFltTgtId = this.isExternalFlt ? 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; + + //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 (!Mod.dropdown) { + Mod.dropdown = new _dropdown.Dropdown(this); + } + Mod.dropdown.init(i, this.isExternalFlt, fltcell); + // let dropdown = Mod.dropdown; + + // let 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; + + // //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.loadFltOnDemand){ + // dropdown.build(i); + // } + + // Event.add(slc, 'keypress', + // this.Evt.detectKey.bind(this)); + // Event.add(slc, 'change', + // this.Evt.onSlcChange.bind(this)); + // Event.add(slc, 'focus', + // this.Evt.onSlcFocus.bind(this)); + + // 1st option is created here since dropdown.build isn't + // invoked + // if(this.loadFltOnDemand){ + // let opt0 = Dom.createOpt(this.displayAllText, ''); + // slc.appendChild(opt0); + // } + } + // checklist + else if (col === this.fltTypeCheckList) { + // let checkList; + // Mod.checkList = new CheckList(this); + // checkList = Mod.checkList; + if (!Mod.checkList) { + Mod.checkList = new _checkList.CheckList(this); + } + Mod.checkList.init(i, this.isExternalFlt, fltcell); + + // let divCont = Dom.create('div', + // ['id', checkList.prfxCheckListDiv+i+'_'+this.id], + // ['ct', i], ['filled', '0']); + // divCont.className = checkList.checkListDivCssClass; + + // //filter is appended in desired element + // if(externalFltTgtId){ + // Dom.id(externalFltTgtId).appendChild(divCont); + // this.externalFltEls.push(divCont); + // } else { + // fltcell.appendChild(divCont); + // } + + // checkList.checkListDiv[i] = divCont; + // this.fltIds.push(this.prfxFlt+i+'_'+this.id); + // if(!this.loadFltOnDemand){ + // checkList.build(i); + // } + + // if(this.loadFltOnDemand){ + // Event.add(divCont, 'click', + // this.Evt.onCheckListClick.bind(this)); + // divCont.appendChild( + // Dom.text(checkList.activateCheckListTxt)); + // } + } else { + //show/hide input + var inptype = col === this.fltTypeInp ? 'text' : 'hidden'; + var inp = _dom2.default.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; + _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this)); + + //filter is appended in desired element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(inp); + this.externalFltEls.push(inp); + } else { + fltcell.appendChild(inp); + } + + this.fltIds.push(this.prfxFlt + i + '_' + this.id); + + _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this)); + _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this)); + _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this)); + _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this)); + + if (this.rememberGridValues) { + var flts_values = this.Mod.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 = _dom2.default.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) { + _dom2.default.id(externalFltTgtId).appendChild(btn); + } else { + fltcell.appendChild(btn); + } + + _event2.default.add(btn, 'click', function () { + return _this2.filter(); + }); + } //if + + this.emitter.emit('after-filter-init', this, i); + } // for i + } else { + this._resetGrid(); + } //if isFirstLoad + } //if this.fltGrid + + /* Features */ + if (this.hasVisibleRows) { + this.emitter.on(['after-filtering'], function () { + return _this2.enforceVisibility(); + }); + this.enforceVisibility(); + } + if (this.rowsCounter) { + Mod.rowsCounter = new _rowsCounter.RowsCounter(this); + Mod.rowsCounter.init(); + } + if (this.statusBar) { + Mod.statusBar = new _statusBar.StatusBar(this); + Mod.statusBar.init(); + } + if (this.paging || Mod.paging) { + if (!Mod.paging) { + Mod.paging = new _paging.Paging(this); + Mod.paging.init(); + } + Mod.paging.reset(); + } + if (this.btnReset) { + Mod.clearButton = new _clearButton.ClearButton(this); + Mod.clearButton.init(); + } + if (this.help) { + if (!Mod.help) { + Mod.help = new _help.Help(this); + } + Mod.help.init(); + } + if (this.hasColWidths && !this.gridLayout) { + this.setColWidths(); + } + if (this.alternateRows) { + Mod.alternateRows = new _alternateRows.AlternateRows(this); + Mod.alternateRows.init(); + } + if (this.noResults) { + if (!Mod.noResults) { + Mod.noResults = new _noResults.NoResults(this); + } + Mod.noResults.init(); + } + + 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) { + _dom2.default.addClass(this.tbl, this.prfxTf); + } + + /* Loads extensions */ + if (this.hasExtensions) { + this.initExtensions(); + } + + // Subscribe to events + if (this.markActiveColumns) { + this.emitter.on(['before-filtering'], function () { + return _this2.clearActiveColumns(); + }); + this.emitter.on(['cell-processed'], function (tf, colIndex) { + return _this2.markActiveColumn(colIndex); + }); + } + if (this.linkedFilters) { + this.emitter.on(['after-filtering'], function () { + return _this2.linkFilters(); + }); + } + + if (this.onFiltersLoaded) { + this.onFiltersLoaded.call(null, this); + } + + this.emitter.emit('initialized', this); + } + }, { + key: '_insertFiltersRow', + value: function _insertFiltersRow() { + if (this.gridLayout) { + return; + } + var fltrow = undefined; + + var thead = _dom2.default.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++; + } + + fltrow.className = this.fltsRowCssClass; + + if (this.isExternalFlt) { + fltrow.style.display = 'none'; + } + + this.emitter.emit('filters-row-inserted', this, fltrow); + + return fltrow; + } + }, { + key: '_initNoFilters', + value: function _initNoFilters() { + if (this.fltGrid) { + return; + } + this.refRow = this.refRow > 0 ? this.refRow - 1 : 0; + // if(this.gridLayout){ + // this.refRow = 0; + // } + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.nbFilterableRows + this.refRow; + } + + /** + * Return a feature instance for a given name + * @param {String} name Name of the feature + * @return {Object} + */ + + }, { + key: 'feature', + value: function feature(name) { + return this.Mod[name]; + } + + /** + * Initialise all the extensions defined in the configuration object + */ + + }, { + key: 'initExtensions', + value: function initExtensions() { + var exts = this.extensions; + + this.emitter.emit('before-loading-extensions', this); + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + if (!this.ExtRegistry[ext.name]) { + this.loadExtension(ext); + } + } + this.emitter.emit('after-loading-extensions', this); + } + + /** + * Load an extension module + * @param {Object} ext Extension config object + */ + + }, { + key: 'loadExtension', + value: function loadExtension(ext) { + var _this3 = this; + + if (!ext || !ext.name) { + return; + } + + var name = ext.name; + var path = ext.path; + var modulePath = undefined; + + if (name && path) { + modulePath = ext.path + name; + } else { + name = name.replace('.js', ''); + modulePath = 'extensions/{}/{}'.replace(/{}/g, name); + } + + // Trick to set config's publicPath dynamically for Webpack... + __webpack_require__.p = this.basePath; + + __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) { + var inst = new mod.default(_this3, ext); + inst.init(); + _this3.ExtRegistry[name] = inst; + }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}); + } + + /** + * Get an extension instance + * @param {String} name Name of the extension + * @return {Object} Extension instance + */ + + }, { + key: 'extension', + value: function extension(name) { + return this.ExtRegistry[name]; + } + + /** + * Check passed extension name exists + * @param {String} name Name of the extension + * @return {Boolean} + */ + + }, { + key: 'hasExtension', + value: function hasExtension(name) { + return !_types2.default.isEmpty(this.ExtRegistry[name]); + } + + /** + * Destroy all the extensions defined in the configuration object + */ + + }, { + key: 'destroyExtensions', + value: function destroyExtensions() { + var exts = this.extensions; + + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + var extInstance = this.ExtRegistry[ext.name]; + if (extInstance) { + extInstance.destroy(); + this.ExtRegistry[ext.name] = null; + } + } + } + + /** + * Load themes defined in the configuration object + */ + + }, { + key: 'loadThemes', + value: function loadThemes() { + var themes = this.themes; + this.emitter.emit('before-loading-themes', this); + + //Default theme config + if (this.enableDefaultTheme) { + var defaultTheme = { name: 'default' }; + this.themes.push(defaultTheme); + } + if (_types2.default.isArray(themes)) { + for (var i = 0, len = themes.length; i < len; i++) { + var theme = themes[i]; + var name = theme.name; + var path = theme.path; + var styleId = this.prfxTf + name; + if (name && !path) { + path = this.themesPath + name + '/' + name + '.css'; + } else if (!name && theme.path) { + name = 'theme{0}'.replace('{0}', i); + } + + if (!this.isImported(path, 'link')) { + this.import(styleId, path, null, 'link'); + } + } + } + + //Some elements need to be overriden for default 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; + + this.emitter.emit('after-loading-themes', this); + } + + /** + * Return stylesheet DOM element for a given theme name + * @return {DOMElement} stylesheet element + */ + + }, { + key: 'getStylesheet', + value: function getStylesheet() { + var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; + + return _dom2.default.id(this.prfxTf + name); + } + + /** + * Destroy filter grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + if (!this._hasGrid) { + return; + } + var rows = this.tbl.rows, + Mod = this.Mod; + + this.clearFilters(); + + if (this.isExternalFlt && !this.popupFilters) { + this.removeExternalFlts(); + } + if (this.infDiv) { + this.removeToolbar(); + } + if (this.highlightKeywords) { + Mod.highlightKeyword.unhighlightAll(); + } + if (this.markActiveColumns) { + this.clearActiveColumns(); + this.emitter.off(['before-filtering'], function () { + return _this4.clearActiveColumns(); + }); + this.emitter.off(['cell-processed'], function (tf, colIndex) { + return _this4.markActiveColumn(colIndex); + }); + } + if (this.hasExtensions) { + this.destroyExtensions(); + } + + for (var j = this.refRow; j < this.nbRows; j++) { + // validate row + this.validateRow(j, true); + + //removes alternating colors + if (this.alternateRows) { + Mod.alternateRows.removeRowBg(j); + } + } //for j + + if (this.fltGrid && !this.gridLayout) { + this.fltGridEl = rows[this.filtersRowIndex]; + this.tbl.deleteRow(this.filtersRowIndex); + } + + // Destroy modules + Object.keys(Mod).forEach(function (key) { + var feature = Mod[key]; + if (feature && _types2.default.isFn(feature.destroy)) { + feature.destroy(); + } + }); + + // unsubscribe to events + if (this.hasVisibleRows) { + this.emitter.off(['after-filtering'], function () { + return _this4.enforceVisibility(); + }); + } + if (this.linkedFilters) { + this.emitter.off(['after-filtering'], function () { + return _this4.linkFilters(); + }); + } + + _dom2.default.removeClass(this.tbl, this.prfxTf); + this.nbHiddenRows = 0; + this.validRowsIndex = []; + this.activeFlt = null; + this._hasGrid = false; + this.tbl = null; + } + + /** + * Generate container element for paging, reset button, rows counter etc. + */ + + }, { + key: 'setToolbar', + value: function setToolbar() { + if (this.infDiv) { + return; + } + + /*** container div ***/ + var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); + infdiv.className = this.infDivCssClass; + + //custom container + if (this.toolBarTgtId) { + _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); + } + //grid-layout + else if (this.gridLayout) { + var gridLayout = this.Mod.gridLayout; + gridLayout.tblMainCont.appendChild(infdiv); + infdiv.className = gridLayout.gridInfDivCssClass; + } + //default location: just above the table + else { + var cont = _dom2.default.create('caption'); + cont.appendChild(infdiv); + this.tbl.insertBefore(cont, this.tbl.firstChild); + } + this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); + + /*** left div containing rows # displayer ***/ + var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); + ldiv.className = this.lDivCssClass; + infdiv.appendChild(ldiv); + this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); + + /*** right div containing reset button + + nb results per page select ***/ + var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); + rdiv.className = this.rDivCssClass; + infdiv.appendChild(rdiv); + this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); + + /*** mid div containing paging elements ***/ + var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); + mdiv.className = this.mDivCssClass; + infdiv.appendChild(mdiv); + this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); + + // Enable help instructions by default if topbar is generated and not + // explicitely set to false + if (_types2.default.isUndef(this.help)) { + if (!this.Mod.help) { + this.Mod.help = new _help.Help(this); + } + this.Mod.help.init(); + this.help = true; + } + } + + /** + * Remove toolbar container element + */ + + }, { + key: 'removeToolbar', + value: function removeToolbar() { + if (!this.infDiv) { + return; + } + _dom2.default.remove(this.infDiv); + this.infDiv = null; + + var tbl = this.tbl; + var captions = _dom2.default.tag(tbl, 'caption'); + if (captions.length > 0) { + [].forEach.call(captions, function (elm) { + tbl.removeChild(elm); + }); + } + } + + /** + * Remove all the external column filters + */ + + }, { + key: 'removeExternalFlts', + value: function removeExternalFlts() { + if (!this.isExternalFlt) { + return; + } + var ids = this.externalFltTgtIds, + len = ids.length; + for (var ct = 0; ct < len; ct++) { + var externalFltTgtId = ids[ct], + externalFlt = _dom2.default.id(externalFltTgtId); + if (externalFlt) { + externalFlt.innerHTML = ''; + } + } + } + + /** + * Check if given column implements a filter with custom options + * @param {Number} colIndex Column's index + * @return {Boolean} + */ + + }, { + key: 'isCustomOptions', + value: function isCustomOptions(colIndex) { + return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; + } + + /** + * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the + * custom options values and texts + * @param {Number} colIndex Column's index + * @return {Array} + */ + + }, { + key: 'getCustomOptions', + value: function getCustomOptions(colIndex) { + if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { + return; + } + + var customOptions = this.customOptions; + var cols = customOptions.cols; + var optTxt = [], + optArray = []; + var index = cols.indexOf(colIndex); + var slcValues = customOptions.values[index]; + var slcTexts = customOptions.texts[index]; + var slcSort = customOptions.sorts[index]; + + for (var r = 0, len = slcValues.length; r < len; r++) { + optArray.push(slcValues[r]); + if (slcTexts[r]) { + optTxt.push(slcTexts[r]); + } else { + optTxt.push(slcValues[r]); + } + } + if (slcSort) { + optArray.sort(); + optTxt.sort(); + } + return [optArray, optTxt]; + } + + /** + * Reset persisted filter values + */ + + }, { + key: 'resetValues', + value: function resetValues() { + //only loadFltOnDemand + if (this.rememberGridValues && this.loadFltOnDemand) { + this._resetGridValues(this.fltsValuesCookie); + } + this.filter(); + } + + /** + * Reset persisted filter values when load filters on demand feature is + * enabled + * @param {String} name cookie name storing filter values + */ + + }, { + key: '_resetGridValues', + value: function _resetGridValues(name) { + if (!this.loadFltOnDemand) { + return; + } + var fltsValues = this.Mod.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 = undefined, + opt = undefined; + var fltType = this.getFilterType(i); + // if loadFltOnDemand, drop-down needs to contain stored + // value(s) for filtering + if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { + var slc = _dom2.default.id(this.fltIds[i]); + slc.options[0].selected = false; + + //selects + if (slcFltsIndex.indexOf(i) != -1) { + opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + //multiple select + if (multiFltsIndex.indexOf(i) != -1) { + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + opt = _dom2.default.createOpt(s[j], s[j], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + } // if multiFltsIndex + } else if (fltType === this.fltTypeCheckList) { + var checkList = this.Mod.checkList; + var divChk = checkList.checkListDiv[i]; + divChk.title = divChk.innerHTML; + divChk.innerHTML = ''; + + var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); + ul.className = checkList.checkListCssClass; + + var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); + li0.className = checkList.checkListItemCssClass; + ul.appendChild(li0); + + divChk.appendChild(ul); + + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + var li = _dom2.default.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.Mod.paging.setPagingInfo(); + } + } //end if + } + + /** + * Filter the table by retrieving the data from each cell in every single + * row and comparing it to the search term for current column. A row is + * hidden when all the search terms are not found in inspected row. + * + * TODO: Reduce complexity of this massive method + */ + + }, { + key: 'filter', + value: function filter() { + if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { + return; + } + //invoke onbefore callback + if (this.onBeforeFilter) { + this.onBeforeFilter.call(null, this); + } + this.emitter.emit('before-filtering', this); + + var row = this.tbl.rows, + Mod = this.Mod, + hiddenrows = 0; + + this.validRowsIndex = []; + // search args re-init + this.searchArgs = this.getFiltersValue(); + + var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); + + //keyword highlighting + function highlight(str, ok, cell) { + /*jshint validthis:true */ + if (this.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 = _dom2.default.getText(cell); + } + if (w !== '') { + Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); + } + } + } + + //looks for search argument in current row + function hasArg(sA, cellData, j) { + /*jshint validthis:true */ + var occurence = undefined, + removeNbFormat = _helpers2.default.removeNbFormat; + + //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); + var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); + var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); + var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); + var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); + var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); + + var dte1 = undefined, + dte2 = undefined; + //dates + if (_date2.default.isValid(cellData, dtType)) { + dte1 = _date2.default.format(cellData, dtType); + // lower date + if (isLDate) { + dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); + occurence = dte1 < dte2; + } + // lower equal date + else if (isLEDate) { + dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); + occurence = dte1 <= dte2; + } + // greater equal date + else if (isGEDate) { + dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); + occurence = dte1 >= dte2; + } + // greater date + else if (isGDate) { + dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); + occurence = dte1 > dte2; + } + // different date + else if (isDFDate) { + dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); + occurence = dte1.toString() != dte2.toString(); + } + // equal date + else if (isEQDate) { + dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } else if (_date2.default.isValid(sA, dtType)) { + dte2 = _date2.default.format(sA, dtType); + occurence = dte1.toString() === dte2.toString(); + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } else { + //first numbers need to be formated + if (this.hasColNbFormat && this.colNbFormat[j]) { + numCellData = removeNbFormat(cellData, this.colNbFormat[j]); + nbFormat = this.colNbFormat[j]; + } else { + if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { + numCellData = removeNbFormat(cellData, 'us'); + nbFormat = 'us'; + } else { + numCellData = removeNbFormat(cellData, 'eu'); + nbFormat = 'eu'; + } + } + + // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, + // rgx:) + // lower equal + if (hasLE) { + occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); + } + //greater equal + else if (hasGE) { + occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); + } + //lower + else if (hasLO) { + occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); + } + //greater + else if (hasGR) { + occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); + } + //different + else if (hasDF) { + occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; + } + //like + else if (hasLK) { + occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } + //equal + else if (hasEQ) { + occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); + } + //starts with + else if (hasST) { + occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; + } + //ends with + else if (hasEN) { + var searchArg = sA.replace(re_en, ''); + occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } + //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(cellData); + } catch (e) { + occurence = false; + } + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } //else + return occurence; + } //fn + + for (var k = this.refRow; k < this.nbRows; k++) { + /*** if table already filtered some rows are not visible ***/ + if (this.getRowDisplay(row[k]) === '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 = true, + + //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]; + var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; + if (sA === '') { + continue; + } + + var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); + + //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 = undefined, + occur = false, + s = hasMultiOrSA ? sAOrSplit : sAAndSplit; + for (var w = 0, len = s.length; w < len; w++) { + cS = _string2.default.trim(s[w]); + occur = hasArg.call(this, cS, cellData, j); + highlight.call(this, cS, occur, cell[j]); + if (hasMultiOrSA && occur) { + break; + } + if (hasMultiAndSA && !occur) { + break; + } + } + occurence[j] = occur; + } + //single search parameter + else { + occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); + highlight.call(this, sA, occurence[j], cell[j]); + } //else single param + + if (!occurence[j]) { + isRowValid = false; + } + if (this.singleSearchFlt && occurence[j]) { + singleFltRowValid = true; + } + + this.emitter.emit('cell-processed', this, j, cell[j]); + } //for j + + if (this.singleSearchFlt && singleFltRowValid) { + isRowValid = true; + } + + if (!isRowValid) { + this.validateRow(k, false); + hiddenrows++; + } else { + this.validateRow(k, true); + } + + this.emitter.emit('row-processed', this, k, this.validRowsIndex.length, isRowValid); + } // for k + + this.nbVisibleRows = this.validRowsIndex.length; + this.nbHiddenRows = hiddenrows; + + //invokes onafterfilter callback + if (this.onAfterFilter) { + this.onAfterFilter.call(null, this); + } + + this.emitter.emit('after-filtering', this); + } + + /** + * Return the data of a specified colum + * @param {Number} colIndex Column index + * @param {Boolean} includeHeaders Optional: include headers row + * @param {Boolean} num Optional: return unformatted number + * @param {Array} exclude Optional: list of row indexes to be excluded + * @return {Array} Flat list of data for a column + */ + + }, { + key: 'getColValues', + value: function getColValues(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; + + if (!this.fltGrid) { + return; + } + var row = this.tbl.rows, + colValues = []; + + if (includeHeaders) { + colValues.push(this.getHeadersText()[colIndex]); + } + + for (var i = this.refRow; i < this.nbRows; i++) { + var isExludedRow = false; + // checks if current row index appears in exclude array + if (exclude.length > 0) { + isExludedRow = exclude.indexOf(i) != -1; + } + 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 !== '') { + continue; + } + var cellData = this.getCellData(cell[j]), + nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, + data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; + colValues.push(data); + } + } + } + return colValues; + } + + /** + * Return the filter's value of a specified column + * @param {Number} index Column index + * @return {String} Filter value + */ + + }, { + key: 'getFilterValue', + value: function getFilterValue(index) { + if (!this.fltGrid) { + return; + } + var fltValue = undefined, + flt = this.getFilterElement(index); + if (!flt) { + return ''; + } + + var fltColType = this.getFilterType(index); + if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { + fltValue = flt.value; + } + //mutiple select + else if (fltColType === this.fltTypeMulti) { + fltValue = ''; + for (var j = 0, len = flt.options.length; j < len; 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; + } + + /** + * Return the filters' values + * @return {Array} List of filters' values + */ + + }, { + key: 'getFiltersValue', + value: function getFiltersValue() { + if (!this.fltGrid) { + return; + } + var searchArgs = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); + } + return searchArgs; + } + + /** + * Return the ID of the filter of a specified column + * @param {Number} index Column's index + * @return {String} ID of the filter element + */ + + }, { + key: 'getFilterId', + value: function getFilterId(index) { + if (!this.fltGrid) { + return; + } + return this.fltIds[index]; + } + + /** + * Return the list of ids of filters matching a specified type. + * Note: hidden filters are also returned + * + * @param {String} type Filter type string ('input', 'select', 'multiple', + * 'checklist') + * @param {Boolean} bool If true returns columns indexes instead of IDs + * @return {[type]} List of element IDs or column indexes + */ + + }, { + key: 'getFiltersByType', + value: function getFiltersByType(type, bool) { + if (!this.fltGrid) { + return; + } + var arr = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + var fltType = this.getFilterType(i); + if (fltType === _string2.default.lower(type)) { + var a = bool ? i : this.fltIds[i]; + arr.push(a); + } + } + return arr; + } + + /** + * Return the filter's DOM element for a given column + * @param {Number} index Column's index + * @return {DOMElement} + */ + + }, { + key: 'getFilterElement', + value: function getFilterElement(index) { + var fltId = this.fltIds[index]; + return _dom2.default.id(fltId); + } + + /** + * Return the number of cells for a given row index + * @param {Number} rowIndex Index of the row + * @return {Number} Number of cells + */ + + }, { + key: 'getCellsNb', + value: function getCellsNb() { + var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; + + var tr = this.tbl.rows[rowIndex]; + return tr.cells.length; + } + + /** + * Return the number of filterable rows starting from reference row if + * defined + * @param {Boolean} includeHeaders Include the headers row + * @return {Number} Number of filterable rows + */ + + }, { + key: 'getRowsNb', + value: function getRowsNb(includeHeaders) { + var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, + ntrs = this.tbl.rows.length; + if (includeHeaders) { + s = 0; + } + return parseInt(ntrs - s, 10); + } + + /** + * Return the data of a given cell + * @param {DOMElement} cell Cell's DOM object + * @return {String} + */ + + }, { + key: 'getCellData', + value: function getCellData(cell) { + var idx = cell.cellIndex; + //Check for customCellData callback + if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { + return this.customCellData.call(null, this, cell, idx); + } else { + return _dom2.default.getText(cell); + } + } + + /** + * Return the table data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getTableData', + value: function getTableData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var rows = this.tbl.rows; + var tblData = []; + if (includeHeaders) { + tblData.push([this.getHeadersRowIndex(), this.getHeadersText()]); + } + for (var k = this.refRow; k < this.nbRows; k++) { + var rowData = [k, []]; + var cells = rows[k].cells; + for (var j = 0, len = cells.length; j < len; j++) { + var cellData = this.getCellData(cells[j]); + rowData[1].push(cellData); + } + tblData.push(rowData); + } + return tblData; + } + + /** + * Return the filtered data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredData', + value: function getFilteredData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + if (!this.validRowsIndex) { + return []; + } + var rows = this.tbl.rows, + filteredData = []; + if (includeHeaders) { + filteredData.push([this.getHeadersRowIndex(), this.getHeadersText()]); + } + + var validRows = this.getValidRows(true); + for (var i = 0; i < validRows.length; i++) { + var rData = [this.validRowsIndex[i], []], + cells = rows[this.validRowsIndex[i]].cells; + for (var k = 0; k < cells.length; k++) { + var cellData = this.getCellData(cells[k]); + rData[1].push(cellData); + } + filteredData.push(rData); + } + return filteredData; + } + + /** + * Return the filtered data for a given column index + * @param {Number} colIndex Colmun's index + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} Flat list of values ['val0','val1','val2'...] + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredDataCol', + value: function getFilteredDataCol(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + + if (_types2.default.isUndef(colIndex)) { + return []; + } + var data = this.getFilteredData(), + colData = []; + if (includeHeaders) { + colData.push(this.getHeadersText()[colIndex]); + } + for (var i = 0, len = data.length; i < len; 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; + } + + /** + * Get the display value of a row + * @param {RowElement} DOM element of the row + * @return {String} Usually 'none' or '' + */ + + }, { + key: 'getRowDisplay', + value: function getRowDisplay(row) { + if (!_types2.default.isObj(row)) { + return null; + } + return row.style.display; + } + + /** + * Validate/invalidate row by setting the 'validRow' attribute on the row + * @param {Number} rowIndex Index of the row + * @param {Boolean} isValid + */ + + }, { + key: 'validateRow', + value: function validateRow(rowIndex, isValid) { + var row = this.tbl.rows[rowIndex]; + if (!row || typeof isValid !== 'boolean') { + return; + } + + // always visible rows are valid + if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { + isValid = true; + } + + var displayFlag = isValid ? '' : 'none', + validFlag = isValid ? 'true' : 'false'; + row.style.display = displayFlag; + + if (this.paging) { + row.setAttribute('validRow', validFlag); + } + + if (isValid) { + if (this.validRowsIndex.indexOf(rowIndex) === -1) { + this.validRowsIndex.push(rowIndex); + } + + if (this.onRowValidated) { + this.onRowValidated.call(null, this, rowIndex); + } + + this.emitter.emit('row-validated', this, rowIndex); + } + } + + /** + * Validate all filterable rows + */ + + }, { + key: 'validateAllRows', + value: function validateAllRows() { + if (!this._hasGrid) { + return; + } + this.validRowsIndex = []; + for (var k = this.refRow; k < this.nbFilterableRows; k++) { + this.validateRow(k, true); + } + } + + /** + * Set search value to a given filter + * @param {Number} index Column's index + * @param {String} searcharg Search term + */ + + }, { + key: 'setFilterValue', + value: function setFilterValue(index) { + var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; + + if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { + return; + } + var slc = this.getFilterElement(index), + fltColType = this.getFilterType(index); + + if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { + slc.value = searcharg; + } + //multiple selects + else if (fltColType === this.fltTypeMulti) { + var s = searcharg.split(' ' + this.orOperator + ' '); + // let ct = 0; //keywords counter + for (var j = 0, len = slc.options.length; j < len; j++) { + var option = slc.options[j]; + if (s === '' || s[0] === '') { + option.selected = false; + } + if (option.value === '') { + option.selected = false; + } + if (option.value !== '' && _array2.default.has(s, option.value, true)) { + option.selected = true; + } //if + } //for j + } + //checklist + else if (fltColType === this.fltTypeCheckList) { + searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); + var sarg = searcharg.split(' ' + this.orOperator + ' '); + var lisNb = _dom2.default.tag(slc, 'li').length; + + slc.setAttribute('value', ''); + slc.setAttribute('indexes', ''); + + for (var k = 0; k < lisNb; k++) { + var li = _dom2.default.tag(slc, 'li')[k], + lbl = _dom2.default.tag(li, 'label')[0], + chk = _dom2.default.tag(li, 'input')[0], + lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); + if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { + chk.checked = true; + this.Mod.checkList.setCheckListValues(chk); + } else { + chk.checked = false; + this.Mod.checkList.setCheckListValues(chk); + } + } + } + } + + /** + * Set them columns' widths as per configuration + * @param {Number} rowIndex Optional row index to apply the widths to + * @param {Element} tbl DOM element + */ + + }, { + key: 'setColWidths', + value: function setColWidths(rowIndex, tbl) { + if (!this.fltGrid || !this.hasColWidths) { + return; + } + tbl = tbl || this.tbl; + var rIndex = undefined; + if (rowIndex === undefined) { + rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; + } else { + rIndex = rowIndex; + } + + setWidths.call(this); + + function setWidths() { + /*jshint validthis:true */ + var nbCols = this.nbCells; + var colWidths = this.colWidths; + var colTags = _dom2.default.tag(tbl, 'col'); + var tblHasColTag = colTags.length > 0; + var frag = !tblHasColTag ? doc.createDocumentFragment() : null; + for (var k = 0; k < nbCols; k++) { + var col = undefined; + if (tblHasColTag) { + col = colTags[k]; + } else { + col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); + frag.appendChild(col); + } + col.style.width = colWidths[k]; + } + if (!tblHasColTag) { + tbl.insertBefore(frag, tbl.firstChild); + } + } + } + + /** + * Makes defined rows always visible + */ + + }, { + key: 'enforceVisibility', + value: function enforceVisibility() { + if (!this.hasVisibleRows) { + return; + } + for (var i = 0, len = this.visibleRows.length; i < len; i++) { + var row = this.visibleRows[i]; + //row index cannot be > nrows + if (row <= this.nbRows) { + this.validateRow(row, true); + } + } + } + + /** + * Clear all the filters' values + */ + + }, { + key: 'clearFilters', + value: function clearFilters() { + if (!this.fltGrid) { + return; + } + + this.emitter.emit('before-clearing-filters', this); + + if (this.onBeforeReset) { + this.onBeforeReset.call(null, this, this.getFiltersValue()); + } + for (var i = 0, len = this.fltIds.length; i < len; i++) { + this.setFilterValue(i, ''); + } + // if(this.linkedFilters){ + // this.linkFilters(); + // } + if (this.rememberPageLen) { + _cookie2.default.remove(this.pgLenCookie); + } + if (this.rememberPageNb) { + _cookie2.default.remove(this.pgNbCookie); + } + if (this.onAfterReset) { + this.onAfterReset.call(null, this); + } + + this.filter(); + + this.emitter.emit('after-clearing-filters', this); + } + + /** + * Clears filtered columns visual indicator (background color) + */ + + }, { + key: 'clearActiveColumns', + value: function clearActiveColumns() { + for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { + _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); + } + } + + /** + * Mark currently filtered column + * @param {Number} colIndex Column index + */ + + }, { + key: 'markActiveColumn', + value: function markActiveColumn(colIndex) { + var header = this.getHeaderElement(colIndex); + if (_dom2.default.hasClass(header, this.activeColumnsCssClass)) { + return; + } + if (this.onBeforeActiveColumn) { + this.onBeforeActiveColumn.call(null, this, colIndex); + } + _dom2.default.addClass(header, this.activeColumnsCssClass); + if (this.onAfterActiveColumn) { + this.onAfterActiveColumn.call(null, this, colIndex); + } + } + + /** + * Refresh the filters subject to linking ('select', 'multiple', + * 'checklist' type) + */ + + }, { + key: 'linkFilters', + value: function linkFilters() { + if (!this.linkedFilters || !this.activeFilterId) { + return; + } + 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); + + var activeFlt = this.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(this.prfxFlt)[1]; + var slcSelectedValue = undefined; + for (var i = 0, len = slcIndex.length; i < len; i++) { + var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); + slcSelectedValue = this.getFilterValue(slcIndex[i]); + + // Welcome to cyclomatic complexity hell :) + // TODO: simplify/refactor if statement + if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; + } else { + curSlc.innerHTML = ''; + } + + //1st option needs to be inserted + if (this.loadFltOnDemand) { + var opt0 = _dom2.default.createOpt(this.displayAllText, ''); + if (curSlc) { + curSlc.appendChild(opt0); + } + } + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList.build(slcIndex[i]); + } else { + this.Mod.dropdown.build(slcIndex[i], true); + } + + this.setFilterValue(slcIndex[i], slcSelectedValue); + } + } // for i + } + + /** + * Re-generate the filters grid bar when previously removed + */ + + }, { + key: '_resetGrid', + value: function _resetGrid() { + if (this.isFirstLoad) { + return; + } + + var Mod = this.Mod; + var tbl = this.tbl; + var rows = tbl.rows; + var filtersRowIndex = this.filtersRowIndex; + var filtersRow = rows[filtersRowIndex]; + + // grid was removed, grid row element is stored in fltGridEl property + if (!this.gridLayout) { + // If table has a thead ensure the filters row is appended in the + // thead element + if (tbl.tHead) { + var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); + tbl.tHead.replaceChild(this.fltGridEl, tempRow); + } else { + filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); + } + + _dom2.default.addClass(tbl, this.prfxTf); + } + + // filters are appended in external placeholders elements + if (this.isExternalFlt) { + var externalFltTgtIds = this.externalFltTgtIds; + for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { + var extFlt = _dom2.default.id(externalFltTgtIds[ct]); + + if (!extFlt) { + continue; + } + + var externalFltEl = this.externalFltEls[ct]; + extFlt.appendChild(externalFltEl); + var colFltType = this.getFilterType(ct); + //IE special treatment for gridLayout, appended filters are + //empty + if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { + if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { + Mod.dropdown.build(ct); + } + if (colFltType === this.fltTypeCheckList) { + Mod.checkList.build(ct); + } + } + } + } + + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = rows.length; + + if (this.popupFilters) { + this.headersRow++; + Mod.popupFilter.reset(); + } + + this._hasGrid = true; + } + + /** + * Determines if passed filter column implements exact query match + * @param {Number} colIndex [description] + * @return {Boolean} [description] + */ + + }, { + key: 'isExactMatch', + value: function isExactMatch(colIndex) { + var fltType = this.getFilterType(colIndex); + return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; + } + + /** + * Check if passed script or stylesheet is already imported + * @param {String} filePath Ressource path + * @param {String} type Possible values: 'script' or 'link' + * @return {Boolean} + */ + + }, { + key: 'isImported', + value: function isImported(filePath, type) { + var imported = false, + importType = !type ? 'script' : type, + attr = importType == 'script' ? 'src' : 'href', + files = _dom2.default.tag(doc, importType); + for (var i = 0, len = files.length; i < len; i++) { + if (files[i][attr] === undefined) { + continue; + } + if (files[i][attr].match(filePath)) { + imported = true; + break; + } + } + return imported; + } + + /** + * Import script or stylesheet + * @param {String} fileId Ressource ID + * @param {String} filePath Ressource path + * @param {Function} callback Callback + * @param {String} type Possible values: 'script' or 'link' + */ + + }, { + key: 'import', + value: function _import(fileId, filePath, callback, type) { + var ftype = !type ? 'script' : type, + imported = this.isImported(filePath, ftype); + if (imported) { + return; + } + var o = this, + isLoaded = false, + file = undefined, + head = _dom2.default.tag(doc, 'head')[0]; + + if (_string2.default.lower(ftype) === 'link') { + file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); + } else { + file = _dom2.default.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: ' + filePath); + }; + head.appendChild(file); + } + + /** + * Check if table has filters grid + * @return {Boolean} + */ + + }, { + key: 'hasGrid', + value: function hasGrid() { + return this._hasGrid; + } + + /** + * Get list of filter IDs + * @return {[type]} [description] + */ + + }, { + key: 'getFiltersId', + value: function getFiltersId() { + return this.fltIds || []; + } + + /** + * Get filtered (valid) rows indexes + * @param {Boolean} reCalc Force calculation of filtered rows list + * @return {Array} List of row indexes + */ + + }, { + key: 'getValidRows', + value: function getValidRows(reCalc) { + 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; + } + + /** + * Get the index of the row containing the filters + * @return {Number} + */ + + }, { + key: 'getFiltersRowIndex', + value: function getFiltersRowIndex() { + return this.filtersRowIndex; + } + + /** + * Get the index of the headers row + * @return {Number} + */ + + }, { + key: 'getHeadersRowIndex', + value: function getHeadersRowIndex() { + return this.headersRow; + } + + /** + * Get the row index from where the filtering process start (1st filterable + * row) + * @return {Number} + */ + + }, { + key: 'getStartRowIndex', + value: function getStartRowIndex() { + return this.refRow; + } + + /** + * Get the index of the last row + * @return {Number} + */ + + }, { + key: 'getLastRowIndex', + value: function getLastRowIndex() { + if (!this._hasGrid) { + return; + } + return this.nbRows - 1; + } + + /** + * Get the header DOM element for a given column index + * @param {Number} colIndex Column index + * @return {Object} + */ + + }, { + key: 'getHeaderElement', + value: function getHeaderElement(colIndex) { + var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; + var tHead = _dom2.default.tag(table, 'thead'); + var headersRow = this.headersRow; + var header = undefined; + for (var i = 0; i < this.nbCells; i++) { + if (i !== colIndex) { + continue; + } + if (tHead.length === 0) { + header = table.rows[headersRow].cells[i]; + } + if (tHead.length === 1) { + header = tHead[0].rows[headersRow].cells[i]; + } + break; + } + return header; + } + + /** + * Return the list of headers' text + * @return {Array} list of headers' text + */ + + }, { + key: 'getHeadersText', + value: function getHeadersText() { + var headers = []; + for (var j = 0; j < this.nbCells; j++) { + var header = this.getHeaderElement(j); + var headerText = _dom2.default.getText(header); + headers.push(headerText); + } + return headers; + } + + /** + * Return the filter type for a specified column + * @param {Number} colIndex Column's index + * @return {String} + */ + + }, { + key: 'getFilterType', + value: function getFilterType(colIndex) { + var colType = this.cfg['col_' + colIndex]; + return !colType ? this.fltTypeInp : _string2.default.lower(colType); + } + + /** + * Get the total number of filterable rows + * @return {Number} + */ + + }, { + key: 'getFilterableRowsNb', + value: function getFilterableRowsNb() { + return this.getRowsNb(false); + } + + /** + * Get the configuration object (literal object) + * @return {Object} + */ + + }, { + key: 'config', + value: function config() { + return this.cfg; + } + }]); + + return TableFilter; + })(); + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * DOM event utilities + */ + + exports.default = { + 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; + } + }, + target: function target(evt) { + return evt && evt.target || window.event && window.event.srcElement; + }, + keyCode: function keyCode(evt) { + return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; + } + }; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * DOM utilities + */ + + exports.default = { + + /** + * Returns text + text of children of given node + * @param {NodeElement} node + * @return {String} + */ + + getText: function getText(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 + */ + create: function create(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]); + } + } + } + return el; + }, + + /** + * Removes passed node from DOM + * @param {DOMElement} node + * @return {DOMElement} old node reference + */ + remove: function remove(node) { + return node.parentNode.removeChild(node); + }, + + /** + * Returns a text node with given text + * @param {String} txt + * @return {Object} + */ + text: function text(txt) { + return document.createTextNode(txt); + }, + hasClass: function hasClass(ele, cls) { + if (!ele) { + return false; + } + + if (supportsClassList()) { + return ele.classList.contains(cls); + } + return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); + }, + addClass: function addClass(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; + } + }, + removeClass: function removeClass(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 + */ + createOpt: function createOpt(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 + */ + createCheckItem: function createCheckItem(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; + }, + id: function id(key) { + return document.getElementById(key); + }, + tag: function tag(o, tagname) { + return o.getElementsByTagName(tagname); + } + }; + + // HTML5 classList API + + function supportsClassList() { + return document.documentElement.classList; + } + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * String utilities + */ + + exports.default = { + lower: function lower(text) { + return text.toLowerCase(); + }, + upper: function upper(text) { + return text.toUpperCase(); + }, + trim: function trim(text) { + if (text.trim) { + return text.trim(); + } + return text.replace(/^\s*|\s*$/g, ''); + }, + isEmpty: function isEmpty(text) { + return this.trim(text) === ''; + }, + rgxEsc: function rgxEsc(text) { + var chars = /[-\/\\^$*+?.()|[\]{}]/g; + var escMatch = '\\$&'; + return String(text).replace(chars, escMatch); + }, + matchCase: function matchCase(text, caseSensitive) { + if (!caseSensitive) { + return this.lower(text); + } + return text; + }, + + /** + * Checks if passed data contains the searched term + * @param {String} term Searched term + * @param {String} data Data string + * @param {Boolean} exactMatch Exact match + * @param {Boolean} caseSensitive Case sensitive + * @return {Boolean} + */ + contains: function contains(term, data) { + var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; + + // Improved by Cedric Wartel (cwl) automatic exact match for selects and + // special characters are now filtered + var regexp = undefined, + modifier = caseSensitive ? 'g' : 'gi'; + if (exactMatch) { + regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); + } else { + regexp = new RegExp(this.rgxEsc(term), modifier); + } + return regexp.test(data); + } + }; + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Cookie utilities + */ + + exports.default = { + write: function write(name, value, hours) { + var expire = ''; + if (hours) { + expire = new Date(new Date().getTime() + hours * 3600000); + expire = '; expires=' + expire.toGMTString(); + } + document.cookie = name + '=' + escape(value) + expire; + }, + read: function read(name) { + var cookieValue = '', + search = name + '='; + if (document.cookie.length > 0) { + var cookie = document.cookie, + offset = cookie.indexOf(search); + if (offset !== -1) { + offset += search.length; + var end = cookie.indexOf(';', offset); + if (end === -1) { + end = cookie.length; + } + cookieValue = unescape(cookie.substring(offset, end)); + } + } + return cookieValue; + }, + remove: function remove(name) { + this.write(name, '', -1); + }, + valueToArray: function valueToArray(name, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.read(name); + //creates an array with filters' values + var arr = val.split(separator); + return arr; + }, + getValueByIndex: function getValueByIndex(name, index, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.valueToArray(name, separator); + return val[index]; + } + }; + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * Types utilities + */ + + var UNDEFINED = void 0; + + exports.default = { + /** + * Check if argument is an object or a global object + * @param {String or Object} v + * @return {Boolean} + */ + + isObj: function isObj(v) { + var isO = false; + if (typeof v === 'string') { + if (window[v] && _typeof(window[v]) === 'object') { + isO = true; + } + } else { + if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { + isO = true; + } + } + return isO; + }, + + /** + * Check if argument is a function + * @param {Function} fn + * @return {Boolean} + */ + isFn: function isFn(fn) { + return fn && fn.constructor == Function; + }, + + /** + * Check if argument is an array + * @param {Array} obj + * @return {Boolean} + */ + isArray: function isArray(obj) { + return obj && obj.constructor == Array; + }, + + /** + * Determine if argument is undefined + * @param {Any} o + * @return {Boolean} + */ + isUndef: function isUndef(o) { + return o === UNDEFINED; + }, + + /** + * Determine if argument is null + * @param {Any} o + * @return {Boolean} + */ + isNull: function isNull(o) { + return o === null; + }, + + /** + * Determine if argument is empty (undefined, null or empty string) + * @param {Any} o + * @return {Boolean} + */ + isEmpty: function isEmpty(o) { + return this.isUndef(o) || this.isNull(o) || o.length === 0; + } + }; + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + has: function has(arr, val, caseSensitive) { + var sCase = caseSensitive === undefined ? false : caseSensitive; + for (var i = 0; i < arr.length; i++) { + if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { + return true; + } + } + return false; + } + }; /** + * Array utilities + */ + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Date utilities + */ + + exports.default = { + 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 = undefined, + reg2 = undefined; + // 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 = undefined, + dd = undefined, + yy = undefined; + // 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(dateStr, formatStr) { + if (!formatStr) { + formatStr = 'DMY'; + } + if (!dateStr || dateStr === '') { + return new Date(1001, 0, 1); + } + var oDate = undefined; + var parts = undefined; + + switch (formatStr.toUpperCase()) { + case 'DDMMMYYYY': + parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); + oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); + break; + case 'DMY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'MDY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'YMD': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + default: + //in case format is not correct + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + } + return oDate; + } + }; + + function y2kDate(yr) { + if (yr === undefined) { + return 0; + } + if (yr.length > 2) { + return yr; + } + var y = undefined; + //>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; + } + + function mmm2mm(mmm) { + if (mmm === undefined) { + return 0; + } + var mondigit = undefined; + 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; + } + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + removeNbFormat: function removeNbFormat(data, format) { + if (!data) { + return; + } + if (!format) { + format = 'us'; + } + var n = data; + if (_string2.default.lower(format) === 'us') { + n = +n.replace(/[^\d\.-]/g, ''); + } else { + n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); + } + return n; + } + }; /** + * Misc helpers + */ + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + "use strict"; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Event emitter class + */ + + var Emitter = exports.Emitter = (function () { + function Emitter() { + _classCallCheck(this, Emitter); + + /** + * Events object + * @type {Object} + */ + this.events = {}; + } + + /** + * Subscribe to an event + * @param {Array} evts Collection of event names + * @param {Function} fn Function invoked when event is emitted + */ + + _createClass(Emitter, [{ + key: "on", + value: function on(evts, fn) { + var _this = this; + + evts.forEach(function (evt) { + _this.events[evt] = _this.events[evt] || []; + _this.events[evt].push(fn); + }); + } + + /** + * Unsubscribe to an event + * @param {Array} evts Collection of event names + * @param {Function} fn Function invoked when event is emitted + */ + + }, { + key: "off", + value: function off(evts, fn) { + var _this2 = this; + + evts.forEach(function (evt) { + if (evt in _this2.events) { + _this2.events[evt].splice(_this2.events[evt].indexOf(fn), 1); + } + }); + } + + /** + * Emit an event + * @param {String} evt Event name followed by any other argument passed to + * the invoked function + */ + + }, { + key: "emit", + value: function emit(evt /*, args...*/) { + if (evt in this.events) { + for (var i = 0; i < this.events[evt].length; i++) { + this.events[evt][i].apply(this, [].slice.call(arguments, 1)); + } + } + } + }]); + + return Emitter; + })(); + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Store = undefined; + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Store = exports.Store = (function () { + + /** + * Store, persistence manager + * @param {Object} tf TableFilter instance + * + * TODO: use localStorage and fallback to cookie persistence + */ + + function Store(tf) { + _classCallCheck(this, Store); + + var f = tf.config(); + + this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(Store, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on(['after-filtering'], function () { + return _this.saveFilterValues(_this.tf.fltsValuesCookie); + }); + } + + /** + * Store filters' values in cookie + * @param {String} cookie name + */ + + }, { + key: 'saveFilterValues', + value: function saveFilterValues(name) { + var tf = this.tf; + var fltValues = []; + //store filters' values + for (var i = 0; i < tf.fltIds.length; i++) { + var value = tf.getFilterValue(i); + if (value === '') { + value = ' '; + } + fltValues.push(value); + } + //adds array size + fltValues.push(tf.fltIds.length); + + //writes cookie + _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); + } + + /** + * Retrieve filters' values from cookie + * @param {String} cookie name + * @return {Array} + */ + + }, { + key: 'getFilterValues', + value: function getFilterValues(name) { + var flts = _cookie2.default.read(name); + var rgx = new RegExp(this.tf.separator, 'g'); + // filters' values array + return flts.split(rgx); + } + + /** + * Store page number in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageNb', + value: function savePageNb(name) { + _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); + } + + /** + * Retrieve page number from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageNb', + value: function getPageNb(name) { + return _cookie2.default.read(name); + } + + /** + * Store page length in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageLength', + value: function savePageLength(name) { + _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); + } + + /** + * Retrieve page length from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageLength', + value: function getPageLength(name) { + return _cookie2.default.read(name); + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off(['after-filtering'], function () { + return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); + }); + } + }]); + + return Store; + })(); + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.GridLayout = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var GridLayout = exports.GridLayout = (function (_Feature) { + _inherits(GridLayout, _Feature); + + /** + * Grid layout, table with fixed headers + * @param {Object} tf TableFilter instance + */ + + function GridLayout(tf) { + _classCallCheck(this, GridLayout); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); + + var f = _this.config; + + //defines grid width + _this.gridWidth = f.grid_width || null; + //defines grid height + _this.gridHeight = f.grid_height || null; + //defines css class for main container + _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; + //defines css class for div containing table + _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; + //defines css class for div containing headers' table + _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; + //defines css class for div containing rows counter, paging etc. + _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; + //defines which row contains column headers + _this.gridHeadRowIndex = f.grid_headers_row_index || 0; + //array of headers row indexes to be placed in header table + _this.gridHeadRows = f.grid_headers_rows || [0]; + //generate filters in table headers + _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; + //default col width + _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; + + _this.gridColElms = []; + + //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_'; + + _this.sourceTblHtml = tf.tbl.outerHTML; + return _this; + } + + /** + * Generates a grid with fixed headers + */ + + _createClass(GridLayout, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + var f = this.config; + var tbl = tf.tbl; + + if (this.initialized) { + return; + } + + // Override reference rows indexes + tf.refRow = _types2.default.isNull(tf.startRow) ? 0 : tf.startRow; + tf.headersRow = 0; + tf.filtersRowIndex = 1; + + tf.isExternalFlt = true; + + // default width of 100px if column widths not set + if (!tf.hasColWidths) { + tf.colWidths = []; + for (var k = 0; k < tf.nbCells; k++) { + var colW = undefined, + cell = tbl.rows[this.gridHeadRowIndex].cells[k]; + if (cell.width !== '') { + colW = cell.width; + } else if (cell.style.width !== '') { + colW = parseInt(cell.style.width, 10); + } else { + colW = this.gridDefaultColWidth; + } + tf.colWidths[k] = colW; + } + tf.hasColWidths = true; + } + tf.setColWidths(this.gridHeadRowIndex); + + var tblW = undefined; //initial table width + if (tbl.width !== '') { + tblW = tbl.width; + } else if (tbl.style.width !== '') { + tblW = parseInt(tbl.style.width, 10); + } else { + tblW = tbl.clientWidth; + } + + //Main container: it will contain all the elements + this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); + this.tblMainCont.className = this.gridMainContCssClass; + if (this.gridWidth) { + this.tblMainCont.style.width = this.gridWidth; + } + tbl.parentNode.insertBefore(this.tblMainCont, tbl); + + //Table container: div wrapping content table + this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); + this.tblCont.className = this.gridContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.tblCont.style.width = '100%'; + } else { + this.tblCont.style.width = this.gridWidth; + } + } + if (this.gridHeight) { + this.tblCont.style.height = this.gridHeight; + } + tbl.parentNode.insertBefore(this.tblCont, tbl); + var t = _dom2.default.remove(tbl); + this.tblCont.appendChild(t); + + //In case table width is expressed in % + if (tbl.style.width === '') { + tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; + } + + var d = _dom2.default.remove(this.tblCont); + this.tblMainCont.appendChild(d); + + //Headers table container: div wrapping headers table + this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); + this.headTblCont.className = this.gridHeadContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.headTblCont.style.width = '100%'; + } else { + this.headTblCont.style.width = this.gridWidth; + } + } + + //Headers table + this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); + var tH = _dom2.default.create('tHead'); + + //1st row should be headers row, ids are added if not set + //Those ids are used by the sort feature + var hRow = tbl.rows[this.gridHeadRowIndex]; + var sortTriggers = []; + for (var n = 0; n < tf.nbCells; n++) { + var c = hRow.cells[n]; + var thId = c.getAttribute('id'); + if (!thId || thId === '') { + thId = this.prfxGridTh + n + '_' + tf.id; + c.setAttribute('id', thId); + } + sortTriggers.push(thId); + } + + //Filters row is created + var filtersRow = _dom2.default.create('tr'); + if (this.gridEnableFilters && tf.fltGrid) { + tf.externalFltTgtIds = []; + for (var j = 0; j < tf.nbCells; j++) { + var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; + var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); + filtersRow.appendChild(cl); + tf.externalFltTgtIds[j] = fltTdId; + } + } + //Headers row are moved from content table to headers table + for (var i = 0; i < this.gridHeadRows.length; i++) { + var headRow = tbl.rows[this.gridHeadRows[0]]; + tH.appendChild(headRow); + } + this.headTbl.appendChild(tH); + if (tf.filtersRowIndex === 0) { + tH.insertBefore(filtersRow, hRow); + } else { + tH.appendChild(filtersRow); + } + + this.headTblCont.appendChild(this.headTbl); + this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); + + //THead needs to be removed in content table for sort feature + var thead = _dom2.default.tag(tbl, 'thead'); + if (thead.length > 0) { + tbl.removeChild(thead[0]); + } + + //Headers table style + this.headTbl.style.tableLayout = 'fixed'; + tbl.style.tableLayout = 'fixed'; + this.headTbl.cellPadding = tbl.cellPadding; + this.headTbl.cellSpacing = tbl.cellSpacing; + // this.headTbl.style.width = tbl.style.width; + + //content table without headers needs col widths to be reset + tf.setColWidths(0, this.headTbl); + + //Headers container width + // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; + + tbl.style.width = ''; + // + this.headTbl.style.width = tbl.clientWidth + 'px'; + // + + //scroll synchronisation + _event2.default.add(this.tblCont, 'scroll', function (evt) { + var elm = _event2.default.target(evt); + var scrollLeft = elm.scrollLeft; + _this2.headTblCont.scrollLeft = scrollLeft; + //New pointerX calc taking into account scrollLeft + // if(!o.isPointerXOverwritten){ + // try{ + // o.Evt.pointerX = function(evt){ + // let e = evt || global.event; + // let bdScrollLeft = tf_StandardBody().scrollLeft + + // scrollLeft; + // return (e.pageX + scrollLeft) || + // (e.clientX + bdScrollLeft); + // }; + // o.isPointerXOverwritten = true; + // } catch(err) { + // o.isPointerXOverwritten = false; + // } + // } + }); + + //Configure sort extension if any + var sort = (f.extensions || []).filter(function (itm) { + return itm.name === 'sort'; + }); + if (sort.length === 1) { + sort[0].async_sort = true; + sort[0].trigger_ids = sortTriggers; + } + + //Cols generation for all browsers excepted IE<=7 + this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; + + //Col elements are enough to keep column widths after sorting and + //filtering + var createColTags = function createColTags() { + for (var k = tf.nbCells - 1; k >= 0; k--) { + var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); + tbl.insertBefore(col, tbl.firstChild); + col.style.width = tf.colWidths[k]; + this.gridColElms[k] = col; + } + this.tblHasColTag = true; + }; + + if (!this.tblHasColTag) { + createColTags.call(this); + } else { + var cols = _dom2.default.tag(tbl, 'col'); + for (var ii = 0; ii < tf.nbCells; ii++) { + cols[ii].setAttribute('id', tf.id + '_col_' + ii); + cols[ii].style.width = tf.colWidths[ii]; + this.gridColElms.push(cols[ii]); + } + } + + var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; + f.on_after_col_resized = function (o, colIndex) { + if (!colIndex) { + return; + } + var w = o.crWColsRow.cells[colIndex].style.width; + var col = o.gridColElms[colIndex]; + col.style.width = w; + + var thCW = o.crWColsRow.cells[colIndex].clientWidth; + var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; + + if (thCW != tdCW) { + o.headTbl.style.width = tbl.clientWidth + 'px'; + } + + if (afterColResizedFn) { + afterColResizedFn.call(null, o, colIndex); + } + }; + + if (tf.popupFilters) { + filtersRow.style.display = 'none'; + } + + if (tbl.clientWidth !== this.headTbl.clientWidth) { + tbl.style.width = this.headTbl.clientWidth + 'px'; + } + + this.initialized = true; + } + + /** + * Removes the grid layout + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + var tbl = tf.tbl; + + if (!this.initialized) { + return; + } + var t = _dom2.default.remove(tbl); + this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); + _dom2.default.remove(this.tblMainCont); + + this.tblMainCont = null; + this.headTblCont = null; + this.headTbl = null; + this.tblCont = null; + + tbl.outerHTML = this.sourceTblHtml; + //needed to keep reference of table element for future usage + this.tf.tbl = t; + + this.initialized = false; + } + }]); + + return GridLayout; + })(_feature.Feature); + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var NOTIMPLEMENTED = 'Not implemented.'; + + var Feature = exports.Feature = (function () { + function Feature(tf, feature) { + _classCallCheck(this, Feature); + + this.tf = tf; + this.feature = feature; + this.enabled = tf[feature]; + this.config = tf.config(); + this.emitter = tf.emitter; + this.initialized = false; + } + + _createClass(Feature, [{ + key: 'init', + value: function init() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + } + }, { + key: 'destroy', + value: function destroy() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'enable', + value: function enable() { + this.enabled = true; + } + }, { + key: 'disable', + value: function disable() { + this.enabled = false; + } + }, { + key: 'isEnabled', + value: function isEnabled() { + return this.enabled; + } + }]); + + return Feature; + })(); + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Loader = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var Loader = exports.Loader = (function (_Feature) { + _inherits(Loader, _Feature); + + /** + * Loading message/spinner + * @param {Object} tf TableFilter instance + */ + + function Loader(tf) { + _classCallCheck(this, Loader); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); + + var f = _this.config; + + //id of container element + _this.loaderTgtId = f.loader_target_id || null; + //div containing loader + _this.loaderDiv = null; + //defines loader text + _this.loaderText = f.loader_text || 'Loading...'; + //defines loader innerHtml + _this.loaderHtml = f.loader_html || null; + //defines css class for loader div + _this.loaderCssClass = f.loader_css_class || 'loader'; + //delay for hiding loader + _this.loaderCloseDelay = 250; + //callback function before loader is displayed + _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; + //callback function after loader is closed + _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; + //loader div + _this.prfxLoader = 'load_'; + return _this; + } + + _createClass(Loader, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + var emitter = this.emitter; + + var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); + containerDiv.className = this.loaderCssClass; + + var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); + if (!this.loaderTgtId) { + targetEl.insertBefore(containerDiv, tf.tbl); + } else { + targetEl.appendChild(containerDiv); + } + this.loaderDiv = containerDiv; + if (!this.loaderHtml) { + this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); + } else { + this.loaderDiv.innerHTML = this.loaderHtml; + } + + this.show('none'); + + // Subscribe to events + emitter.on(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { + return _this2.show(''); + }); + emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this2.show('none'); + }); + + this.initialized = true; + } + }, { + key: 'show', + value: function show(p) { + var _this3 = this; + + if (!this.isEnabled() /*|| this.loaderDiv.style.display === p*/) { + return; + } + + var displayLoader = function displayLoader() { + if (!_this3.loaderDiv) { + return; + } + if (_this3.onShowLoader && p !== 'none') { + _this3.onShowLoader.call(null, _this3); + } + _this3.loaderDiv.style.display = p; + if (_this3.onHideLoader && p === 'none') { + _this3.onHideLoader.call(null, _this3); + } + }; + + var t = p === 'none' ? this.loaderCloseDelay : 1; + global.setTimeout(displayLoader, t); + } + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + if (!this.initialized) { + return; + } + + var emitter = this.emitter; + + _dom2.default.remove(this.loaderDiv); + this.loaderDiv = null; + + // Unsubscribe to events + emitter.off(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { + return _this4.show(''); + }); + emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this4.show('none'); + }); + + this.initialized = false; + } + }]); + + return Loader; + })(_feature.Feature); + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.HighlightKeyword = undefined; + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var HighlightKeyword = exports.HighlightKeyword = (function () { + + /** + * HighlightKeyword, highlight matched keyword + * @param {Object} tf TableFilter instance + */ + + function HighlightKeyword(tf) { + _classCallCheck(this, HighlightKeyword); + + var f = tf.config(); + //defines css class for highlighting + this.highlightCssClass = f.highlight_css_class || 'keyword'; + this.highlightedNodes = []; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(HighlightKeyword, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on(['before-filtering'], function () { + return _this.unhighlightAll(); + }); + } + + /** + * highlight occurences of searched term in passed node + * @param {Node} node + * @param {String} word Searched term + * @param {String} cssClass Css class name + */ + + }, { + key: 'highlight', + value: function highlight(node, word, cssClass) { + // Iterate into this nodes childNodes + if (node.hasChildNodes) { + var children = node.childNodes; + for (var i = 0; i < children.length; i++) { + this.highlight(children[i], word, cssClass); + } + } + + if (node.nodeType === 3) { + var tempNodeVal = _string2.default.lower(node.nodeValue); + var tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) != -1) { + var pn = node.parentNode; + if (pn && pn.className != cssClass) { + // word not highlighted yet + var nv = node.nodeValue, + ni = tempNodeVal.indexOf(tempWordVal), + + // Create a load of replacement nodes + before = _dom2.default.text(nv.substr(0, ni)), + docWordVal = nv.substr(ni, word.length), + after = _dom2.default.text(nv.substr(ni + word.length)), + hiwordtext = _dom2.default.text(docWordVal), + hiword = _dom2.default.create('span'); + hiword.className = cssClass; + hiword.appendChild(hiwordtext); + pn.insertBefore(before, node); + pn.insertBefore(hiword, node); + pn.insertBefore(after, node); + pn.removeChild(node); + this.highlightedNodes.push(hiword.firstChild); + } + } + } + } + + /** + * Removes highlight to nodes matching passed string + * @param {String} word + * @param {String} cssClass Css class to remove + */ + + }, { + key: 'unhighlight', + value: function unhighlight(word, cssClass) { + var arrRemove = []; + var highlightedNodes = this.highlightedNodes; + for (var i = 0; i < highlightedNodes.length; i++) { + var n = highlightedNodes[i]; + if (!n) { + continue; + } + var tempNodeVal = _string2.default.lower(n.nodeValue), + tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) !== -1) { + var pn = n.parentNode; + if (pn && pn.className === cssClass) { + var prevSib = pn.previousSibling, + nextSib = pn.nextSibling; + if (!prevSib || !nextSib) { + continue; + } + nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; + prevSib.nodeValue = ''; + n.nodeValue = ''; + arrRemove.push(i); + } + } + } + for (var k = 0; k < arrRemove.length; k++) { + highlightedNodes.splice(arrRemove[k], 1); + } + } + + /** + * Clear all occurrences of highlighted nodes + */ + + }, { + key: 'unhighlightAll', + value: function unhighlightAll() { + if (!this.tf.highlightKeywords || !this.tf.searchArgs) { + return; + } + for (var y = 0; y < this.tf.searchArgs.length; y++) { + this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); + } + this.highlightedNodes = []; + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off(['before-filtering'], function () { + return _this2.unhighlightAll(); + }); + } + }]); + + return HighlightKeyword; + })(); + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.PopupFilter = undefined; + + var _feature = __webpack_require__(12); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var PopupFilter = exports.PopupFilter = (function (_Feature) { + _inherits(PopupFilter, _Feature); + + /** + * Pop-up filter component + * @param {Object} tf TableFilter instance + */ + + function PopupFilter(tf) { + _classCallCheck(this, PopupFilter); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); + + var f = _this.config; + + // Enable external filters + tf.isExternalFlt = true; + tf.externalFltTgtIds = []; + + //filter icon path + _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; + //active filter icon path + _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; + _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; + //defines css class for popup div containing filter + _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; + //callback function before popup filtes is opened + _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; + //callback function after popup filtes is opened + _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; + //callback function before popup filtes is closed + _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; + //callback function after popup filtes is closed + _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; + + //stores filters spans + _this.popUpFltSpans = []; + //stores filters icons + _this.popUpFltImgs = []; + //stores filters containers + _this.popUpFltElms = _this.popUpFltElmCache || []; + _this.popUpFltAdjustToContainer = true; + + //id prefix for pop-up filter span + _this.prfxPopUpSpan = 'popUpSpan_'; + //id prefix for pop-up div containing filter + _this.prfxPopUpDiv = 'popUpDiv_'; + return _this; + } + + _createClass(PopupFilter, [{ + key: 'onClick', + value: function onClick(e) { + var evt = e || global.event, + elm = evt.target.parentNode, + colIndex = parseInt(elm.getAttribute('ci'), 10); + + this.closeAll(colIndex); + this.toggle(colIndex); + + if (this.popUpFltAdjustToContainer) { + var popUpDiv = this.popUpFltElms[colIndex], + header = this.tf.getHeaderElement(colIndex), + headerWidth = header.clientWidth * 0.95; + popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; + } + _event2.default.cancel(evt); + _event2.default.stop(evt); + } + + /** + * Initialize DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + // Override headers row index if no grouped headers + if (tf.headersRow <= 1) { + tf.headersRow = 0; + } + + for (var i = 0; i < tf.nbCells; i++) { + if (tf.getFilterType(i) === tf.fltTypeNone) { + continue; + } + var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); + popUpSpan.innerHTML = this.popUpImgFltHtml; + var header = tf.getHeaderElement(i); + header.appendChild(popUpSpan); + _event2.default.add(popUpSpan, 'click', function (evt) { + _this2.onClick(evt); + }); + this.popUpFltSpans[i] = popUpSpan; + this.popUpFltImgs[i] = popUpSpan.firstChild; + } + + // subscribe to events + this.emitter.on(['before-filtering'], function () { + return _this2.buildIcons(); + }); + this.emitter.on(['after-filtering'], function () { + return _this2.closeAll(); + }); + this.emitter.on(['cell-processed'], function (tf, cellIndex) { + return _this2.buildIcon(cellIndex, true); + }); + this.emitter.on(['filters-row-inserted'], function () { + return _this2.tf.headersRow++; + }); + this.emitter.on(['before-filter-init'], function (tf, colIndex) { + return _this2.build(colIndex); + }); + + this.initialized = true; + } + + /** + * Reset previously destroyed feature + */ + + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + this.buildAll(); + } + + /** + * Build all pop-up filters elements + */ + + }, { + key: 'buildAll', + value: function buildAll() { + for (var i = 0; i < this.popUpFltElmCache.length; i++) { + this.build(i, this.popUpFltElmCache[i]); + } + } + + /** + * Build a specified pop-up filter elements + * @param {Number} colIndex Column index + * @param {Object} div Optional container DOM element + */ + + }, { + key: 'build', + value: function build(colIndex, div) { + var tf = this.tf; + var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; + popUpDiv.className = this.popUpDivCssClass; + tf.externalFltTgtIds.push(popUpDiv.id); + var header = tf.getHeaderElement(colIndex); + header.insertBefore(popUpDiv, header.firstChild); + _event2.default.add(popUpDiv, 'click', function (evt) { + _event2.default.stop(evt); + }); + this.popUpFltElms[colIndex] = popUpDiv; + } + + /** + * Toogle visibility of specified filter + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggle', + value: function toggle(colIndex) { + var tf = this.tf, + popUpFltElm = this.popUpFltElms[colIndex]; + + if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { + if (this.onBeforePopUpOpen) { + this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'block'; + if (tf.getFilterType(colIndex) === tf.fltTypeInp) { + var flt = tf.getFilterElement(colIndex); + if (flt) { + flt.focus(); + } + } + if (this.onAfterPopUpOpen) { + this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } else { + if (this.onBeforePopUpClose) { + this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'none'; + if (this.onAfterPopUpClose) { + this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } + } + + /** + * Close all filters excepted for the specified one if any + * @param {Number} exceptIdx Column index of the filter to not close + */ + + }, { + key: 'closeAll', + value: function closeAll(exceptIdx) { + for (var i = 0; i < this.popUpFltElms.length; i++) { + if (i === exceptIdx) { + continue; + } + var popUpFltElm = this.popUpFltElms[i]; + if (popUpFltElm) { + popUpFltElm.style.display = 'none'; + } + } + } + + /** + * Build all the icons representing the pop-up filters + */ + + }, { + key: 'buildIcons', + value: function buildIcons() { + for (var i = 0; i < this.popUpFltImgs.length; i++) { + this.buildIcon(i, false); + } + } + + /** + * Apply specified icon state + * @param {Number} colIndex Column index + * @param {Boolean} active Apply active state + */ + + }, { + key: 'buildIcon', + value: function buildIcon(colIndex, active) { + if (this.popUpFltImgs[colIndex]) { + this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; + } + } + + /** + * Remove pop-up filters + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + this.popUpFltElmCache = []; + for (var i = 0; i < this.popUpFltElms.length; i++) { + var popUpFltElm = this.popUpFltElms[i], + popUpFltSpan = this.popUpFltSpans[i], + popUpFltImg = this.popUpFltImgs[i]; + if (popUpFltElm) { + _dom2.default.remove(popUpFltElm); + this.popUpFltElmCache[i] = popUpFltElm; + } + popUpFltElm = null; + if (popUpFltSpan) { + _dom2.default.remove(popUpFltSpan); + } + popUpFltSpan = null; + if (popUpFltImg) { + _dom2.default.remove(popUpFltImg); + } + popUpFltImg = null; + } + this.popUpFltElms = []; + this.popUpFltSpans = []; + this.popUpFltImgs = []; + + // unsubscribe to events + this.emitter.off(['before-filtering'], function () { + return _this3.buildIcons(); + }); + this.emitter.off(['after-filtering'], function () { + return _this3.closeAll(); + }); + this.emitter.off(['cell-processed'], function (tf, cellIndex) { + return _this3.buildIcon(cellIndex, true); + }); + this.emitter.off(['filters-row-inserted'], function () { + return _this3.tf.headersRow++; + }); + this.emitter.off(['before-filter-init'], function (tf, colIndex) { + return _this3.build(colIndex); + }); + + this.initialized = false; + } + }]); + + return PopupFilter; + })(_feature.Feature); + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Dropdown = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Dropdown = exports.Dropdown = (function (_Feature) { + _inherits(Dropdown, _Feature); + + /** + * Dropdown UI component + * @param {Object} tf TableFilter instance + */ + + function Dropdown(tf) { + _classCallCheck(this, Dropdown); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Dropdown).call(this, tf, 'dropdown')); + + var f = tf.config(); + + _this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; + //defines empty option text + _this.nonEmptyText = f.non_empty_text || '(Non empty)'; + //sets select filling method: 'innerHTML' or 'createElement' + _this.slcFillingMethod = f.slc_filling_method || 'createElement'; + //IE only, tooltip text appearing on select before it is populated + _this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; + //tooltip text appearing on multiple select + _this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; + + _this.isCustom = null; + _this.opts = null; + _this.optsTxt = null; + _this.slcInnerHtml = null; + return _this; + } + + /** + * Initialize drop-down filter + * @param {Number} colIndex Column index + * @param {Boolean} isExternal External filter flag + * @param {DOMElement} container Dom element containing the filter + */ + + _createClass(Dropdown, [{ + key: 'init', + value: function init(colIndex, isExternal, container) { + var tf = this.tf; + var col = tf.getFilterType(colIndex); + var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; + + var slc = _dom2.default.create(tf.fltTypeSlc, ['id', tf.prfxFlt + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); + + if (col === tf.fltTypeMulti) { + slc.multiple = tf.fltTypeMulti; + slc.title = this.multipleSlcTooltip; + } + slc.className = _string2.default.lower(col) === tf.fltTypeSlc ? tf.fltCssClass : tf.fltMultiCssClass; + + //filter is appended in container element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(slc); + tf.externalFltEls.push(slc); + } else { + container.appendChild(slc); + } + + tf.fltIds.push( /*this.prfxFlt+i+'_'+this.id*/slc.id); + + if (!tf.loadFltOnDemand) { + this.build(colIndex); + } else { + //1st option is created here since build isn't invoked + var opt0 = _dom2.default.createOpt(tf.displayAllText, ''); + slc.appendChild(opt0); + } + + _event2.default.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); + _event2.default.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); + _event2.default.add(slc, 'focus', tf.Evt.onSlcFocus.bind(tf)); + + this.initialized = true; + } + + /** + * Build drop-down filter UI + * @param {Number} colIndex Column index + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Boolean} isExternal Render in external container + * @param {String} extSlcId External container id + */ + + }, { + key: 'build', + value: function build(colIndex) { + var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.emitter.emit('before-populating-filter', tf, colIndex); + + this.opts = []; + this.optsTxt = []; + this.slcInnerHtml = ''; + + var slcId = tf.fltIds[colIndex]; + if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { + return; + } + var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), + rows = tf.tbl.rows, + matchCase = tf.matchCase; + + //custom select test + this.isCustom = tf.isCustomOptions(colIndex); + + //custom selects text + var activeFlt = undefined; + if (isLinked && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + /*** remember grid values ***/ + var fltsValues = [], + fltArr = []; + if (tf.rememberGridValues) { + fltsValues = tf.feature('store').getFilterValues(tf.fltsValuesCookie); + if (fltsValues && !_string2.default.isEmpty(fltsValues.toString())) { + if (this.isCustom) { + fltArr.push(fltsValues[colIndex]); + } else { + fltArr = fltsValues[colIndex].split(' ' + tf.orOperator + ' '); + } + } + } + + var excludedOpts = null, + filteredDataCol = null; + if (isLinked && tf.disableExcludedOptions) { + excludedOpts = []; + filteredDataCol = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cell = rows[k].cells, + nchilds = cell.length; + + // checks if row has exact cell # + if (nchilds !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < nchilds; j++) { + // WTF: cyclomatic complexity hell + if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cell[j]), + + //Vary Peter's patch + cell_string = _string2.default.matchCase(cell_data, matchCase); + + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, matchCase)) { + this.opts.push(cell_data); + } + + if (isLinked && tf.disableExcludedOptions) { + var filteredCol = filteredDataCol[j]; + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { + excludedOpts.push(cell_data); + } + } + } //if colIndex==j + } //for j + } //for k + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (excludedOpts) { + excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + } + } + + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (excludedOpts) { + excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (excludedOpts) { + excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + //populates drop-down + this.addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr); + + this.emitter.emit('after-populating-filter', tf, colIndex); + } + + /** + * Add drop-down options + * @param {Number} colIndex Column index + * @param {Object} slc Select Dom element + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Array} excludedOpts Array of excluded options + * @param {Array} fltsValues Collection of persisted filter values + * @param {Array} fltArr Collection of persisted filter values + */ + + }, { + key: 'addOptions', + value: function addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod), + slcValue = slc.value; + + slc.innerHTML = ''; + slc = this.addFirstOption(slc); + + for (var y = 0; y < this.opts.length; y++) { + if (this.opts[y] === '') { + continue; + } + var val = this.opts[y]; //option value + var lbl = this.isCustom ? this.optsTxt[y] : val; //option text + var isDisabled = false; + if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + isDisabled = true; + } + + if (fillMethod === 'innerhtml') { + var slcAttr = ''; + if (tf.loadFltOnDemand && slcValue === this.opts[y]) { + slcAttr = 'selected="selected"'; + } + this.slcInnerHtml += ''; + } else { + var opt = undefined; + //fill select on demand + if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { + opt = _dom2.default.createOpt(lbl, val, true); + } else { + if (tf.getFilterType(colIndex) !== tf.fltTypeMulti) { + opt = _dom2.default.createOpt(lbl, val, fltsValues[colIndex] !== ' ' && val === fltsValues[colIndex] ? true : false); + } else { + opt = _dom2.default.createOpt(lbl, val, _array2.default.has(fltArr, _string2.default.matchCase(this.opts[y], tf.matchCase), tf.matchCase) || fltArr.toString().indexOf(val) !== -1 ? true : false); + } + } + if (isDisabled) { + opt.disabled = true; + } + slc.appendChild(opt); + } + } // for y + + if (fillMethod === 'innerhtml') { + slc.innerHTML += this.slcInnerHtml; + } + slc.setAttribute('filled', '1'); + } + + /** + * Add drop-down header option + * @param {Object} slc Select DOM element + */ + + }, { + key: 'addFirstOption', + value: function addFirstOption(slc) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod); + + if (fillMethod === 'innerhtml') { + this.slcInnerHtml += ''; + } else { + var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); + if (!this.enableSlcResetFilter) { + opt0.style.display = 'none'; + } + slc.appendChild(opt0); + if (tf.enableEmptyOption) { + var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); + slc.appendChild(opt1); + } + if (tf.enableNonEmptyOption) { + var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); + slc.appendChild(opt2); + } + } + return slc; + } + }, { + key: 'destroy', + value: function destroy() {} + }]); + + return Dropdown; + })(_feature.Feature); + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + ignoreCase: function ignoreCase(a, b) { + var x = _string2.default.lower(a); + var y = _string2.default.lower(b); + return x < y ? -1 : x > y ? 1 : 0; + } + }; + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.CheckList = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var CheckList = exports.CheckList = (function (_Feature) { + _inherits(CheckList, _Feature); + + /** + * Checklist UI component + * @param {Object} tf TableFilter instance + */ + + function CheckList(tf) { + _classCallCheck(this, CheckList); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CheckList).call(this, tf, 'checkList')); + + var f = tf.config(); + + _this.checkListDiv = []; //checklist container div + //defines css class for div containing checklist filter + _this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; + //defines css class for checklist filters + _this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; + //defines css class for checklist item (li) + _this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; + //defines css class for selected checklist item (li) + _this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; + //Load on demand text + _this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; + //defines css class for checklist filters + _this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; + _this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; + //checklist filter container div + _this.prfxCheckListDiv = 'chkdiv_'; + + _this.isCustom = null; + _this.opts = null; + _this.optsTxt = null; + _this.excludedOpts = null; + return _this; + } + + // TODO: move event here + + _createClass(CheckList, [{ + key: 'onChange', + value: function onChange(evt) { + var elm = evt.target; + this.tf.activeFilterId = elm.getAttribute('id'); + this.tf.activeFlt = _dom2.default.id(this.tf.activeFilterId); + this.tf.Evt.onSlcChange.call(this.tf, evt); + } + }, { + key: 'optionClick', + value: function optionClick(evt) { + this.setCheckListValues(evt.target); + this.onChange(evt); + } + }, { + key: 'onCheckListClick', + value: function onCheckListClick(evt) { + var _this2 = this; + + var elm = _event2.default.target(evt); + if (this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + var div = this.checkListDiv[ct]; + this.build(ct); + _event2.default.remove(div, 'click', function (evt) { + return _this2.onCheckListClick(evt); + }); + } + } + + /** + * Initialize checklist filter + * @param {Number} colIndex Column index + * @param {Boolean} isExternal External filter flag + * @param {DOMElement} container Dom element containing the filter + */ + + }, { + key: 'init', + value: function init(colIndex, isExternal, container) { + var _this3 = this; + + var tf = this.tf; + var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; + + var divCont = _dom2.default.create('div', ['id', this.prfxCheckListDiv + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); + divCont.className = this.checkListDivCssClass; + + //filter is appended in desired element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(divCont); + tf.externalFltEls.push(divCont); + } else { + container.appendChild(divCont); + } + + this.checkListDiv[colIndex] = divCont; + tf.fltIds.push(tf.prfxFlt + colIndex + '_' + tf.id); + + if (!tf.loadFltOnDemand) { + this.build(colIndex); + } else { + _event2.default.add(divCont, 'click', function (evt) { + return _this3.onCheckListClick(evt); + }); + divCont.appendChild(_dom2.default.text(this.activateCheckListTxt)); + } + + this.initialized = true; + } + + /** + * Build checklist UI + * @param {Number} colIndex Column index + * @param {Boolean} isExternal Render in external container + * @param {String} extFltId External container id + */ + + }, { + key: 'build', + value: function build(colIndex) { + var _this4 = this; + + var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.emitter.emit('before-populating-filter', tf, colIndex); + + this.opts = []; + this.optsTxt = []; + + var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; + if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { + return; + } + + var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); + var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); + ul.className = this.checkListCssClass; + _event2.default.add(ul, 'change', function (evt) { + _this4.onChange(evt); + }); + + var rows = tf.tbl.rows; + this.isCustom = tf.isCustomOptions(colIndex); + + var activeFlt = undefined; + if (tf.linkedFilters && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + var filteredDataCol = []; + if (tf.linkedFilters && tf.disableExcludedOptions) { + this.excludedOpts = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cells = rows[k].cells; + var ncells = cells.length; + + // checks if row has exact cell # + if (ncells !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < ncells; j++) { + // WTF: cyclomatic complexity hell :) + if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cells[j]); + //Vary Peter's patch + var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { + this.opts.push(cell_data); + } + var filteredCol = filteredDataCol[j]; + if (tf.linkedFilters && tf.disableExcludedOptions) { + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { + this.excludedOpts.push(cell_data); + } + } + } + } + } + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!tf.matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (this.excludedOpts) { + this.excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + } + } + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + this.addChecks(colIndex, ul, tf.separator); + + if (tf.loadFltOnDemand) { + flt.innerHTML = ''; + } + flt.appendChild(ul); + flt.setAttribute('filled', '1'); + + this.emitter.emit('after-populating-filter', tf, colIndex); + } + + /** + * Add checklist options + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addChecks', + value: function addChecks(colIndex, ul) { + var _this5 = this; + + var tf = this.tf; + var chkCt = this.addTChecks(colIndex, ul); + var fltArr = []; //remember grid values + var store = tf.feature('store'); + var tmpVal = store ? store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null; + if (tmpVal && _string2.default.trim(tmpVal).length > 0) { + if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1) { + fltArr.push(tmpVal); + } else { + fltArr = tmpVal.split(' ' + tf.orOperator + ' '); + } + } + + for (var y = 0; y < this.opts.length; y++) { + var val = this.opts[y]; //item value + var lbl = this.isCustom ? this.optsTxt[y] : val; //item text + var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); + li.className = this.checkListItemCssClass; + if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + _dom2.default.addClass(li, this.checkListItemDisabledCssClass); + li.check.disabled = true; + li.disabled = true; + } else { + _event2.default.add(li.check, 'click', function (evt) { + _this5.optionClick(evt); + }); + } + ul.appendChild(li); + + if (val === '') { + //item is hidden + li.style.display = 'none'; + } + + /*** remember grid values ***/ + if (tf.rememberGridValues) { + if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1 && fltArr.toString().indexOf(val) != -1 || _array2.default.has(fltArr, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + li.check.checked = true; + this.setCheckListValues(li.check); + } + } + } + } + + /** + * Add checklist header option + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addTChecks', + value: function addTChecks(colIndex, ul) { + var _this6 = this; + + var tf = this.tf; + var chkCt = 1; + var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); + li0.className = this.checkListItemCssClass; + ul.appendChild(li0); + + _event2.default.add(li0.check, 'click', function (evt) { + _this6.optionClick(evt); + }); + + if (!this.enableCheckListResetFilter) { + li0.style.display = 'none'; + } + + if (tf.enableEmptyOption) { + var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); + li1.className = this.checkListItemCssClass; + ul.appendChild(li1); + _event2.default.add(li1.check, 'click', function (evt) { + _this6.optionClick(evt); + }); + chkCt++; + } + + if (tf.enableNonEmptyOption) { + var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); + li2.className = this.checkListItemCssClass; + ul.appendChild(li2); + _event2.default.add(li2.check, 'click', function (evt) { + _this6.optionClick(evt); + }); + chkCt++; + } + return chkCt; + } + + /** + * Store checked options in DOM element attribute + * @param {Object} o checklist option DOM element + */ + + }, { + key: 'setCheckListValues', + value: function setCheckListValues(o) { + if (!o) { + return; + } + var tf = this.tf; + var chkValue = o.value; //checked item value + var chkIndex = parseInt(o.id.split('_')[2], 10); + var filterTag = 'ul', + itemTag = 'li'; + var n = o; + + //ul tag search + while (_string2.default.lower(n.nodeName) !== filterTag) { + n = n.parentNode; + } + + var li = n.childNodes[chkIndex]; + var colIndex = n.getAttribute('colIndex'); + var fltValue = n.getAttribute('value'); //filter value (ul tag) + var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) + + if (o.checked) { + //show all item + if (chkValue === '') { + if (fltIndexes && fltIndexes !== '') { + //items indexes + var indSplit = fltIndexes.split(tf.separator); + //checked items loop + for (var u = 0; u < indSplit.length; u++) { + //checked item + var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); + if (cChk) { + cChk.checked = false; + _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); + } + } + } + n.setAttribute('value', ''); + n.setAttribute('indexes', ''); + } else { + fltValue = fltValue ? fltValue : ''; + chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); + chkIndex = fltIndexes + chkIndex + tf.separator; + n.setAttribute('value', chkValue); + n.setAttribute('indexes', chkIndex); + //1st option unchecked + if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { + _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; + } + } + + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); + _dom2.default.addClass(li, this.checkListSlcItemCssClass); + } + } else { + //removes values and indexes + if (chkValue !== '') { + var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); + fltValue = fltValue.replace(replaceValue, ''); + n.setAttribute('value', _string2.default.trim(fltValue)); + + var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); + fltIndexes = fltIndexes.replace(replaceIndex, ''); + n.setAttribute('indexes', fltIndexes); + } + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(li, this.checkListSlcItemCssClass); + } + } + } + }, { + key: 'destroy', + value: function destroy() {} + }]); + + return CheckList; + })(_feature.Feature); + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.RowsCounter = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var RowsCounter = exports.RowsCounter = (function (_Feature) { + _inherits(RowsCounter, _Feature); + + /** + * Rows counter + * @param {Object} tf TableFilter instance + */ + + function RowsCounter(tf) { + _classCallCheck(this, RowsCounter); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); + + var f = _this.config; + + //id of custom container element + _this.rowsCounterTgtId = f.rows_counter_target_id || null; + //element containing tot nb rows + _this.rowsCounterDiv = null; + //element containing tot nb rows label + _this.rowsCounterSpan = null; + //defines rows counter text + _this.rowsCounterText = f.rows_counter_text || 'Rows: '; + _this.fromToTextSeparator = f.from_to_text_separator || '-'; + _this.overText = f.over_text || ' / '; + //defines css class rows counter + _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; + //rows counter div + _this.prfxCounter = 'counter_'; + //nb displayed rows label + _this.prfxTotRows = 'totrows_span_'; + //label preceding nb rows label + _this.prfxTotRowsTxt = 'totRowsTextSpan_'; + //callback raised before counter is refreshed + _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; + //callback raised after counter is refreshed + _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; + return _this; + } + + _createClass(RowsCounter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + //rows counter container + var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); + countDiv.className = this.totRowsCssClass; + //rows counter label + var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); + var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); + countText.appendChild(_dom2.default.text(this.rowsCounterText)); + + // counter is added to defined element + if (!this.rowsCounterTgtId) { + tf.setToolbar(); + } + var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); + + //default container: 'lDiv' + if (!this.rowsCounterTgtId) { + countDiv.appendChild(countText); + countDiv.appendChild(countSpan); + targetEl.appendChild(countDiv); + } else { + //custom container, no need to append statusDiv + targetEl.appendChild(countText); + targetEl.appendChild(countSpan); + } + this.rowsCounterDiv = countDiv; + this.rowsCounterSpan = countSpan; + + // subscribe to events + this.emitter.on(['after-filtering', 'grouped-by-page'], function () { + return _this2.refresh(tf.nbVisibleRows); + }); + this.emitter.on(['rows-changed'], function () { + return _this2.refresh(); + }); + + this.initialized = true; + this.refresh(); + } + }, { + key: 'refresh', + value: function refresh(p) { + if (!this.initialized || !this.isEnabled()) { + return; + } + + var tf = this.tf; + + if (this.onBeforeRefreshCounter) { + this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); + } + + var totTxt; + if (!tf.paging) { + if (p && p !== '') { + totTxt = p; + } else { + totTxt = tf.nbFilterableRows - tf.nbHiddenRows; + } + } else { + var paging = tf.feature('paging'); + if (paging) { + //paging start row + var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); + var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; + totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; + } + } + + this.rowsCounterSpan.innerHTML = totTxt; + if (this.onAfterRefreshCounter) { + this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + if (!this.rowsCounterTgtId && this.rowsCounterDiv) { + _dom2.default.remove(this.rowsCounterDiv); + } else { + _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; + } + this.rowsCounterSpan = null; + this.rowsCounterDiv = null; + + // unsubscribe to events + this.emitter.off(['after-filtering', 'grouped-by-page'], function () { + return _this3.refresh(tf.nbVisibleRows); + }); + this.emitter.off(['rows-changed'], function () { + return _this3.refresh(); + }); + + this.initialized = false; + } + }]); + + return RowsCounter; + })(_feature.Feature); + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.StatusBar = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var StatusBar = exports.StatusBar = (function (_Feature) { + _inherits(StatusBar, _Feature); + + /** + * Status bar UI component + * @param {Object} tf TableFilter instance + */ + + function StatusBar(tf) { + _classCallCheck(this, StatusBar); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); + + var f = _this.config; + + //id of custom container element + _this.statusBarTgtId = f.status_bar_target_id || null; + //element containing status bar label + _this.statusBarDiv = null; + //status bar + _this.statusBarSpan = null; + //status bar label + _this.statusBarSpanText = null; + //defines status bar text + _this.statusBarText = f.status_bar_text || ''; + //defines css class status bar + _this.statusBarCssClass = f.status_bar_css_class || 'status'; + //delay for status bar clearing + _this.statusBarCloseDelay = 250; + + //calls function before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //calls function after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + + //status messages + _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 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)...'; + + // status bar div + _this.prfxStatus = 'status_'; + // status bar label + _this.prfxStatusSpan = 'statusSpan_'; + // text preceding status bar label + _this.prfxStatusTxt = 'statusText_'; + return _this; + } + + _createClass(StatusBar, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + var emitter = this.emitter; + + //status bar container + var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); + statusDiv.className = this.statusBarCssClass; + + //status bar label + var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); + //preceding text + var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); + statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); + + // target element container + if (!this.statusBarTgtId) { + tf.setToolbar(); + } + var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); + + //default container: 'lDiv' + if (!this.statusBarTgtId) { + statusDiv.appendChild(statusSpanText); + statusDiv.appendChild(statusSpan); + targetEl.appendChild(statusDiv); + } else { + // custom container, no need to append statusDiv + targetEl.appendChild(statusSpanText); + targetEl.appendChild(statusSpan); + } + + this.statusBarDiv = statusDiv; + this.statusBarSpan = statusSpan; + this.statusBarSpanText = statusSpanText; + + // Subscribe to events + emitter.on(['before-filtering'], function () { + return _this2.message(_this2.msgFilter); + }); + emitter.on(['before-populating-filter'], function () { + return _this2.message(_this2.msgPopulate); + }); + emitter.on(['before-changing-page'], function () { + return _this2.message(_this2.msgChangePage); + }); + emitter.on(['before-clearing-filters'], function () { + return _this2.message(_this2.msgClear); + }); + emitter.on(['before-changing-results-per-page'], function () { + return _this2.message(_this2.msgChangeResults); + }); + emitter.on(['before-reset-page'], function () { + return _this2.message(_this2.msgResetPage); + }); + emitter.on(['before-reset-page-length'], function () { + return _this2.message(_this2.msgResetPageLength); + }); + emitter.on(['before-loading-extensions'], function () { + return _this2.message(_this2.msgLoadExtensions); + }); + emitter.on(['before-loading-themes'], function () { + return _this2.message(_this2.msgLoadThemes); + }); + + emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this2.message(''); + }); + + this.initialized = true; + } + }, { + key: 'message', + value: function message() { + var _this3 = this; + + var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; + + if (!this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, t); + } + + var d = t === '' ? this.statusBarCloseDelay : 1; + global.setTimeout(function () { + if (!_this3.initialized) { + return; + } + _this3.statusBarSpan.innerHTML = t; + if (_this3.onAfterShowMsg) { + _this3.onAfterShowMsg.call(null, _this3.tf, t); + } + }, d); + } + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + if (!this.initialized) { + return; + } + + var emitter = this.emitter; + + this.statusBarDiv.innerHTML = ''; + _dom2.default.remove(this.statusBarDiv); + this.statusBarSpan = null; + this.statusBarSpanText = null; + this.statusBarDiv = null; + + // Unsubscribe to events + emitter.off(['before-filtering'], function () { + return _this4.message(_this4.msgFilter); + }); + emitter.off(['before-populating-filter'], function () { + return _this4.message(_this4.msgPopulate); + }); + emitter.off(['before-changing-page'], function () { + return _this4.message(_this4.msgChangePage); + }); + emitter.off(['before-clearing-filters'], function () { + return _this4.message(_this4.msgClear); + }); + emitter.off(['before-changing-results-per-page'], function () { + return _this4.message(_this4.msgChangeResults); + }); + emitter.off(['before-reset-page'], function () { + return _this4.message(_this4.msgResetPage); + }); + emitter.off(['before-reset-page-length'], function () { + return _this4.message(_this4.msgResetPageLength); + }); + emitter.off(['before-loading-extensions'], function () { + return _this4.message(_this4.msgLoadExtensions); + }); + emitter.off(['before-loading-themes'], function () { + return _this4.message(_this4.msgLoadThemes); + }); + + emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this4.message(''); + }); + + this.initialized = false; + } + }]); + + return StatusBar; + })(_feature.Feature); + +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Paging = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Paging = exports.Paging = (function (_Feature) { + _inherits(Paging, _Feature); + + /** + * Pagination component + * @param {Object} tf TableFilter instance + */ + + function Paging(tf) { + _classCallCheck(this, Paging); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); + + var f = _this.config; + + //css class for paging buttons (previous,next,etc.) + _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; + //stores paging select element + _this.pagingSlc = null; + //results per page select element + _this.resultsPerPageSlc = null; + //id of container element + _this.pagingTgtId = f.paging_target_id || null; + //defines table paging length + _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; + //id of container element + _this.resultsPerPageTgtId = f.results_per_page_target_id || null; + //css class for paging select element + _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; + //css class for paging input element + _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; + //stores results per page text and values + _this.resultsPerPage = f.results_per_page || null; + //enables/disables results per page drop-down + _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); + //defines css class for results per page select + _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; + //css class for label preceding results per page select + _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; + //1st row index of current page + _this.startPagingRow = 0; + //total nb of pages + _this.nbPages = 0; + //current page nb + _this.currentPageNb = 1; + //defines next page button text + _this.btnNextPageText = f.btn_next_page_text || '>'; + //defines previous page button text + _this.btnPrevPageText = f.btn_prev_page_text || '<'; + //defines last page button text + _this.btnLastPageText = f.btn_last_page_text || '>|'; + //defines first page button text + _this.btnFirstPageText = f.btn_first_page_text || '|<'; + //defines next page button html + _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); + //defines last page button html + _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); + //defines text preceeding page selector drop-down + _this.pageText = f.page_text || ' Page '; + //defines text after page selector drop-down + _this.ofText = f.of_text || ' of '; + //css class for span containing tot nb of pages + _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; + //enables/disables paging buttons + _this.hasPagingBtns = f.paging_btns === false ? false : true; + //defines previous page button html + _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; + //calls function before page is changed + _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; + //calls function before page is changed + _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; + + //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_'; + + var start_row = tf.refRow; + var nrows = tf.nbRows; + //calculates page nb + _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); + + //Paging elements events + var o = _this; + // Paging DOM events + _this.evt = { + slcIndex: function slcIndex() { + return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; + }, + nbOpts: function nbOpts() { + return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; + }, + next: function next() { + var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; + o.changePage(nextIndex); + }, + prev: function prev() { + var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); + o.changePage(prevIndex); + }, + last: function last() { + o.changePage(o.evt.nbOpts()); + }, + first: function first() { + o.changePage(0); + }, + _detectKey: function _detectKey(e) { + var key = _event2.default.keyCode(e); + if (key === 13) { + if (tf.sorted) { + tf.filter(); + o.changePage(o.evt.slcIndex()); + } else { + o.changePage(); + } + this.blur(); + } + }, + + slcPagesChange: null, + nextEvt: null, + prevEvt: null, + lastEvt: null, + firstEvt: null + }; + return _this; + } + + /** + * Initialize DOM elements + */ + + _createClass(Paging, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var slcPages; + var tf = this.tf; + var evt = this.evt; + + if (this.initialized) { + return; + } + + // Check resultsPerPage is in expected format and initialise the + // results per page component + if (this.hasResultsPerPage) { + if (this.resultsPerPage.length < 2) { + this.hasResultsPerPage = false; + } else { + this.pagingLength = this.resultsPerPage[1][0]; + this.setResultsPerPage(); + } + } + + evt.slcPagesChange = function (event) { + var slc = event.target; + _this2.changePage(slc.selectedIndex); + }; + + // Paging drop-down list selector + if (this.pageSelectorType === tf.fltTypeSlc) { + slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); + slcPages.className = this.pgSlcCssClass; + _event2.default.add(slcPages, 'change', evt.slcPagesChange); + } + + // Paging input selector + if (this.pageSelectorType === tf.fltTypeInp) { + slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); + slcPages.className = this.pgInpCssClass; + _event2.default.add(slcPages, 'keypress', evt._detectKey); + } + + // btns containers + var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); + var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); + var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); + var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); + + if (this.hasPagingBtns) { + // Next button + if (!this.btnNextPageHtml) { + var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); + btn_next.className = this.btnPageCssClass; + _event2.default.add(btn_next, 'click', evt.next); + btnNextSpan.appendChild(btn_next); + } else { + btnNextSpan.innerHTML = this.btnNextPageHtml; + _event2.default.add(btnNextSpan, 'click', evt.next); + } + // Previous button + if (!this.btnPrevPageHtml) { + var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); + btn_prev.className = this.btnPageCssClass; + _event2.default.add(btn_prev, 'click', evt.prev); + btnPrevSpan.appendChild(btn_prev); + } else { + btnPrevSpan.innerHTML = this.btnPrevPageHtml; + _event2.default.add(btnPrevSpan, 'click', evt.prev); + } + // Last button + if (!this.btnLastPageHtml) { + var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); + btn_last.className = this.btnPageCssClass; + _event2.default.add(btn_last, 'click', evt.last); + btnLastSpan.appendChild(btn_last); + } else { + btnLastSpan.innerHTML = this.btnLastPageHtml; + _event2.default.add(btnLastSpan, 'click', evt.last); + } + // First button + if (!this.btnFirstPageHtml) { + var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); + btn_first.className = this.btnPageCssClass; + _event2.default.add(btn_first, 'click', evt.first); + btnFirstSpan.appendChild(btn_first); + } else { + btnFirstSpan.innerHTML = this.btnFirstPageHtml; + _event2.default.add(btnFirstSpan, 'click', evt.first); + } + } + + // paging elements (buttons+drop-down list) are added to defined element + if (!this.pagingTgtId) { + tf.setToolbar(); + } + var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + targetEl.appendChild(btnFirstSpan); + targetEl.appendChild(btnPrevSpan); + + var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); + pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); + pgBeforeSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgBeforeSpan); + targetEl.appendChild(slcPages); + var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); + pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); + pgAfterSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgAfterSpan); + var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); + pgspan.className = this.nbPgSpanCssClass; + pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); + targetEl.appendChild(pgspan); + targetEl.appendChild(btnNextSpan); + targetEl.appendChild(btnLastSpan); + this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); + + if (!tf.rememberGridValues) { + this.setPagingInfo(); + } + if (!tf.fltGrid) { + tf.validateAllRows(); + this.setPagingInfo(tf.validRowsIndex); + } + + this.emitter.on(['after-filtering'], function () { + return _this2.resetPagingInfo(); + }); + this.emitter.on(['initialized'], function () { + return _this2.resetValues(); + }); + + this.initialized = true; + } + + /** + * Reset paging when filters are already instantiated + * @param {Boolean} filterTable Execute filtering once paging instanciated + */ + + }, { + key: 'reset', + value: function reset() { + var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var tf = this.tf; + if (!tf.hasGrid() || this.isEnabled()) { + return; + } + this.enable(); + this.init(); + tf.resetValues(); + if (filterTable) { + tf.filter(); + } + } + + /** + * Reset paging info from scratch after a filtering process + */ + + }, { + key: 'resetPagingInfo', + value: function resetPagingInfo() { + this.startPagingRow = 0; + this.currentPageNb = 1; + this.setPagingInfo(this.tf.validRowsIndex); + } + + /** + * Calculate number of pages based on valid rows + * Refresh paging select according to number of pages + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'setPagingInfo', + value: function setPagingInfo(validRows) { + var tf = this.tf; + var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + //store valid rows indexes + tf.validRowsIndex = validRows || tf.getValidRows(true); + + //calculate nb of pages + this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); + //refresh page nb span + pgspan.innerHTML = this.nbPages; + //select clearing shortcut + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.innerHTML = ''; + } + + if (this.nbPages > 0) { + mdiv.style.visibility = 'visible'; + if (this.pageSelectorType === tf.fltTypeSlc) { + for (var z = 0; z < this.nbPages; z++) { + var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); + this.pagingSlc.options[z] = opt; + } + } else { + //input type + this.pagingSlc.value = this.currentPageNb; + } + } else { + /*** if no results paging select and buttons are hidden ***/ + mdiv.style.visibility = 'hidden'; + } + this.groupByPage(tf.validRowsIndex); + } + + /** + * Group table rows by page and display valid rows + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'groupByPage', + value: function groupByPage(validRows) { + var tf = this.tf; + var rows = tf.tbl.rows; + var startPagingRow = parseInt(this.startPagingRow, 10); + var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); + + //store valid rows indexes + if (validRows) { + tf.validRowsIndex = validRows; + } + + //this loop shows valid rows of current page + for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { + var validRowIdx = tf.validRowsIndex[h]; + var r = rows[validRowIdx]; + var isRowValid = r.getAttribute('validRow'); + var rowDisplayed = false; + + if (h >= startPagingRow && h < endPagingRow) { + if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { + r.style.display = ''; + rowDisplayed = true; + } + } else { + r.style.display = 'none'; + } + this.emitter.emit('row-paged', tf, validRowIdx, h, rowDisplayed); + } + + tf.nbVisibleRows = tf.validRowsIndex.length; + + // broadcast grouping by page + this.emitter.emit('grouped-by-page', tf, this); + } + + /** + * Return the current page number + * @return {Number} Page number + */ + + }, { + key: 'getPage', + value: function getPage() { + return this.currentPageNb; + } + + /** + * Show page based on passed param value (string or number): + * @param {String} or {Number} cmd possible string values: 'next', + * 'previous', 'last', 'first' or page number as per param + */ + + }, { + key: 'setPage', + value: function setPage(cmd) { + var tf = this.tf; + if (!tf.hasGrid() || !this.isEnabled()) { + return; + } + var btnEvt = this.evt, + cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); + if (cmdtype === 'string') { + switch (_string2.default.lower(cmd)) { + case 'next': + btnEvt.next(); + break; + case 'previous': + btnEvt.prev(); + break; + case 'last': + btnEvt.last(); + break; + case 'first': + btnEvt.first(); + break; + default: + btnEvt.next(); + break; + } + } else if (cmdtype === 'number') { + this.changePage(cmd - 1); + } + } + + /** + * Generates UI elements for the number of results per page drop-down + */ + + }, { + key: 'setResultsPerPage', + value: function setResultsPerPage() { + var _this3 = this; + + var tf = this.tf; + var evt = this.evt; + + if (!tf.hasGrid() && !tf.isFirstLoad) { + return; + } + if (this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + + evt.slcResultsChange = function (ev) { + _this3.changeResultsPerPage(); + ev.target.blur(); + }; + + var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); + slcR.className = this.resultsSlcCssClass; + var slcRText = this.resultsPerPage[0], + slcROpts = this.resultsPerPage[1]; + var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); + slcRSpan.className = this.resultsSpanCssClass; + + // results per page select is added to external element + if (!this.resultsPerPageTgtId) { + tf.setToolbar(); + } + var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); + slcRSpan.appendChild(_dom2.default.text(slcRText)); + + var help = tf.feature('help'); + if (help && help.btn) { + help.btn.parentNode.insertBefore(slcRSpan, help.btn); + help.btn.parentNode.insertBefore(slcR, help.btn); + } else { + targetEl.appendChild(slcRSpan); + targetEl.appendChild(slcR); + } + + for (var r = 0; r < slcROpts.length; r++) { + var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); + slcR.options[r] = currOpt; + } + _event2.default.add(slcR, 'change', evt.slcResultsChange); + this.resultsPerPageSlc = slcR; + } + + /** + * Remove number of results per page UI elements + */ + + }, { + key: 'removeResultsPerPage', + value: function removeResultsPerPage() { + var tf = this.tf; + if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + var slcR = this.resultsPerPageSlc, + slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); + if (slcR) { + _dom2.default.remove(slcR); + } + if (slcRSpan) { + _dom2.default.remove(slcRSpan); + } + this.resultsPerPageSlc = null; + } + + /** + * Change the page according to passed index + * @param {Number} index Index of the page (0-n) + */ + + }, { + key: 'changePage', + value: function changePage(index) { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + + this.emitter.emit('before-changing-page', tf, index); + + if (index === null) { + index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; + } + if (index >= 0 && index <= this.nbPages - 1) { + if (this.onBeforeChangePage) { + this.onBeforeChangePage.call(null, this, index); + } + this.currentPageNb = parseInt(index, 10) + 1; + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.options[index].selected = true; + } else { + this.pagingSlc.value = this.currentPageNb; + } + + if (tf.rememberPageNb) { + tf.feature('store').savePageNb(tf.pgNbCookie); + } + this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; + + this.groupByPage(); + + if (this.onAfterChangePage) { + this.onAfterChangePage.call(null, this, index); + } + } + + this.emitter.emit('after-changing-page', tf, index); + } + + /** + * Change rows according to page results drop-down + * TODO: accept a parameter setting the results per page length + */ + + }, { + key: 'changeResultsPerPage', + value: function changeResultsPerPage() { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + + this.emitter.emit('before-changing-results-per-page', tf); + + var slcR = this.resultsPerPageSlc; + var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); + this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); + this.startPagingRow = this.pagingLength * slcPagesSelIndex; + + if (!isNaN(this.pagingLength)) { + if (this.startPagingRow >= tf.nbFilterableRows) { + this.startPagingRow = tf.nbFilterableRows - this.pagingLength; + } + this.setPagingInfo(); + + if (this.pageSelectorType === tf.fltTypeSlc) { + var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; + this.pagingSlc.options[slcIndex].selected = true; + } + if (tf.rememberPageLen) { + tf.feature('store').savePageLength(tf.pgLenCookie); + } + } + + this.emitter.emit('after-changing-results-per-page', tf); + } + + /** + * Re-set persisted pagination info + */ + + }, { + key: 'resetValues', + value: function resetValues() { + var tf = this.tf; + if (tf.rememberPageLen) { + this.resetPageLength(tf.pgLenCookie); + } + if (tf.rememberPageNb) { + this.resetPage(tf.pgNbCookie); + } + } + + /** + * Re-set page nb at page re-load + */ + + }, { + key: 'resetPage', + value: function resetPage(name) { + var tf = this.tf; + if (!this.isEnabled()) { + return; + } + this.emitter.emit('before-reset-page', tf); + var pgnb = tf.feature('store').getPageNb(name); + if (pgnb !== '') { + this.changePage(pgnb - 1); + } + this.emitter.emit('after-reset-page', tf, pgnb); + } + + /** + * Re-set page length value at page re-load + */ + + }, { + key: 'resetPageLength', + value: function resetPageLength(name) { + var tf = this.tf; + if (!this.isEnabled()) { + return; + } + this.emitter.emit('before-reset-page-length', tf); + var pglenIndex = tf.feature('store').getPageLength(name); + + if (pglenIndex !== '') { + this.resultsPerPageSlc.options[pglenIndex].selected = true; + this.changeResultsPerPage(); + } + this.emitter.emit('after-reset-page-length', tf, pglenIndex); + } + + /** + * Remove paging feature + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + var tf = this.tf; + + if (!this.initialized) { + return; + } + // btns containers + var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); + var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); + var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); + var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); + //span containing 'Page' text + var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); + //span containing 'of' text + var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); + //span containing nb of pages + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + var evt = this.evt; + + if (this.pagingSlc) { + if (this.pageSelectorType === tf.fltTypeSlc) { + _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); + } else if (this.pageSelectorType === tf.fltTypeInp) { + _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); + } + _dom2.default.remove(this.pagingSlc); + } + + if (btnNextSpan) { + _event2.default.remove(btnNextSpan, 'click', evt.next); + _dom2.default.remove(btnNextSpan); + } + + if (btnPrevSpan) { + _event2.default.remove(btnPrevSpan, 'click', evt.prev); + _dom2.default.remove(btnPrevSpan); + } + + if (btnLastSpan) { + _event2.default.remove(btnLastSpan, 'click', evt.last); + _dom2.default.remove(btnLastSpan); + } + + if (btnFirstSpan) { + _event2.default.remove(btnFirstSpan, 'click', evt.first); + _dom2.default.remove(btnFirstSpan); + } + + if (pgBeforeSpan) { + _dom2.default.remove(pgBeforeSpan); + } + + if (pgAfterSpan) { + _dom2.default.remove(pgAfterSpan); + } + + if (pgspan) { + _dom2.default.remove(pgspan); + } + + if (this.hasResultsPerPage) { + this.removeResultsPerPage(); + } + + this.emitter.off(['after-filtering'], function () { + return _this4.resetPagingInfo(); + }); + this.emitter.off(['initialized'], function () { + return _this4.resetValues(); + }); + + this.pagingSlc = null; + this.nbPages = 0; + this.disable(); + this.initialized = false; + } + }]); + + return Paging; + })(_feature.Feature); + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.ClearButton = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var ClearButton = exports.ClearButton = (function (_Feature) { + _inherits(ClearButton, _Feature); + + /** + * Clear button component + * @param {Object} tf TableFilter instance + */ + + function ClearButton(tf) { + _classCallCheck(this, ClearButton); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); + + var f = _this.config; + + //id of container element + _this.btnResetTgtId = f.btn_reset_target_id || null; + //reset button element + _this.btnResetEl = null; + //defines reset text + _this.btnResetText = f.btn_reset_text || 'Reset'; + //defines reset button tooltip + _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; + //defines reset button innerHtml + _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); + //span containing reset button + _this.prfxResetSpan = 'resetspan_'; + return _this; + } + + _createClass(ClearButton, [{ + key: 'onClick', + value: function onClick() { + if (!this.isEnabled()) { + return; + } + this.tf.clearFilters(); + } + + /** + * Build DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + + if (this.initialized) { + return; + } + + var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); + + // reset button is added to defined element + if (!this.btnResetTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); + targetEl.appendChild(resetspan); + + if (!this.btnResetHtml) { + var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); + fltreset.className = tf.btnResetCssClass; + fltreset.appendChild(_dom2.default.text(this.btnResetText)); + resetspan.appendChild(fltreset); + _event2.default.add(fltreset, 'click', function () { + _this2.onClick(); + }); + } else { + resetspan.innerHTML = this.btnResetHtml; + var resetEl = resetspan.firstChild; + _event2.default.add(resetEl, 'click', function () { + _this2.onClick(); + }); + } + this.btnResetEl = resetspan.firstChild; + + this.initialized = true; + } + + /** + * Remove clear button UI + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + + if (!this.initialized) { + return; + } + + var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); + if (resetspan) { + _dom2.default.remove(resetspan); + } + this.btnResetEl = null; + this.initialized = false; + } + }]); + + return ClearButton; + })(_feature.Feature); + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Help = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; + var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; + + var Help = exports.Help = (function (_Feature) { + _inherits(Help, _Feature); + + /** + * Help UI component + * @param {Object} tf TableFilter instance + */ + + function Help(tf) { + _classCallCheck(this, Help); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); + + var f = _this.config; + + //id of custom container element for instructions + _this.tgtId = f.help_instructions_target_id || null; + //id of custom container element for instructions + _this.contTgtId = f.help_instructions_container_target_id || null; + //defines help text + _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; + //defines help innerHtml + _this.instrHtml = f.help_instructions_html || null; + //defines reset button text + _this.btnText = f.help_instructions_btn_text || '?'; + //defines reset button innerHtml + _this.btnHtml = f.help_instructions_btn_html || null; + //defines css class for help button + _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; + //defines css class for help container + _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; + //help button element + _this.btn = null; + //help content div + _this.cont = null; + _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; + + //id prefix for help elements + _this.prfxHelpSpan = 'helpSpan_'; + //id prefix for help elements + _this.prfxHelpDiv = 'helpDiv_'; + return _this; + } + + _createClass(Help, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); + var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); + + //help button is added to defined element + if (!this.tgtId) { + tf.setToolbar(); + } + var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); + targetEl.appendChild(helpspan); + + var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); + + if (!this.btnHtml) { + divContainer.appendChild(helpdiv); + var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); + helplink.className = this.btnCssClass; + helplink.appendChild(_dom2.default.text(this.btnText)); + helpspan.appendChild(helplink); + _event2.default.add(helplink, 'click', function () { + _this2.toggle(); + }); + } else { + helpspan.innerHTML = this.btnHtml; + var helpEl = helpspan.firstChild; + _event2.default.add(helpEl, 'click', function () { + _this2.toggle(); + }); + divContainer.appendChild(helpdiv); + } + + if (!this.instrHtml) { + helpdiv.innerHTML = this.instrText; + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } else { + if (this.contTgtId) { + divContainer.appendChild(helpdiv); + } + helpdiv.innerHTML = this.instrHtml; + if (!this.contTgtId) { + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } + } + helpdiv.innerHTML += this.defaultHtml; + _event2.default.add(helpdiv, 'click', function () { + _this2.toggle(); + }); + + this.cont = helpdiv; + this.btn = helpspan; + this.initialized = true; + } + + /** + * Toggle help pop-up + */ + + }, { + key: 'toggle', + value: function toggle() { + // check only if explicitily set to false as in this case undefined + // signifies the help feature is enabled by default + if (this.enabled === false) { + return; + } + var divDisplay = this.cont.style.display; + if (divDisplay === '' || divDisplay === 'none') { + this.cont.style.display = 'inline'; + } else { + this.cont.style.display = 'none'; + } + } + + /** + * Remove help UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + _dom2.default.remove(this.btn); + this.btn = null; + if (!this.cont) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + this.initialized = false; + } + }]); + + return Help; + })(_feature.Feature); + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.AlternateRows = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var AlternateRows = exports.AlternateRows = (function (_Feature) { + _inherits(AlternateRows, _Feature); + + /** + * Alternating rows color + * @param {Object} tf TableFilter instance + */ + + function AlternateRows(tf) { + _classCallCheck(this, AlternateRows); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); + + var config = _this.config; + //defines css class for even rows + _this.evenCss = config.even_row_css_class || 'even'; + //defines css class for odd rows + _this.oddCss = config.odd_row_css_class || 'odd'; + return _this; + } + + /** + * Sets alternating rows color + */ + + _createClass(AlternateRows, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + this.processAll(); + + // Subscribe to events + this.emitter.on(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { + return _this2.processRow(rowIndex, arrIndex, isValid); + }); + this.emitter.on(['column-sorted'], function () { + return _this2.processAll(); + }); + + this.initialized = true; + } + }, { + key: 'processAll', + value: function processAll() { + if (!this.isEnabled()) { + return; + } + var tf = this.tf; + var validRowsIndex = tf.getValidRows(true); + var noValidRowsIndex = validRowsIndex.length === 0; + //1st index + var beginIndex = noValidRowsIndex ? tf.refRow : 0; + // nb indexes + var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; + var idx = 0; + + //alternates bg color + for (var j = beginIndex; j < indexLen; j++) { + var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; + this.setRowBg(rowIdx, idx); + idx++; + } + } + + /** + * Set/remove row background based on row validation + * @param {Number} rowIdx Row index + * @param {Boolean} isValid Valid row flag + */ + + }, { + key: 'processRow', + value: function processRow(rowIdx, arrIdx, isValid) { + if (isValid) { + this.setRowBg(rowIdx, arrIdx); + } else { + this.removeRowBg(rowIdx); + } + } + + /** + * Sets row background color + * @param {Number} rowIdx Row index + * @param {Number} idx Valid rows collection index needed to calculate bg + * color + */ + + }, { + key: 'setRowBg', + value: function setRowBg(rowIdx, idx) { + if (!this.isEnabled() || isNaN(rowIdx)) { + return; + } + var rows = this.tf.tbl.rows; + var i = isNaN(idx) ? rowIdx : idx; + this.removeRowBg(rowIdx); + + _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); + } + + /** + * Removes row background color + * @param {Number} idx Row index + */ + + }, { + key: 'removeRowBg', + value: function removeRowBg(idx) { + if (isNaN(idx)) { + return; + } + var rows = this.tf.tbl.rows; + _dom2.default.removeClass(rows[idx], this.oddCss); + _dom2.default.removeClass(rows[idx], this.evenCss); + } + + /** + * Removes all alternating backgrounds + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { + this.removeRowBg(i); + } + + // Unsubscribe to events + this.emitter.off(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { + return _this3.processRow(rowIndex, arrIndex, isValid); + }); + this.emitter.off(['column-sorted'], function () { + return _this3.processAll(); + }); + + this.initialized = false; + } + }]); + + return AlternateRows; + })(_feature.Feature); + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.NoResults = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var NoResults = exports.NoResults = (function (_Feature) { + _inherits(NoResults, _Feature); + + /** + * No results message UI component + * @param {Object} tf TableFilter instance + */ + + function NoResults(tf) { + _classCallCheck(this, NoResults); + + //configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); + + var f = _this.config.no_results_message; + + _this.content = f.content || 'No results'; + _this.customContainer = f.custom_container || null; + _this.customContainerId = f.custom_container_id || null; + _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); + _this.cssClass = f.css_class || 'no-results'; + + _this.cont = null; + + //callback before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //callback after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + //callback before message is hidden + _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; + //callback after message is hidden + _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; + + _this.prfxNoResults = 'nores_'; + return _this; + } + + _createClass(NoResults, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + var tf = this.tf; + var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; + + //container + var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); + cont.className = this.cssClass; + cont.innerHTML = this.content; + + if (this.isExternal) { + target.appendChild(cont); + } else { + target.parentNode.insertBefore(cont, target.nextSibling); + } + + this.cont = cont; + + // subscribe to after-filtering event + this.emitter.on(['after-filtering'], function () { + return _this2.toggle(); + }); + + this.initialized = true; + this.hide(); + } + }, { + key: 'toggle', + value: function toggle() { + if (this.tf.nbVisibleRows > 0) { + this.hide(); + } else { + this.show(); + } + } + }, { + key: 'show', + value: function show() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, this); + } + + this.setWidth(); + this.cont.style.display = 'block'; + + if (this.onAfterShowMsg) { + this.onAfterShowMsg.call(null, this.tf, this); + } + } + }, { + key: 'hide', + value: function hide() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + + this.cont.style.display = 'none'; + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + } + }, { + key: 'setWidth', + value: function setWidth() { + if (!this.initialized || this.isExternal || !this.isEnabled()) { + return; + } + if (this.tf.gridLayout) { + var gridLayout = this.tf.feature('gridLayout'); + this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; + } else { + this.cont.style.width = this.tf.tbl.clientWidth + 'px'; + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + // unsubscribe to after-filtering event + this.emitter.off(['after-filtering'], function () { + return _this3.toggle(); + }); + + this.initialized = false; + } + }]); + + return NoResults; + })(_feature.Feature); + +/***/ } +/******/ ]) +}); +; +//# sourceMappingURL=tablefilter.js.map \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 6a0d5351..a36acf80 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,8 +1,2185 @@ -/** - * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-04T06:55:19.228Z - * MIT License - */ +webpackJsonp([1],{ -webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file +/***/ 26: +/***/ function(module, exports, __webpack_require__) { + + var map = { + "./array": 6, + "./array.js": 6, + "./cookie": 4, + "./cookie.js": 4, + "./date": 7, + "./date.js": 7, + "./dom": 2, + "./dom.js": 2, + "./emitter": 9, + "./emitter.js": 9, + "./event": 1, + "./event.js": 1, + "./extensions/advancedGrid/adapterEzEditTable": 27, + "./extensions/advancedGrid/adapterEzEditTable.js": 27, + "./extensions/advancedGrid/advancedGrid": 28, + "./extensions/advancedGrid/advancedGrid.js": 28, + "./extensions/colOps/colOps": 29, + "./extensions/colOps/colOps.js": 29, + "./extensions/colsVisibility/colsVisibility": 30, + "./extensions/colsVisibility/colsVisibility.js": 30, + "./extensions/filtersVisibility/filtersVisibility": 31, + "./extensions/filtersVisibility/filtersVisibility.js": 31, + "./extensions/sort/adapterSortabletable": 32, + "./extensions/sort/adapterSortabletable.js": 32, + "./extensions/sort/sort": 33, + "./extensions/sort/sort.js": 33, + "./helpers": 8, + "./helpers.js": 8, + "./modules/alternateRows": 24, + "./modules/alternateRows.js": 24, + "./modules/checkList": 18, + "./modules/checkList.js": 18, + "./modules/clearButton": 22, + "./modules/clearButton.js": 22, + "./modules/dropdown": 16, + "./modules/dropdown.js": 16, + "./modules/feature": 12, + "./modules/feature.js": 12, + "./modules/gridLayout": 11, + "./modules/gridLayout.js": 11, + "./modules/help": 23, + "./modules/help.js": 23, + "./modules/highlightKeywords": 14, + "./modules/highlightKeywords.js": 14, + "./modules/loader": 13, + "./modules/loader.js": 13, + "./modules/noResults": 25, + "./modules/noResults.js": 25, + "./modules/paging": 21, + "./modules/paging.js": 21, + "./modules/popupFilter": 15, + "./modules/popupFilter.js": 15, + "./modules/rowsCounter": 19, + "./modules/rowsCounter.js": 19, + "./modules/statusBar": 20, + "./modules/statusBar.js": 20, + "./modules/store": 10, + "./modules/store.js": 10, + "./sort": 17, + "./sort.js": 17, + "./string": 3, + "./string.js": 3, + "./types": 5, + "./types.js": 5 + }; + function webpackContext(req) { + return __webpack_require__(webpackContextResolve(req)); + }; + function webpackContextResolve(req) { + return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); + }; + webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); + }; + webpackContext.resolve = webpackContextResolve; + module.exports = webpackContext; + webpackContext.id = 26; + + +/***/ }, + +/***/ 27: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterEzEditTable = (function () { + /** + * Adapter module for ezEditTable, an external library providing advanced + * grid features (selection and edition): + * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus + * + * @param {Object} tf TableFilter instance + */ + + function AdapterEzEditTable(tf, cfg) { + _classCallCheck(this, AdapterEzEditTable); + + // ezEditTable config + this.initialized = false; + this.desc = cfg.description || 'ezEditTable adapter'; + this.filename = cfg.filename || 'ezEditTable.js'; + this.vendorPath = cfg.vendor_path; + this.loadStylesheet = Boolean(cfg.load_stylesheet); + this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; + this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; + this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; + // Enable the ezEditTable's scroll into view behaviour if grid layout on + cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; + + this._ezEditTable = null; + this.cfg = cfg; + this.tf = tf; + } + + /** + * Conditionally load ezEditTable library and set advanced grid + * @return {[type]} [description] + */ + + _createClass(AdapterEzEditTable, [{ + key: 'init', + value: function init() { + var _this = this; + + var tf = this.tf; + if (window.EditTable) { + this._setAdvancedGrid(); + } else { + var path = this.vendorPath + this.filename; + tf.import(this.filename, path, function () { + _this._setAdvancedGrid(); + }); + } + if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { + tf.import(this.stylesheetName, this.stylesheet, null, 'link'); + } + } + + /** + * Instantiate ezEditTable component for advanced grid features + */ + + }, { + key: '_setAdvancedGrid', + value: function _setAdvancedGrid() { + var tf = this.tf; + + //start row for EditTable constructor needs to be calculated + var startRow, + cfg = this.cfg, + thead = _dom2.default.tag(tf.tbl, 'thead'); + + //if thead exists and startRow not specified, startRow is calculated + //automatically by EditTable + if (thead.length > 0 && !cfg.startRow) { + startRow = undefined; + } + //otherwise startRow config property if any or TableFilter refRow + else { + startRow = cfg.startRow || tf.refRow; + } + + cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; + var editable = cfg.editable; + var selectable = cfg.selection; + + if (selectable) { + cfg.default_selection = cfg.default_selection || 'row'; + } + //CSS Styles + cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; + + var _lastValidRowIndex = 0; + var _lastRowIndex = 0; + + if (selectable) { + //Row navigation needs to be calculated according to TableFilter's + //validRowsIndex array + var onAfterSelection = function onAfterSelection(et, selectedElm, e) { + var slc = et.Selection; + //Next valid filtered row needs to be selected + var doSelect = function doSelect(nextRowIndex) { + if (et.defaultSelection === 'row') { + slc.SelectRowByIndex(nextRowIndex); + } else { + et.ClearSelections(); + var cellIndex = selectedElm.cellIndex, + row = tf.tbl.rows[nextRowIndex]; + if (et.defaultSelection === 'both') { + slc.SelectRowByIndex(nextRowIndex); + } + if (row) { + slc.SelectCell(row.cells[cellIndex]); + } + } + //Table is filtered + if (tf.validRowsIndex.length !== tf.getRowsNb()) { + var r = tf.tbl.rows[nextRowIndex]; + if (r) { + r.scrollIntoView(false); + } + if (cell) { + if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { + tf.tblCont.scrollLeft = 100000000; + } else if (cell.cellIndex === 0 && tf.gridLayout) { + tf.tblCont.scrollLeft = 0; + } else { + cell.scrollIntoView(false); + } + } + } + }; + + //table is not filtered + if (!tf.validRowsIndex) { + return; + } + var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, + nextRowIndex, + paging = tf.feature('paging'), + + //pgup/pgdown keys + d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { + //last row + if (row.rowIndex >= validIndexes[validIdxLen - 1]) { + nextRowIndex = validIndexes[validIdxLen - 1]; + } else { + var calcRowIndex = _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[_lastValidRowIndex - d]; + nextRowIndex = v ? v : validIndexes[0]; + } + } + _lastRowIndex = row.rowIndex; + doSelect(nextRowIndex); + } else { + //If filtered row is valid, special calculation for + //pgup/pgdown keys + if (keyCode !== 34 && keyCode !== 33) { + _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); + _lastRowIndex = row.rowIndex; + } else { + if (keyCode === 34) { + //pgdown + //last row + if (_lastValidRowIndex + d <= validIdxLen - 1) { + nextRowIndex = validIndexes[_lastValidRowIndex + d]; + } else { + nextRowIndex = [validIdxLen - 1]; + } + } else { + //pgup + //first row + if (_lastValidRowIndex - d <= validIndexes[0]) { + nextRowIndex = validIndexes[0]; + } else { + nextRowIndex = validIndexes[_lastValidRowIndex - d]; + } + } + _lastRowIndex = nextRowIndex; + _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); + doSelect(nextRowIndex); + } + } + }; + + //Page navigation has to be enforced whenever selected row is out of + //the current page range + var onBeforeSelection = function onBeforeSelection(et, selectedElm) { + var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; + if (tf.paging) { + if (tf.feature('paging').nbPages > 1) { + var paging = tf.feature('paging'); + //page length is re-assigned in case it has changed + et.nbRowsPerPage = paging.pagingLength; + var validIndexes = tf.validRowsIndex, + validIdxLen = validIndexes.length, + pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); + var rowIndex = row.rowIndex; + + if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { + paging.setPage('last'); + } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { + paging.setPage('first'); + } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { + paging.setPage('next'); + } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { + paging.setPage('previous'); + } + } + } + }; + + //Selected row needs to be visible when paging is activated + if (tf.paging) { + tf.feature('paging').onAfterChangePage = function (paging) { + var advGrid = paging.tf.extension('advancedGrid'); + var et = advGrid._ezEditTable; + var slc = et.Selection; + var row = slc.GetActiveRow(); + if (row) { + row.scrollIntoView(false); + } + var cell = slc.GetActiveCell(); + if (cell) { + cell.scrollIntoView(false); + } + }; + } + + //Rows navigation when rows are filtered is performed with the + //EditTable row selection callback events + if (cfg.default_selection === 'row') { + var fnB = cfg.on_before_selected_row; + cfg.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 = cfg.on_after_selected_row; + cfg.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 = cfg.on_before_selected_cell; + cfg.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 = cfg.on_after_selected_cell; + cfg.on_after_selected_cell = function () { + onAfterSelection(arguments[0], arguments[1], arguments[2]); + if (fnC) { + fnC.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + } + } + if (editable) { + //Added or removed rows, TF rows number needs to be re-calculated + var fnE = cfg.on_added_dom_row; + cfg.on_added_dom_row = function () { + tf.nbFilterableRows++; + if (!tf.paging) { + tf.emitter.emit('rows-changed', tf, this); + //tf.feature('rowsCounter').refresh(); + } else { + tf.nbRows++; + tf.nbVisibleRows++; + tf.nbFilterableRows++; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnE) { + fnE.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + if (cfg.actions && cfg.actions['delete']) { + var fnF = cfg.actions['delete'].on_after_submit; + cfg.actions['delete'].on_after_submit = function () { + tf.nbFilterableRows--; + if (!tf.paging) { + // tf.feature('rowsCounter').refresh(); + tf.emitter.emit('rows-changed', tf, this); + } else { + tf.nbRows--; + tf.nbVisibleRows--; + tf.nbFilterableRows--; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(false); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnF) { + fnF.call(null, arguments[0], arguments[1]); + } + }; + } + } + + try { + this._ezEditTable = new EditTable(tf.id, cfg, startRow); + this._ezEditTable.Init(); + } catch (e) { + throw new Error(this.err); + } + + this.initialized = true; + } + + /** + * Reset advanced grid when previously removed + */ + + }, { + key: 'reset', + value: function reset() { + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.Set(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Set(); + } + } + } + + /** + * Remove advanced grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.ClearSelections(); + ezEditTable.Selection.Remove(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Remove(); + } + } + this.initialized = false; + } + }]); + + return AdapterEzEditTable; + })(); + + exports.default = AdapterEzEditTable; + +/***/ }, + +/***/ 28: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterEzEditTable = __webpack_require__(27); + + var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = _adapterEzEditTable2.default; + +/***/ }, + +/***/ 29: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColOps = (function () { + + /** + * Column calculations + * @param {Object} tf TableFilter instance + */ + + function ColOps(tf, opts) { + _classCallCheck(this, ColOps); + + //calls function before col operation + this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; + //calls function after col operation + this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; + + this.opts = opts; + this.tf = tf; + } + + _createClass(ColOps, [{ + key: 'init', + value: function init() { + var _this = this; + + // subscribe to events + this.tf.emitter.on(['after-filtering'], function () { + return _this.calc(); + }); + + this.calc(); + } + + /** + * Calculates columns' values + * Configuration options are stored in 'opts' property + * - 'id' contains ids of elements showing result (array) + * - 'col' contains the columns' indexes (array) + * - 'operation' contains operation type (array, values: 'sum', 'mean', + * 'min', 'max', 'median', 'q1', 'q3') + * - 'write_method' array defines which method to use for displaying the + * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' + * - 'tot_row_index' defines in which row results are displayed + * (integers array) + * + * - changes made by Nuovella: + * (1) optimized the routine (now it will only process each column once), + * (2) added calculations for the median, lower and upper quartile. + */ + + }, { + key: 'calc', + value: function calc() { + var tf = this.tf; + if (!tf.isFirstLoad && !tf.hasGrid()) { + return; + } + + if (this.onBeforeOperation) { + this.onBeforeOperation.call(null, tf); + } + + var opts = this.opts, + labelId = opts.id, + colIndex = opts.col, + operation = opts.operation, + outputType = opts.write_method, + totRowIndex = opts.tot_row_index, + excludeRow = opts.exclude_row, + decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; + + //nuovella: determine unique list of columns to operate on + var ucolIndex = [], + ucolMax = 0; + ucolIndex[ucolMax] = colIndex[0]; + + for (var ii = 1; ii < colIndex.length; ii++) { + var saved = 0; + //see if colIndex[ii] is already in the list of unique indexes + for (var jj = 0; jj <= ucolMax; jj++) { + if (ucolIndex[jj] === colIndex[ii]) { + saved = 1; + } + } + //if not saved then, save the index; + if (saved === 0) { + ucolMax++; + ucolIndex[ucolMax] = colIndex[ii]; + } + } + + if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { + var rows = tf.tbl.rows, + colvalues = []; + + for (var ucol = 0; ucol <= ucolMax; ucol++) { + //this retrieves col values + //use ucolIndex because we only want to pass through this loop + //once for each column get the values in this unique column + colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); + + //next: calculate all operations for this column + 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; + + for (var k = 0; k < colIndex.length; k++) { + if (colIndex[k] === ucolIndex[ucol]) { + mThisCol++; + opsThisCol[mThisCol] = _string2.default.lower(operation[k]); + decThisCol[mThisCol] = decimalPrecision[k]; + labThisCol[mThisCol] = labelId[k]; + oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; + + switch (opsThisCol[mThisCol]) { + case 'mean': + meanFlag = 1; + break; + case 'sum': + sumFlag = 1; + break; + case 'min': + minFlag = 1; + break; + case 'max': + maxFlag = 1; + break; + case 'median': + medFlag = 1; + break; + case 'q1': + q1Flag = 1; + break; + case 'q3': + q3Flag = 1; + break; + } + } + } + + for (var j = 0; j < colvalues[ucol].length; j++) { + //sort the list for calculation of median and quartiles + if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { + if (j < colvalues[ucol].length - 1) { + for (k = j + 1; k < colvalues[ucol].length; k++) { + if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { + temp = colvalues[ucol][j]; + colvalues[ucol][j] = colvalues[ucol][k]; + colvalues[ucol][k] = temp; + } + } + } + } + var cvalue = parseFloat(colvalues[ucol][j]); + theList[j] = parseFloat(cvalue); + + if (!isNaN(cvalue)) { + nbvalues++; + if (sumFlag === 1 || meanFlag === 1) { + sumValue += parseFloat(cvalue); + } + if (minFlag === 1) { + if (minValue === null) { + minValue = parseFloat(cvalue); + } else { + minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; + } + } + if (maxFlag === 1) { + if (maxValue === null) { + maxValue = parseFloat(cvalue); + } else { + maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; + } + } + } + } //for j + if (meanFlag === 1) { + meanValue = sumValue / nbvalues; + } + if (medFlag === 1) { + var aux = 0; + if (nbvalues % 2 === 1) { + aux = Math.floor(nbvalues / 2); + medValue = theList[aux]; + } else { + medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; + } + } + var posa; + if (q1Flag === 1) { + posa = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa == nbvalues) { + q1Value = (theList[posa - 1] + theList[posa]) / 2; + } else { + q1Value = theList[posa]; + } + } + if (q3Flag === 1) { + posa = 0.0; + var posb = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa === nbvalues) { + posb = 3 * posa; + q3Value = (theList[posb] + theList[posb - 1]) / 2; + } else { + q3Value = theList[nbvalues - posa - 1]; + } + } + + for (var i = 0; i <= mThisCol; i++) { + switch (opsThisCol[i]) { + case 'mean': + result = meanValue; + break; + case 'sum': + result = sumValue; + break; + case 'min': + result = minValue; + break; + case 'max': + result = maxValue; + break; + case 'median': + result = medValue; + break; + case 'q1': + result = q1Value; + break; + case 'q3': + result = q3Value; + break; + } + + var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; + + //if outputType is defined + if (oTypeThisCol && result) { + result = result.toFixed(precision); + + if (_dom2.default.id(labThisCol[i])) { + switch (_string2.default.lower(oTypeThisCol)) { + case 'innerhtml': + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result; + } + break; + case 'setvalue': + _dom2.default.id(labThisCol[i]).value = result; + break; + case 'createtextnode': + var oldnode = _dom2.default.id(labThisCol[i]).firstChild; + var txtnode = _dom2.default.text(result); + _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); + break; + } //switch + } + } else { + try { + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); + } + } catch (e) {} //catch + } //else + } //for i + + // row(s) with result are always visible + var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; + if (totRow) { + totRow.style.display = ''; + } + } //for ucol + } //if typeof + + if (this.onAfterOperation) { + this.onAfterOperation.call(null, tf); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + // unsubscribe to events + this.tf.emitter.off(['after-filtering'], function () { + return _this2.calc(); + }); + } + }]); + + return ColOps; + })(); + + exports.default = ColOps; + +/***/ }, + +/***/ 30: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColsVisibility = (function () { + + /** + * Columns Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function ColsVisibility(tf, f) { + _classCallCheck(this, ColsVisibility); + + // Configuration object + var cfg = tf.config(); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Columns visibility manager'; + + //show/hide cols span element + this.spanEl = null; + //show/hide cols button element + this.btnEl = null; + //show/hide cols container div element + this.contEl = null; + + //tick to hide or show column + this.tickToHide = f.tick_to_hide === false ? false : true; + //enables/disables cols manager generation + this.manager = f.manager === false ? false : true; + //only if external headers + this.headersTbl = f.headers_table || false; + //only if external headers + this.headersIndex = f.headers_index || 1; + //id of container element + this.contElTgtId = f.container_target_id || null; + //alternative headers text + this.headersText = f.headers_text || null; + //id of button container element + this.btnTgtId = f.btn_target_id || null; + //defines show/hide cols text + this.btnText = f.btn_text || 'Columns▼'; + //defines show/hide cols button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for show/hide cols button + this.btnCssClass = f.btn_css_class || 'colVis'; + //defines close link text + this.btnCloseText = f.btn_close_text || 'Close'; + //defines close button innerHtml + this.btnCloseHtml = f.btn_close_html || null; + //defines css class for close button + this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; + this.stylesheet = f.stylesheet || 'colsVisibility.css'; + //span containing show/hide cols button + this.prfx = 'colVis_'; + //defines css class span containing show/hide cols + this.spanCssClass = f.span_css_class || 'colVisSpan'; + this.prfxCont = this.prfx + 'Cont_'; + //defines css class div containing show/hide cols + this.contCssClass = f.cont_css_class || 'colVisCont'; + //defines css class for cols list (ul) + this.listCssClass = cfg.list_css_class || 'cols_checklist'; + //defines css class for list item (li) + this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; + //defines css class for selected list item (li) + this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; + //text preceding columns list + this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); + this.atStart = f.at_start || null; + this.enableHover = Boolean(f.enable_hover); + //enables select all option + this.enableTickAll = Boolean(f.enable_tick_all); + //text preceding columns list + this.tickAllText = f.tick_all_text || 'Select all:'; + + //array containing hidden columns indexes + this.hiddenCols = []; + this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; + + //callback invoked just after cols manager is loaded + this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; + //calls function before cols manager is opened + this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; + //calls function after cols manager is opened + this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; + //calls function before cols manager is closed + this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; + //calls function after cols manager is closed + this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; + + //callback before col is hidden + this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; + //callback after col is hidden + this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; + //callback before col is displayed + this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; + //callback after col is displayed + this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; + + //Grid layout compatibility + if (tf.gridLayout) { + this.headersTbl = tf.feature('gridLayout').headTbl; //headers table + this.headersIndex = 0; //headers index + this.onAfterColDisplayed = function () {}; + this.onAfterColHidden = function () {}; + } + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + _createClass(ColsVisibility, [{ + key: 'toggle', + value: function toggle() { + var contDisplay = this.contEl.style.display; + var onBeforeOpen = this.onBeforeOpen; + var onBeforeClose = this.onBeforeClose; + var onAfterOpen = this.onAfterOpen; + var onAfterClose = this.onAfterClose; + + if (onBeforeOpen && contDisplay !== 'inline') { + onBeforeOpen.call(null, this); + } + if (onBeforeClose && contDisplay === 'inline') { + onBeforeClose.call(null, this); + } + + this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; + + if (onAfterOpen && contDisplay !== 'inline') { + onAfterOpen.call(null, this); + } + if (onAfterClose && contDisplay === 'inline') { + onAfterClose.call(null, this); + } + } + }, { + key: 'checkItem', + value: function checkItem(lbl) { + var li = lbl.parentNode; + if (!li || !lbl) { + return; + } + var isChecked = lbl.firstChild.checked; + var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; + colIndex = parseInt(colIndex, 10); + if (isChecked) { + _dom2.default.addClass(li, this.listSlcItemCssClass); + } else { + _dom2.default.removeClass(li, this.listSlcItemCssClass); + } + + var hide = false; + if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { + hide = true; + } + this.setHidden(colIndex, hide); + } + }, { + key: 'init', + value: function init() { + if (!this.manager) { + return; + } + this.buildBtn(); + this.buildManager(); + + this.initialized = true; + } + + /** + * Build main button UI + */ + + }, { + key: 'buildBtn', + value: function buildBtn() { + var _this = this; + + if (this.btnEl) { + return; + } + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.spanCssClass; + + //Container element (rdiv or custom element) + if (!this.btnTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); + + if (!this.btnTgtId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + if (!this.btnHtml) { + var btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCssClass; + btn.title = this.desc; + + btn.innerHTML = this.btnText; + span.appendChild(btn); + if (!this.enableHover) { + _event2.default.add(btn, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(btn, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } else { + //Custom html + span.innerHTML = this.btnHtml; + var colVisEl = span.firstChild; + if (!this.enableHover) { + _event2.default.add(colVisEl, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(colVisEl, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } + + this.spanEl = span; + this.btnEl = this.spanEl.firstChild; + + if (this.onLoaded) { + this.onLoaded.call(null, this); + } + } + + /** + * Build columns manager UI + */ + + }, { + key: 'buildManager', + value: function buildManager() { + var _this2 = this; + + var tf = this.tf; + + var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); + container.className = this.contCssClass; + + //Extension description + var extNameLabel = _dom2.default.create('p'); + extNameLabel.innerHTML = this.text; + container.appendChild(extNameLabel); + + //Headers list + var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); + ul.className = this.listCssClass; + + var tbl = this.headersTbl ? this.headersTbl : tf.tbl; + var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); + var headerRow = tbl.rows[headerIndex]; + + //Tick all option + if (this.enableTickAll) { + var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); + _dom2.default.addClass(li, this.listItemCssClass); + ul.appendChild(li); + li.check.checked = !this.tickToHide; + + _event2.default.add(li.check, 'click', function () { + for (var h = 0; h < headerRow.cells.length; h++) { + var itm = _dom2.default.id('col_' + h + '_' + tf.id); + if (itm && li.check.checked !== itm.checked) { + itm.click(); + itm.checked = li.check.checked; + } + } + }); + } + + for (var i = 0; i < headerRow.cells.length; i++) { + var cell = headerRow.cells[i]; + var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); + var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); + _dom2.default.addClass(liElm, this.listItemCssClass); + if (!this.tickToHide) { + _dom2.default.addClass(liElm, this.listSlcItemCssClass); + } + ul.appendChild(liElm); + if (!this.tickToHide) { + liElm.check.checked = true; + } + + _event2.default.add(liElm.check, 'click', function (evt) { + var elm = _event2.default.target(evt); + var lbl = elm.parentNode; + _this2.checkItem(lbl); + }); + } + + //separator + var p = _dom2.default.create('p', ['align', 'center']); + var btn; + //Close link + if (!this.btnCloseHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCloseCssClass; + btn.innerHTML = this.btnCloseText; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + p.appendChild(btn); + } else { + p.innerHTML = this.btnCloseHtml; + btn = p.firstChild; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + } + + container.appendChild(ul); + container.appendChild(p); + + this.btnEl.parentNode.insertBefore(container, this.btnEl); + this.contEl = container; + + if (this.atStart) { + var a = this.atStart; + for (var k = 0; k < a.length; k++) { + var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); + if (itm) { + itm.click(); + } + } + } + } + + /** + * Hide or show specified columns + * @param {Numner} colIndex Column index + * @param {Boolean} hide hide column if true or show if false + */ + + }, { + key: 'setHidden', + value: function setHidden(colIndex, hide) { + var tf = this.tf; + var tbl = tf.tbl; + + if (this.onBeforeColHidden && hide) { + this.onBeforeColHidden.call(null, this, colIndex); + } + if (this.onBeforeColDisplayed && !hide) { + this.onBeforeColDisplayed.call(null, this, colIndex); + } + + this._hideCells(tbl, colIndex, hide); + if (this.headersTbl) { + this._hideCells(this.headersTbl, colIndex, hide); + } + + var hiddenCols = this.hiddenCols; + var itemIndex = hiddenCols.indexOf(colIndex); + if (hide) { + if (itemIndex === -1) { + this.hiddenCols.push(colIndex); + } + } else { + if (itemIndex !== -1) { + this.hiddenCols.splice(itemIndex, 1); + } + } + + var gridLayout; + var headTbl; + var gridColElms; + if (this.onAfterColHidden && hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); + + var headTblW = parseInt(headTbl.style.width, 10); + headTbl.style.width = headTblW - hiddenWidth + 'px'; + tbl.style.width = headTbl.style.width; + } + this.onAfterColHidden.call(null, this, colIndex); + } + + if (this.onAfterColDisplayed && !hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var width = parseInt(gridColElms[colIndex].style.width, 10); + headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; + tf.tbl.style.width = headTbl.style.width; + } + this.onAfterColDisplayed.call(null, this, colIndex); + } + } + + /** + * Show specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'showCol', + value: function showCol(colIndex) { + if (colIndex === undefined || !this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, false); + } + } + + /** + * Hide specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'hideCol', + value: function hideCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, true); + } + } + + /** + * Determine if specified column is hidden + * @param {Number} colIndex Column index + */ + + }, { + key: 'isColHidden', + value: function isColHidden(colIndex) { + if (this.hiddenCols.indexOf(colIndex) !== -1) { + return true; + } + return false; + } + + /** + * Toggle visibility of specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggleCol', + value: function toggleCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + this.showCol(colIndex); + } else { + this.hideCol(colIndex); + } + } + + /** + * Returns the indexes of the columns currently hidden + * @return {Array} column indexes + */ + + }, { + key: 'getHiddenCols', + value: function getHiddenCols() { + return this.hiddenCols; + } + + /** + * Remove the columns manager + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + if (_dom2.default.id(this.contElTgtId)) { + _dom2.default.id(this.contElTgtId).innerHTML = ''; + } else { + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + } + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + this.initialized = false; + } + }, { + key: '_getHeaderText', + value: function _getHeaderText(cell) { + if (!cell.hasChildNodes) { + return ''; + } + + for (var i = 0; i < cell.childNodes.length; i++) { + var n = cell.childNodes[i]; + if (n.nodeType === 3) { + return n.nodeValue; + } else if (n.nodeType === 1) { + if (n.id && n.id.indexOf('popUp') !== -1) { + continue; + } else { + return _dom2.default.getText(n); + } + } + continue; + } + return ''; + } + }, { + key: '_hideCells', + value: function _hideCells(tbl, colIndex, hide) { + for (var i = 0; i < tbl.rows.length; i++) { + var row = tbl.rows[i]; + var cell = row.cells[colIndex]; + if (cell) { + cell.style.display = hide ? 'none' : ''; + } + } + } + }]); + + return ColsVisibility; + })(); + + exports.default = ColsVisibility; + +/***/ }, + +/***/ 31: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var FiltersVisibility = (function () { + + /** + * Filters Row Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function FiltersVisibility(tf, f) { + _classCallCheck(this, FiltersVisibility); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Filters row visibility manager'; + + // Path and image filenames + this.stylesheet = f.stylesheet || 'filtersVisibility.css'; + this.icnExpand = f.expand_icon_name || 'icn_exp.png'; + this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; + + //expand/collapse filters span element + this.contEl = null; + //expand/collapse filters btn element + this.btnEl = null; + + this.icnExpandHtml = 'Expand filters'; + this.icnCollapseHtml = 'Collapse filters'; + this.defaultText = 'Toggle filters'; + + //id of container element + this.targetId = f.target_id || null; + //enables/disables expand/collapse icon + this.enableIcon = f.enable_icon === false ? false : true; + this.btnText = f.btn_text || ''; + + //defines expand/collapse filters text + this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; + this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; + + //defines expand/collapse filters button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for expand/collapse filters button + this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; + //defines css class span containing expand/collapse filters + this.contCssClass = f.cont_css_class || 'expClpFlt'; + this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); + + this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; + + // Prefix + this.prfx = 'fltsVis_'; + + //callback before filters row is shown + this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; + //callback after filters row is shown + this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; + //callback before filters row is hidden + this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; + //callback after filters row is hidden + this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + /** + * Initialise extension + */ + + _createClass(FiltersVisibility, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + this.buildUI(); + this.initialized = true; + } + + /** + * Build UI elements + */ + + }, { + key: 'buildUI', + value: function buildUI() { + var _this = this; + + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.contCssClass; + + //Container element (rdiv or custom element) + if (!this.targetId) { + tf.setToolbar(); + } + var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); + + if (!this.targetId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + var btn = undefined; + if (!this.btnHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); + btn.className = this.btnCssClass; + btn.title = this.btnText || this.defaultText; + btn.innerHTML = this.collapseBtnHtml; + span.appendChild(btn); + } else { + //Custom html + span.innerHTML = this.btnHtml; + btn = span.firstChild; + } + + _event2.default.add(btn, 'click', function () { + return _this.toggle(); + }); + + this.contEl = span; + this.btnEl = btn; + + if (!this.visibleAtStart) { + this.toggle(); + } + } + + /** + * Toggle filters visibility + */ + + }, { + key: 'toggle', + value: function toggle() { + var tf = this.tf; + var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; + var fltRow = tbl.rows[this.filtersRowIndex]; + var fltRowDisplay = fltRow.style.display; + + if (this.onBeforeShow && fltRowDisplay !== '') { + this.onBeforeShow.call(this, this); + } + if (this.onBeforeHide && fltRowDisplay === '') { + this.onBeforeHide.call(null, this); + } + + fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; + if (this.enableIcon && !this.btnHtml) { + this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; + } + + if (this.onAfterShow && fltRowDisplay !== '') { + this.onAfterShow.call(null, this); + } + if (this.onAfterHide && fltRowDisplay === '') { + this.onAfterHide.call(null, this); + } + } + + /** + * Destroy the UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + this.initialized = false; + } + }]); + + return FiltersVisibility; + })(); + + exports.default = FiltersVisibility; + +/***/ }, + +/***/ 32: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterSortableTable = (function () { + + /** + * SortableTable Adapter module + * @param {Object} tf TableFilter instance + */ + + function AdapterSortableTable(tf, opts) { + _classCallCheck(this, AdapterSortableTable); + + this.initialized = false; + this.name = opts.name; + this.desc = opts.description || 'Sortable table'; + + //indicates if tables was sorted + this.sorted = false; + + this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; + this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; + this.asyncSort = Boolean(opts.async_sort); + this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; + + // edit .sort-arrow.descending / .sort-arrow.ascending in + // tablefilter.css to reflect any path change + this.imgPath = opts.images_path || tf.themesPath; + this.imgBlank = opts.image_blank || 'blank.png'; + this.imgClassName = opts.image_class_name || 'sort-arrow'; + this.imgAscClassName = opts.image_asc_class_name || 'ascending'; + this.imgDescClassName = opts.image_desc_class_name || 'descending'; + //cell attribute storing custom key + this.customKey = opts.custom_key || 'data-tf-sortKey'; + + // callback invoked after sort is loaded and instanciated + this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; + // callback invoked before table is sorted + this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; + // callback invoked after table is sorted + this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(AdapterSortableTable, [{ + key: 'init', + value: function init() { + var tf = this.tf; + var adpt = this; + + // SortableTable class sanity check (sortabletable.js) + if (_types2.default.isUndef(SortableTable)) { + throw new Error('SortableTable class not found.'); + } + + this.overrideSortableTable(); + this.setSortTypes(); + + //Column sort at start + var sortColAtStart = adpt.sortColAtStart; + if (sortColAtStart) { + this.stt.sort(sortColAtStart[0], sortColAtStart[1]); + } + + if (this.onSortLoaded) { + this.onSortLoaded.call(null, tf, this); + } + + /*** SortableTable callbacks ***/ + this.stt.onbeforesort = function () { + if (adpt.onBeforeSort) { + adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); + } + + /*** sort behaviour for paging ***/ + if (tf.paging) { + tf.feature('paging').disable(); + } + }; + + this.stt.onsort = function () { + adpt.sorted = true; + + //sort behaviour for paging + if (tf.paging) { + var paginator = tf.feature('paging'); + // recalculate valid rows index as sorting may have change it + tf.getValidRows(true); + paginator.enable(); + paginator.setPage(paginator.getPage()); + } + + if (adpt.onAfterSort) { + adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); + } + + adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn); + }; + + this.initialized = true; + } + + /** + * Sort specified column + * @param {Number} colIdx Column index + * @param {Boolean} desc Optional: descending manner + */ + + }, { + key: 'sortByColumnIndex', + value: function sortByColumnIndex(colIdx, desc) { + this.stt.sort(colIdx, desc); + } + }, { + key: 'overrideSortableTable', + value: function overrideSortableTable() { + var adpt = this, + tf = this.tf; + + /** + * Overrides headerOnclick method in order to handle th event + * @param {Object} e [description] + */ + SortableTable.prototype.headerOnclick = function (evt) { + if (!adpt.initialized) { + return; + } + + // find Header element + var el = evt.target || evt.srcElement; + + while (el.tagName !== 'TD' && el.tagName !== 'TH') { + el = el.parentNode; + } + + this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); + }; + + /** + * Overrides getCellIndex IE returns wrong cellIndex when columns are + * hidden + * @param {Object} oTd TD element + * @return {Number} Cell index + */ + SortableTable.getCellIndex = function (oTd) { + var cells = oTd.parentNode.cells, + l = cells.length, + i = undefined; + for (i = 0; cells[i] != oTd && i < l; i++) {} + return i; + }; + + /** + * Overrides initHeader in order to handle filters row position + * @param {Array} oSortTypes + */ + SortableTable.prototype.initHeader = function (oSortTypes) { + var stt = this; + if (!stt.tHead) { + if (tf.gridLayout) { + stt.tHead = tf.feature('gridLayout').headTbl.tHead; + } else { + return; + } + } + + stt.headersRow = tf.headersRow; + var cells = stt.tHead.rows[stt.headersRow].cells; + stt.sortTypes = oSortTypes || []; + var l = cells.length; + var img = undefined, + c = undefined; + + for (var i = 0; i < l; i++) { + c = cells[i]; + if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { + c.style.cursor = 'pointer'; + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + c.appendChild(img); + if (stt.sortTypes[i] !== null) { + c.setAttribute('_sortType', stt.sortTypes[i]); + } + _event2.default.add(c, 'click', stt._headerOnclick); + } else { + c.setAttribute('_sortType', oSortTypes[i]); + c._sortType = 'None'; + } + } + stt.updateHeaderArrows(); + }; + + /** + * Overrides updateHeaderArrows in order to handle arrows indicators + */ + SortableTable.prototype.updateHeaderArrows = function () { + var stt = this; + var cells = undefined, + l = undefined, + img = undefined; + + // external headers + if (adpt.asyncSort && adpt.triggerIds.length > 0) { + var triggers = adpt.triggerIds; + cells = []; + l = triggers.length; + for (var j = 0; j < triggers.length; j++) { + cells.push(_dom2.default.id(triggers[j])); + } + } else { + if (!this.tHead) { + return; + } + cells = stt.tHead.rows[stt.headersRow].cells; + l = cells.length; + } + for (var i = 0; i < l; i++) { + var cellAttr = cells[i].getAttribute('_sortType'); + if (cellAttr !== null && cellAttr !== 'None') { + img = cells[i].lastChild || cells[i]; + if (img.nodeName.toLowerCase() !== 'img') { + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + cells[i].appendChild(img); + } + if (i === stt.sortColumn) { + img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); + } else { + img.className = adpt.imgClassName; + } + } + } + }; + + /** + * Overrides getRowValue for custom key value feature + * @param {Object} oRow Row element + * @param {String} sType + * @param {Number} nColumn + * @return {String} + */ + SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { + var stt = this; + // if we have defined a custom getRowValue use that + var sortTypeInfo = stt._sortTypeInfo[sType]; + if (sortTypeInfo && sortTypeInfo.getRowValue) { + return sortTypeInfo.getRowValue(oRow, nColumn); + } + var c = oRow.cells[nColumn]; + var s = SortableTable.getInnerText(c); + return stt.getValueFromString(s, sType); + }; + + /** + * Overrides getInnerText in order to avoid Firefox unexpected sorting + * behaviour with untrimmed text elements + * @param {Object} oNode DOM element + * @return {String} DOM element inner text + */ + SortableTable.getInnerText = function (oNode) { + if (!oNode) { + return; + } + if (oNode.getAttribute(adpt.customKey)) { + return oNode.getAttribute(adpt.customKey); + } else { + return _dom2.default.getText(oNode); + } + }; + } + }, { + key: 'addSortType', + value: function addSortType() { + var args = arguments; + SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); + } + }, { + key: 'setSortTypes', + value: function setSortTypes() { + var _this = this; + + var tf = this.tf, + sortTypes = this.sortTypes, + _sortTypes = []; + + for (var i = 0; i < tf.nbCells; i++) { + var colType = undefined; + + if (sortTypes[i]) { + colType = sortTypes[i].toLowerCase(); + if (colType === 'none') { + colType = 'None'; + } + } else { + // resolve column types + if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { + colType = tf.colNbFormat[i].toLowerCase(); + } else if (tf.hasColDateType && tf.colDateType[i] !== null) { + colType = tf.colDateType[i].toLowerCase() + 'date'; + } else { + colType = 'String'; + } + } + _sortTypes.push(colType); + } + + //Public TF method to add sort type + + //Custom sort types + this.addSortType('number', Number); + this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); + this.addSortType('date', SortableTable.toDate); + this.addSortType('string'); + this.addSortType('us', usNumberConverter); + this.addSortType('eu', euNumberConverter); + this.addSortType('dmydate', dmyDateConverter); + this.addSortType('ymddate', ymdDateConverter); + this.addSortType('mdydate', mdyDateConverter); + this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); + this.addSortType('ipaddress', ipAddress, sortIP); + + this.stt = new SortableTable(tf.tbl, _sortTypes); + + /*** external table headers adapter ***/ + if (this.asyncSort && this.triggerIds.length > 0) { + (function () { + var triggers = _this.triggerIds; + for (var j = 0; j < triggers.length; j++) { + if (triggers[j] === null) { + continue; + } + var trigger = _dom2.default.id(triggers[j]); + if (trigger) { + trigger.style.cursor = 'pointer'; + + _event2.default.add(trigger, 'click', function (evt) { + var elm = evt.target; + if (!_this.tf.sort) { + return; + } + _this.stt.asyncSort(triggers.indexOf(elm.id)); + }); + trigger.setAttribute('_sortType', _sortTypes[j]); + } + } + })(); + } + } + + /** + * Destroy sort + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + this.sorted = false; + this.initialized = false; + this.stt.destroy(); + + var ids = tf.getFiltersId(); + for (var idx = 0; idx < ids.length; idx++) { + var header = tf.getHeaderElement(idx); + var img = _dom2.default.tag(header, 'img'); + + if (img.length === 1) { + header.removeChild(img[0]); + } + } + } + }]); + + return AdapterSortableTable; + })(); + + //Converters + + exports.default = AdapterSortableTable; + function usNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'us'); + } + function euNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'eu'); + } + function dateConverter(s, format) { + return _date2.default.format(s, format); + } + function dmyDateConverter(s) { + return dateConverter(s, 'DMY'); + } + function mdyDateConverter(s) { + return dateConverter(s, 'MDY'); + } + function ymdDateConverter(s) { + return dateConverter(s, 'YMD'); + } + function ddmmmyyyyDateConverter(s) { + return dateConverter(s, 'DDMMMYYYY'); + } + + function ipAddress(value) { + var vals = value.split('.'); + for (var x in vals) { + var val = vals[x]; + while (3 > val.length) { + val = '0' + val; + } + vals[x] = val; + } + return vals.join('.'); + } + + function sortIP(a, b) { + var aa = ipAddress(a.value.toLowerCase()); + var bb = ipAddress(b.value.toLowerCase()); + if (aa == bb) { + return 0; + } else if (aa < bb) { + return -1; + } else { + return 1; + } + } + +/***/ }, + +/***/ 33: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterSortabletable = __webpack_require__(32); + + var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + if (!window.SortableTable) { + __webpack_require__(34); + } // import 'script!sortabletable'; + + exports.default = _adapterSortabletable2.default; + +/***/ }, + +/***/ 34: +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") + +/***/ }, + +/***/ 35: +/***/ function(module, exports) { + + /* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra + */ + module.exports = function(src) { + if (typeof execScript === "function") + execScript(src); + else + eval.call(null, src); + } + +/***/ }, + +/***/ 36: +/***/ function(module, exports) { + + module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" + +/***/ } + +}); +//# sourceMappingURL=tf-1.js.map \ No newline at end of file diff --git a/src/modules/checkList.js b/src/modules/checkList.js index 9e4f9a3c..f073d36b 100644 --- a/src/modules/checkList.js +++ b/src/modules/checkList.js @@ -1,18 +1,21 @@ +import {Feature} from './feature'; import Dom from '../dom'; import Arr from '../array'; import Str from '../string'; import Sort from '../sort'; import Event from '../event'; -export class CheckList{ +export class CheckList extends Feature{ /** * Checklist UI component * @param {Object} tf TableFilter instance */ constructor(tf){ + super(tf, 'checkList'); + // Configuration object - var f = tf.config(); + let f = tf.config(); this.checkListDiv = []; //checklist container div //defines css class for div containing checklist filter @@ -42,9 +45,6 @@ export class CheckList{ this.opts = null; this.optsTxt = null; this.excludedOpts = null; - - this.tf = tf; - this.emitter = tf.emitter; } // TODO: move event here @@ -60,6 +60,53 @@ export class CheckList{ this.onChange(evt); } + onCheckListClick(evt){ + let elm = Event.target(evt); + if(this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0'){ + let ct = elm.getAttribute('ct'); + let div = this.checkListDiv[ct]; + this.build(ct); + Event.remove(div, 'click', (evt)=> this.onCheckListClick(evt)); + } + } + + /** + * Initialize checklist filter + * @param {Number} colIndex Column index + * @param {Boolean} isExternal External filter flag + * @param {DOMElement} container Dom element containing the filter + */ + init(colIndex, isExternal, container){ + let tf = this.tf; + let externalFltTgtId = isExternal ? + tf.externalFltTgtIds[colIndex] : null; + + let divCont = Dom.create('div', + ['id', this.prfxCheckListDiv+colIndex+'_'+tf.id], + ['ct', colIndex], ['filled', '0']); + divCont.className = this.checkListDivCssClass; + + //filter is appended in desired element + if(externalFltTgtId){ + Dom.id(externalFltTgtId).appendChild(divCont); + tf.externalFltEls.push(divCont); + } else { + container.appendChild(divCont); + } + + this.checkListDiv[colIndex] = divCont; + tf.fltIds.push(tf.prfxFlt+colIndex+'_'+tf.id); + + if(!tf.loadFltOnDemand){ + this.build(colIndex); + } else { + Event.add(divCont, 'click', (evt)=> this.onCheckListClick(evt)); + divCont.appendChild(Dom.text(this.activateCheckListTxt)); + } + + this.initialized = true; + } + /** * Build checklist UI * @param {Number} colIndex Column index @@ -67,7 +114,7 @@ export class CheckList{ * @param {String} extFltId External container id */ build(colIndex, isExternal=false, extFltId=null){ - var tf = this.tf; + let tf = this.tf; colIndex = parseInt(colIndex, 10); this.emitter.emit('before-populating-filter', tf, colIndex); @@ -75,41 +122,41 @@ export class CheckList{ this.opts = []; this.optsTxt = []; - var divFltId = this.prfxCheckListDiv+colIndex+'_'+tf.id; + let divFltId = this.prfxCheckListDiv+colIndex+'_'+tf.id; if((!Dom.id(divFltId) && !isExternal) || (!Dom.id(extFltId) && isExternal)){ return; } - var flt = !isExternal ? this.checkListDiv[colIndex] : Dom.id(extFltId); - var ul = Dom.create( + let flt = !isExternal ? this.checkListDiv[colIndex] : Dom.id(extFltId); + let ul = Dom.create( 'ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); ul.className = this.checkListCssClass; Event.add(ul, 'change', (evt) => { this.onChange(evt); }); - var rows = tf.tbl.rows; + let rows = tf.tbl.rows; this.isCustom = tf.isCustomOptions(colIndex); - var activeFlt; + let activeFlt; if(tf.linkedFilters && tf.activeFilterId){ activeFlt = tf.activeFilterId.split('_')[0]; activeFlt = activeFlt.split(tf.prfxFlt)[1]; } - var filteredDataCol = []; + let filteredDataCol = []; if(tf.linkedFilters && tf.disableExcludedOptions){ this.excludedOpts = []; } - for(var k=tf.refRow; k 0){ if(tf.hasCustomSlcOptions && @@ -241,10 +288,10 @@ export class CheckList{ } } - for(var y=0; y' + lbl+''; } else { - var opt; + let opt; //fill select on demand if(tf.loadFltOnDemand && slcValue===this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc){ @@ -298,7 +348,7 @@ export class Dropdown{ * @param {Object} slc Select DOM element */ addFirstOption(slc){ - var tf = this.tf, + let tf = this.tf, fillMethod = Str.lower(this.slcFillingMethod); if(fillMethod === 'innerhtml'){ @@ -306,22 +356,23 @@ export class Dropdown{ ''; } else { - var opt0 = Dom.createOpt( + let opt0 = Dom.createOpt( (!this.enableSlcResetFilter ? '' : tf.displayAllText),''); if(!this.enableSlcResetFilter){ opt0.style.display = 'none'; } slc.appendChild(opt0); if(tf.enableEmptyOption){ - var opt1 = Dom.createOpt(tf.emptyText, tf.emOperator); + let opt1 = Dom.createOpt(tf.emptyText, tf.emOperator); slc.appendChild(opt1); } if(tf.enableNonEmptyOption){ - var opt2 = Dom.createOpt(tf.nonEmptyText, tf.nmOperator); + let opt2 = Dom.createOpt(tf.nonEmptyText, tf.nmOperator); slc.appendChild(opt2); } } return slc; } + destroy(){} } diff --git a/src/modules/popupFilter.js b/src/modules/popupFilter.js index 72927392..fb8dc033 100644 --- a/src/modules/popupFilter.js +++ b/src/modules/popupFilter.js @@ -15,7 +15,7 @@ export class PopupFilter extends Feature{ // Configuration object var f = this.config; - // Enable external filters behaviour + // Enable external filters tf.isExternalFlt = true; tf.externalFltTgtIds = []; @@ -113,6 +113,8 @@ export class PopupFilter extends Feature{ this.emitter.on(['cell-processed'], (tf, cellIndex)=> this.buildIcon(cellIndex, true)); this.emitter.on(['filters-row-inserted'], ()=> this.tf.headersRow++); + this.emitter.on(['before-filter-init'], + (tf, colIndex)=> this.build(colIndex)); this.initialized = true; } @@ -265,6 +267,8 @@ export class PopupFilter extends Feature{ this.emitter.off(['cell-processed'], (tf, cellIndex)=> this.buildIcon(cellIndex, true)); this.emitter.off(['filters-row-inserted'], ()=> this.tf.headersRow++); + this.emitter.off(['before-filter-init'], + (tf, colIndex)=> this.build(colIndex)); this.initialized = false; } diff --git a/src/tablefilter.js b/src/tablefilter.js index 380102d9..22e88d58 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -209,7 +209,7 @@ export class TableFilter { //enables/disables external filters generation this.isExternalFlt = Boolean(f.external_flt_grid); //array containing ids of external elements containing filters - this.externalFltTgtIds = f.external_flt_grid_ids || null; + this.externalFltTgtIds = f.external_flt_grid_ids || []; //stores filters elements if isExternalFlt is true this.externalFltEls = []; //delays any filtering process if loader true @@ -541,7 +541,7 @@ export class TableFilter { let _ev = e || global.event; if(this.popupFilters){ Event.stop(_ev); } if(this.onSlcChange){ this.filter(); } - }, + }/*, // fill checklist filter on click if required onCheckListClick(e) { let _ev = e || global.event; @@ -552,7 +552,7 @@ export class TableFilter { this.Mod.checkList.checkListDiv[ct].onclick = null; this.Mod.checkList.checkListDiv[ct].title = ''; } - } + }*/ }; } @@ -651,16 +651,17 @@ export class TableFilter { this.nbVisibleRows = this.nbFilterableRows; this.nbRows = this.tbl.rows.length; - for(let i=0; i this.filter()); }//if + this.emitter.emit('after-filter-init', this, i); }// for i } else { @@ -1253,7 +1261,7 @@ export class TableFilter { * Remove all the external column filters */ removeExternalFlts(){ - if(!this.isExternalFlt || !this.externalFltTgtIds){ + if(!this.isExternalFlt){ return; } let ids = this.externalFltTgtIds, From 4a7f935272ad83c98454e256dab00be711d46729 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Fri, 8 Jan 2016 17:44:22 +1100 Subject: [PATCH 19/41] Added the _buildInputFilter method --- dist/starter.html | 514 ------------------ dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 196 +++++-- src/modules/checkList.js | 24 +- src/modules/dropdown.js | 24 +- src/tablefilter.js | 145 +++-- test/test-popup-filter.js | 16 +- 12 files changed, 280 insertions(+), 651 deletions(-) delete mode 100644 dist/starter.html diff --git a/dist/starter.html b/dist/starter.html deleted file mode 100644 index b59dfa1e..00000000 --- a/dist/starter.html +++ /dev/null @@ -1,514 +0,0 @@ - - - - tablefilter v0.1.5 - Starter - - -

tablefilter v0.1.5

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
countryisoyearPOPXRATPPPcgdpccci
BeninBEN19985950.33589.9517822190.951178.4690.987.55
BeninBEN19996109.53615.6990967200.191174.9092.617.86
BeninBEN20006272.00711.9763184200.611224.7492.278.25
Burkina FasoBFA19949755.03555.2047119125.76838.7679.816.57
Burkina FasoBFA19959988.00499.148407136.65860.8980.419.29
Burkina FasoBFA199610225.00511.5523987144.18881.1180.4012.12
Burkina FasoBFA199710473.53583.6693726141.78899.0176.9414.94
RussiaRUS1998146899.019.7050828932.647086.3967.739.20
RussiaRUS1999146308.9924.61993984.038074.7057.358.81
RussiaRUS2000145555.0128.129169464.859995.9154.748.79
RwandaRWA19946230.00194.51750.39529.48132.164.48
RwandaRWA19956400.00262.197509870.67746.3492.773.08
RwandaRWA19966727.00306.820007377.90823.2589.713.21
RwandaRWA19977895.18301.529785284.13847.7991.443.72
RwandaRWA19988105.00312.314086985.32914.2289.344.22
El SalvadorSLV19955669.008.7545833593.544143.5989.3110.35
El SalvadorSLV19965798.008.7550001143.694235.7988.777.79
El SalvadorSLV19975911.008.7562503813.744408.4187.057.90
Slovak RepublicSVK20005401.0046.035213.0212618.5352.2224.78
SloveniaSVN19941988.90128.808593879.9711662.1253.2119.87
SloveniaSVN19951990.00118.518501389.0312574.9654.4623.11
SloveniaSVN19961991.00135.364303697.2713151.5154.3223.23
SloveniaSVN19971985.96159.6882935103.9614143.0253.2424.14
SloveniaSVN19981982.60166.134201108.9315067.3452.8225.35
ZambiaZMB19948740.72669.3706055307.48834.1975.439.86
ZambiaZMB19958980.00864.1192017402.40829.3776.5510.31
ZambiaZMB19969214.401207.900024515.01838.0578.7410.99
ZambiaZMB19979443.211314.498047596.97851.4777.5912.15
ZambiaZMB19989665.711862.06897744.91800.6985.1213.75
ZambiaZMB19999881.212388.019043941.87765.2491.8215.30
ZambiaZMB200010089.003110.8439941157.63840.9786.3315.38
ZimbabweZWE199410775.358.1515388492.012586.8460.1018.53
ZimbabweZWE199511011.008.665375712.152603.3766.8915.03
ZimbabweZWE199611242.1610.002349852.642860.2372.0611.32
ZimbabweZWE199711923.5212.111289983.172727.0682.8211.01
ZimbabweZWE199812153.8523.679109574.062799.8577.6610.75
ZimbabweZWE199912388.3238.301200876.122770.4876.8910.73
ZimbabweZWE200012627.0044.417919169.482607.0369.238.62
- - - - - - -

-
-
-
-
-
-
-
-
-
diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index 32a0cc1c..5eaa7dc9 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-06T05:07:26.429Z 
+ *	 build date: 2016-01-08T05:07:53.560Z 
  *	 MIT License  
  */ 
 span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
\ No newline at end of file
diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css
index 38f65843..114c238a 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-06T05:07:26.429Z 
+ *	 build date: 2016-01-08T05:07:53.560Z 
  *	 MIT License  
  */ 
 span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
\ No newline at end of file
diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css
index 1c396d27..6cb4d24c 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-06T05:07:26.429Z 
+ *	 build date: 2016-01-08T05:07:53.560Z 
  *	 MIT License  
  */ 
 .activeHeader{background-color:#66afe9 !important;color:#fff !important}
diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css
index 4cf783f2..a9c01255 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-06T05:07:26.429Z 
+ *	 build date: 2016-01-08T05:07:53.560Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css
index 6cdd9cdb..916aaae7 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-06T05:07:26.429Z 
+ *	 build date: 2016-01-08T05:07:53.560Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css
index 50f88c01..6a403440 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-06T05:07:26.429Z 
+ *	 build date: 2016-01-08T05:07:53.560Z 
  *	 MIT License  
  */ 
 table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
index 845e404d..d24bd4d9 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -741,9 +741,9 @@ return /******/ (function(modules) { // webpackBootstrap
 	            if (this._hasGrid) {
 	                return;
 	            }
-	            if (!this.tbl) {
-	                this.tbl = _dom2.default.id(this.id);
-	            }
+	            // if(!this.tbl){
+	            //     this.tbl = Dom.id(this.id);
+	            // }
 	            // if(this.gridLayout){
 	            //     this.refRow = this.startRow===null ? 0 : this.startRow;
 	            // }
@@ -938,36 +938,48 @@ return /******/ (function(modules) { // webpackBootstrap
 	                                //         Dom.text(checkList.activateCheckListTxt));
 	                                // }
 	                            } else {
+	                                    this._buildInputFilter(i, inpclass, fltcell);
 	                                    //show/hide input
-	                                    var inptype = col === this.fltTypeInp ? 'text' : 'hidden';
-	                                    var inp = _dom2.default.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;
-	                                    _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this));
+	                                    //let inptype = col===this.fltTypeInp ? 'text' :
+	                                    //'hidden';
+	                                    // let 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;
+	                                    //Event.add(inp, 'focus',
+	                                    //this.Evt.onInpFocus.bind(this));
 	
-	                                    //filter is appended in desired element
-	                                    if (externalFltTgtId) {
-	                                        _dom2.default.id(externalFltTgtId).appendChild(inp);
-	                                        this.externalFltEls.push(inp);
-	                                    } else {
-	                                        fltcell.appendChild(inp);
-	                                    }
+	                                    // //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);
+	                                    // this.fltIds.push(this.prfxFlt+i+'_'+this.id);
 	
-	                                    _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this));
-	                                    _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this));
-	                                    _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this));
-	                                    _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this));
+	                                    // Event.add(inp, 'keypress',
+	                                    //     this.Evt.detectKey.bind(this));
+	                                    // Event.add(inp, 'keydown',
+	                                    //     this.Evt.onKeyDown.bind(this));
+	                                    // Event.add(inp, 'keyup', this.Evt.onKeyUp.bind(this));
+	                                    //Event.add(inp, 'blur', this.Evt.onInpBlur.bind(this));
 	
-	                                    if (this.rememberGridValues) {
-	                                        var flts_values = this.Mod.store.getFilterValues(this.fltsValuesCookie);
-	                                        if (flts_values[i] != ' ') {
-	                                            this.setFilterValue(i, flts_values[i], false);
-	                                        }
-	                                    }
+	                                    // if(this.rememberGridValues){
+	                                    //     let flts_values = this.Mod.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) {
@@ -1121,6 +1133,42 @@ return /******/ (function(modules) { // webpackBootstrap
 	            this.nbVisibleRows = this.nbFilterableRows;
 	            this.nbRows = this.nbFilterableRows + this.refRow;
 	        }
+	    }, {
+	        key: '_buildInputFilter',
+	        value: function _buildInputFilter(colIndex, cssClass, container) {
+	            var col = this.getFilterType(colIndex);
+	            var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null;
+	            var inptype = col === this.fltTypeInp ? 'text' : 'hidden';
+	            var inp = _dom2.default.create(this.fltTypeInp, ['id', this.prfxFlt + colIndex + '_' + this.id], ['type', inptype], ['ct', colIndex]);
+	            if (inptype !== 'hidden' && this.watermark) {
+	                inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark);
+	            }
+	            inp.className = cssClass || this.fltCssClass;
+	            _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this));
+	
+	            //filter is appended in desired element
+	            if (externalFltTgtId) {
+	                _dom2.default.id(externalFltTgtId).appendChild(inp);
+	                this.externalFltEls.push(inp);
+	            } else {
+	                container.appendChild(inp);
+	            }
+	
+	            this.fltIds.push( /*this.prfxFlt+i+'_'+this.id*/inp.id);
+	
+	            _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this));
+	            _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this));
+	            _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this));
+	            _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this));
+	
+	            // if(this.rememberGridValues){
+	            //     let fltValues = this.Mod.store.getFilterValues(
+	            //         this.fltsValuesCookie);
+	            //     if(fltValues[colIndex]!=' '){
+	            //         this.setFilterValue(colIndex, fltValues[colIndex], false);
+	            //     }
+	            // }
+	        }
 	
 	        /**
 	         * Return a feature instance for a given name
@@ -1375,7 +1423,7 @@ return /******/ (function(modules) { // webpackBootstrap
 	            this.validRowsIndex = [];
 	            this.activeFlt = null;
 	            this._hasGrid = false;
-	            this.tbl = null;
+	            // this.tbl = null;
 	        }
 	
 	        /**
@@ -1541,9 +1589,20 @@ return /******/ (function(modules) { // webpackBootstrap
 	    }, {
 	        key: 'resetValues',
 	        value: function resetValues() {
+	            var _this5 = this;
+	
 	            //only loadFltOnDemand
-	            if (this.rememberGridValues && this.loadFltOnDemand) {
-	                this._resetGridValues(this.fltsValuesCookie);
+	            if (this.rememberGridValues) {
+	                if (this.loadFltOnDemand) {
+	                    this._resetGridValues(this.fltsValuesCookie);
+	                } else {
+	                    var fltValues = this.Mod.store.getFilterValues(this.fltsValuesCookie);
+	                    fltValues.forEach(function (val, idx) {
+	                        if (val !== ' ') {
+	                            _this5.setFilterValue(idx, val);
+	                        }
+	                    });
+	                }
 	            }
 	            this.filter();
 	        }
@@ -1624,6 +1683,8 @@ return /******/ (function(modules) { // webpackBootstrap
 	                                checkList.setCheckListValues(li.check);
 	                                this.hasStoredValues = true;
 	                            }
+	                        } else if (fltType === this.fltTypeInp) {
+	                            this.setFilterValue(i, fltsValues[i]);
 	                        }
 	                } //end for
 	
@@ -2190,6 +2251,7 @@ return /******/ (function(modules) { // webpackBootstrap
 	         *     [rowIndex, [value0, value1...]]
 	         * ]
 	         * @param  {Boolean} includeHeaders  Optional: include headers row
+	         * @param  {Boolean} excludeHiddenCols  Optional: exclude hidden columns
 	         * @return {Array}
 	         *
 	         * TODO: provide an API returning data in JSON format
@@ -2199,16 +2261,23 @@ return /******/ (function(modules) { // webpackBootstrap
 	        key: 'getTableData',
 	        value: function getTableData() {
 	            var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
+	            var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
 	
 	            var rows = this.tbl.rows;
 	            var tblData = [];
 	            if (includeHeaders) {
-	                tblData.push([this.getHeadersRowIndex(), this.getHeadersText()]);
+	                var headers = this.getHeadersText(excludeHiddenCols);
+	                tblData.push([this.getHeadersRowIndex(), headers]);
 	            }
 	            for (var k = this.refRow; k < this.nbRows; k++) {
 	                var rowData = [k, []];
 	                var cells = rows[k].cells;
 	                for (var j = 0, len = cells.length; j < len; j++) {
+	                    if (excludeHiddenCols && this.hasExtension('colsVisibility')) {
+	                        if (this.extension('colsVisibility').isColHidden(j)) {
+	                            continue;
+	                        }
+	                    }
 	                    var cellData = this.getCellData(cells[j]);
 	                    rowData[1].push(cellData);
 	                }
@@ -2224,6 +2293,7 @@ return /******/ (function(modules) { // webpackBootstrap
 	         *     [rowIndex, [value0, value1...]]
 	         * ]
 	         * @param  {Boolean} includeHeaders  Optional: include headers row
+	         * @param  {Boolean} excludeHiddenCols  Optional: exclude hidden columns
 	         * @return {Array}
 	         *
 	         * TODO: provide an API returning data in JSON format
@@ -2233,6 +2303,7 @@ return /******/ (function(modules) { // webpackBootstrap
 	        key: 'getFilteredData',
 	        value: function getFilteredData() {
 	            var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
+	            var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
 	
 	            if (!this.validRowsIndex) {
 	                return [];
@@ -2240,7 +2311,8 @@ return /******/ (function(modules) { // webpackBootstrap
 	            var rows = this.tbl.rows,
 	                filteredData = [];
 	            if (includeHeaders) {
-	                filteredData.push([this.getHeadersRowIndex(), this.getHeadersText()]);
+	                var headers = this.getHeadersText(excludeHiddenCols);
+	                filteredData.push([this.getHeadersRowIndex(), headers]);
 	            }
 	
 	            var validRows = this.getValidRows(true);
@@ -2248,6 +2320,11 @@ return /******/ (function(modules) { // webpackBootstrap
 	                var rData = [this.validRowsIndex[i], []],
 	                    cells = rows[this.validRowsIndex[i]].cells;
 	                for (var k = 0; k < cells.length; k++) {
+	                    if (excludeHiddenCols && this.hasExtension('colsVisibility')) {
+	                        if (this.extension('colsVisibility').isColHidden(k)) {
+	                            continue;
+	                        }
+	                    }
 	                    var cellData = this.getCellData(cells[k]);
 	                    rData[1].push(cellData);
 	                }
@@ -2890,14 +2967,22 @@ return /******/ (function(modules) { // webpackBootstrap
 	
 	        /**
 	         * Return the list of headers' text
+	         * @param  {Boolean} excludeHiddenCols  Optional: exclude hidden columns
 	         * @return {Array} list of headers' text
 	         */
 	
 	    }, {
 	        key: 'getHeadersText',
 	        value: function getHeadersText() {
+	            var excludeHiddenCols = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
+	
 	            var headers = [];
 	            for (var j = 0; j < this.nbCells; j++) {
+	                if (excludeHiddenCols && this.hasExtension('colsVisibility')) {
+	                    if (this.extension('colsVisibility').isColHidden(j)) {
+	                        continue;
+	                    }
+	                }
 	                var header = this.getHeaderElement(j);
 	                var headerText = _dom2.default.getText(header);
 	                headers.push(headerText);
@@ -5146,16 +5231,17 @@ return /******/ (function(modules) { // webpackBootstrap
 	            /*** remember grid values ***/
 	            var fltsValues = [],
 	                fltArr = [];
-	            if (tf.rememberGridValues) {
-	                fltsValues = tf.feature('store').getFilterValues(tf.fltsValuesCookie);
-	                if (fltsValues && !_string2.default.isEmpty(fltsValues.toString())) {
-	                    if (this.isCustom) {
-	                        fltArr.push(fltsValues[colIndex]);
-	                    } else {
-	                        fltArr = fltsValues[colIndex].split(' ' + tf.orOperator + ' ');
-	                    }
-	                }
-	            }
+	            // if(tf.rememberGridValues){
+	            //     fltsValues = tf.feature('store').getFilterValues(
+	            //         tf.fltsValuesCookie);
+	            //     if(fltsValues && !Str.isEmpty(fltsValues.toString())){
+	            //         if(this.isCustom){
+	            //             fltArr.push(fltsValues[colIndex]);
+	            //         } else {
+	            //           fltArr = fltsValues[colIndex].split(' '+tf.orOperator+' ');
+	            //         }
+	            //     }
+	            // }
 	
 	            var excludedOpts = null,
 	                filteredDataCol = null;
@@ -5271,7 +5357,7 @@ return /******/ (function(modules) { // webpackBootstrap
 	            //populates drop-down
 	            this.addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr);
 	
-	            this.emitter.emit('after-populating-filter', tf, colIndex);
+	            this.emitter.emit('after-populating-filter', tf, colIndex, slc);
 	        }
 	
 	        /**
@@ -5712,7 +5798,7 @@ return /******/ (function(modules) { // webpackBootstrap
 	            flt.appendChild(ul);
 	            flt.setAttribute('filled', '1');
 	
-	            this.emitter.emit('after-populating-filter', tf, colIndex);
+	            this.emitter.emit('after-populating-filter', tf, colIndex, flt);
 	        }
 	
 	        /**
@@ -5729,15 +5815,17 @@ return /******/ (function(modules) { // webpackBootstrap
 	            var tf = this.tf;
 	            var chkCt = this.addTChecks(colIndex, ul);
 	            var fltArr = []; //remember grid values
-	            var store = tf.feature('store');
-	            var tmpVal = store ? store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null;
-	            if (tmpVal && _string2.default.trim(tmpVal).length > 0) {
-	                if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1) {
-	                    fltArr.push(tmpVal);
-	                } else {
-	                    fltArr = tmpVal.split(' ' + tf.orOperator + ' ');
-	                }
-	            }
+	            // let store = tf.feature('store');
+	            // let tmpVal = store ?
+	            //         store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null;
+	            // if(tmpVal && Str.trim(tmpVal).length > 0){
+	            //     if(tf.hasCustomSlcOptions &&
+	            //         tf.customSlcOptions.cols.indexOf(colIndex) != -1){
+	            //         fltArr.push(tmpVal);
+	            //     } else {
+	            //         fltArr = tmpVal.split(' '+tf.orOperator+' ');
+	            //     }
+	            // }
 	
 	            for (var y = 0; y < this.opts.length; y++) {
 	                var val = this.opts[y]; //item value
diff --git a/src/modules/checkList.js b/src/modules/checkList.js
index f073d36b..0d0174de 100644
--- a/src/modules/checkList.js
+++ b/src/modules/checkList.js
@@ -264,7 +264,7 @@ export class CheckList extends Feature{
         flt.appendChild(ul);
         flt.setAttribute('filled', '1');
 
-        this.emitter.emit('after-populating-filter', tf, colIndex);
+        this.emitter.emit('after-populating-filter', tf, colIndex, flt);
     }
 
     /**
@@ -276,17 +276,17 @@ export class CheckList extends Feature{
         let tf = this.tf;
         let chkCt = this.addTChecks(colIndex, ul);
         let fltArr = []; //remember grid values
-        let store = tf.feature('store');
-        let tmpVal = store ?
-                store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null;
-        if(tmpVal && Str.trim(tmpVal).length > 0){
-            if(tf.hasCustomSlcOptions &&
-                tf.customSlcOptions.cols.indexOf(colIndex) != -1){
-                fltArr.push(tmpVal);
-            } else {
-                fltArr = tmpVal.split(' '+tf.orOperator+' ');
-            }
-        }
+        // let store = tf.feature('store');
+        // let tmpVal = store ?
+        //         store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null;
+        // if(tmpVal && Str.trim(tmpVal).length > 0){
+        //     if(tf.hasCustomSlcOptions &&
+        //         tf.customSlcOptions.cols.indexOf(colIndex) != -1){
+        //         fltArr.push(tmpVal);
+        //     } else {
+        //         fltArr = tmpVal.split(' '+tf.orOperator+' ');
+        //     }
+        // }
 
         for(let y=0; y {
+                    if(val !== ' '){
+                        this.setFilterValue(idx, val);
+                    }
+                });
+            }
         }
         this.filter();
     }
@@ -1359,7 +1411,7 @@ export class TableFilter {
 
                     //selects
                     if(slcFltsIndex.indexOf(i) != -1){
-                        opt = Dom.createOpt(fltsValues[i],fltsValues[i],true);
+                        opt = Dom.createOpt(fltsValues[i], fltsValues[i], true);
                         slc.appendChild(opt);
                         this.hasStoredValues = true;
                     }
@@ -1376,7 +1428,7 @@ export class TableFilter {
                         }
                     }// if multiFltsIndex
                 }
-                else if(fltType===this.fltTypeCheckList){
+                else if(fltType === this.fltTypeCheckList){
                     let checkList = this.Mod.checkList;
                     let divChk = checkList.checkListDiv[i];
                     divChk.title = divChk.innerHTML;
@@ -1407,6 +1459,9 @@ export class TableFilter {
                         this.hasStoredValues = true;
                     }
                 }
+                else if(fltType === this.fltTypeInp){
+                    this.setFilterValue(i, fltsValues[i]);
+                }
             }//end for
 
             if(!this.hasStoredValues && this.paging){
diff --git a/test/test-popup-filter.js b/test/test-popup-filter.js
index f6031440..366c85c9 100644
--- a/test/test-popup-filter.js
+++ b/test/test-popup-filter.js
@@ -160,11 +160,11 @@ test('Properties', function() {
         'function', 'Feature enable method');
 });
 
-// module('Tear-down');
-// test('TableFilter removed', function() {
-//     tf.destroy();
-//     var fltIcn1 = popupFilter.popUpFltImgs[3];
-//     deepEqual(fltIcn1, undefined, 'Filter icon is removed');
-//     deepEqual(id(tf.fltIds[3]), null, 'Filter is removed');
-//     deepEqual(tf.hasGrid(), false, 'Filters removed');
-// });
+module('Tear-down');
+test('TableFilter removed', function() {
+    tf.destroy();
+    var fltIcn1 = popupFilter.popUpFltImgs[3];
+    deepEqual(fltIcn1, undefined, 'Filter icon is removed');
+    deepEqual(id(tf.fltIds[3]), null, 'Filter is removed');
+    deepEqual(tf.hasGrid(), false, 'Filters removed');
+});

From fe2e06e637322498d75d7920857780057acd062c Mon Sep 17 00:00:00 2001
From: Max Guglielmi 
Date: Sat, 9 Jan 2016 13:42:33 +1100
Subject: [PATCH 20/41] Added _buildSubmit button method

---
 dist/tablefilter/style/colsVisibility.css     |    2 +-
 dist/tablefilter/style/filtersVisibility.css  |    2 +-
 dist/tablefilter/style/tablefilter.css        |    2 +-
 .../style/themes/default/default.css          |    2 +-
 .../style/themes/mytheme/mytheme.css          |    2 +-
 .../style/themes/skyblue/skyblue.css          |    2 +-
 dist/tablefilter/tablefilter.js               | 7962 +----------------
 dist/tablefilter/tf-1.js                      | 2191 +----
 src/modules/checkList.js                      |   22 +-
 src/modules/dropdown.js                       |   43 +-
 src/tablefilter.js                            |   64 +-
 static/templates/grouped-headers.html         |    7 +-
 test/test-store.js                            |   21 +-
 13 files changed, 127 insertions(+), 10195 deletions(-)

diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index 5eaa7dc9..c1f7a2fc 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-08T05:07:53.560Z 
+ *	 build date: 2016-01-09T02:39:28.460Z 
  *	 MIT License  
  */ 
 span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
\ No newline at end of file
diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css
index 114c238a..4d73b0c3 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-08T05:07:53.560Z 
+ *	 build date: 2016-01-09T02:39:28.460Z 
  *	 MIT License  
  */ 
 span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
\ No newline at end of file
diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css
index 6cb4d24c..d6216556 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-08T05:07:53.560Z 
+ *	 build date: 2016-01-09T02:39:28.460Z 
  *	 MIT License  
  */ 
 .activeHeader{background-color:#66afe9 !important;color:#fff !important}
diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css
index a9c01255..6bc5239d 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-08T05:07:53.560Z 
+ *	 build date: 2016-01-09T02:39:28.460Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css
index 916aaae7..62f317de 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-08T05:07:53.560Z 
+ *	 build date: 2016-01-09T02:39:28.460Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css
index 6a403440..9eadd624 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-08T05:07:53.560Z 
+ *	 build date: 2016-01-09T02:39:28.460Z 
  *	 MIT License  
  */ 
 table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
index d24bd4d9..9b66ba68 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -1,7954 +1,10 @@
-(function webpackUniversalModuleDefinition(root, factory) {
-	if(typeof exports === 'object' && typeof module === 'object')
-		module.exports = factory();
-	else if(typeof define === 'function' && define.amd)
-		define([], factory);
-	else {
-		var a = factory();
-		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
-	}
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ 	// install a JSONP callback for chunk loading
-/******/ 	var parentJsonpFunction = window["webpackJsonp"];
-/******/ 	window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
-/******/ 		// add "moreModules" to the modules object,
-/******/ 		// then flag all "chunkIds" as loaded and fire callback
-/******/ 		var moduleId, chunkId, i = 0, callbacks = [];
-/******/ 		for(;i < chunkIds.length; i++) {
-/******/ 			chunkId = chunkIds[i];
-/******/ 			if(installedChunks[chunkId])
-/******/ 				callbacks.push.apply(callbacks, installedChunks[chunkId]);
-/******/ 			installedChunks[chunkId] = 0;
-/******/ 		}
-/******/ 		for(moduleId in moreModules) {
-/******/ 			modules[moduleId] = moreModules[moduleId];
-/******/ 		}
-/******/ 		if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
-/******/ 		while(callbacks.length)
-/******/ 			callbacks.shift().call(null, __webpack_require__);
-/******/
-/******/ 	};
-/******/
-/******/ 	// The module cache
-/******/ 	var installedModules = {};
-/******/
-/******/ 	// object to store loaded and loading chunks
-/******/ 	// "0" means "already loaded"
-/******/ 	// Array means "loading", array contains callbacks
-/******/ 	var installedChunks = {
-/******/ 		0:0
-/******/ 	};
-/******/
-/******/ 	// The require function
-/******/ 	function __webpack_require__(moduleId) {
-/******/
-/******/ 		// Check if module is in cache
-/******/ 		if(installedModules[moduleId])
-/******/ 			return installedModules[moduleId].exports;
-/******/
-/******/ 		// Create a new module (and put it into the cache)
-/******/ 		var module = installedModules[moduleId] = {
-/******/ 			exports: {},
-/******/ 			id: moduleId,
-/******/ 			loaded: false
-/******/ 		};
-/******/
-/******/ 		// Execute the module function
-/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ 		// Flag the module as loaded
-/******/ 		module.loaded = true;
-/******/
-/******/ 		// Return the exports of the module
-/******/ 		return module.exports;
-/******/ 	}
-/******/
-/******/ 	// This file contains only the entry chunk.
-/******/ 	// The chunk loading function for additional chunks
-/******/ 	__webpack_require__.e = function requireEnsure(chunkId, callback) {
-/******/ 		// "0" is the signal for "already loaded"
-/******/ 		if(installedChunks[chunkId] === 0)
-/******/ 			return callback.call(null, __webpack_require__);
-/******/
-/******/ 		// an array means "currently loading".
-/******/ 		if(installedChunks[chunkId] !== undefined) {
-/******/ 			installedChunks[chunkId].push(callback);
-/******/ 		} else {
-/******/ 			// start chunk loading
-/******/ 			installedChunks[chunkId] = [callback];
-/******/ 			var head = document.getElementsByTagName('head')[0];
-/******/ 			var script = document.createElement('script');
-/******/ 			script.type = 'text/javascript';
-/******/ 			script.charset = 'utf-8';
-/******/ 			script.async = true;
-/******/
-/******/ 			script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js";
-/******/ 			head.appendChild(script);
-/******/ 		}
-/******/ 	};
-/******/
-/******/ 	// expose the modules object (__webpack_modules__)
-/******/ 	__webpack_require__.m = modules;
-/******/
-/******/ 	// expose the module cache
-/******/ 	__webpack_require__.c = installedModules;
-/******/
-/******/ 	// __webpack_public_path__
-/******/ 	__webpack_require__.p = "";
-/******/
-/******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
+/** 
+ *	 tablefilter v0.1.5 by Max Guglielmi
+ *	 build date: 2016-01-09T02:39:28.382Z 
+ *	 MIT License  
+ */ 
 
-	'use strict';
-	
-	var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-	
-	// Features
-	
-	Object.defineProperty(exports, "__esModule", {
-	    value: true
-	});
-	exports.TableFilter = undefined;
-	
-	var _event = __webpack_require__(1);
-	
-	var _event2 = _interopRequireDefault(_event);
-	
-	var _dom = __webpack_require__(2);
-	
-	var _dom2 = _interopRequireDefault(_dom);
-	
-	var _string = __webpack_require__(3);
-	
-	var _string2 = _interopRequireDefault(_string);
-	
-	var _cookie = __webpack_require__(4);
-	
-	var _cookie2 = _interopRequireDefault(_cookie);
-	
-	var _types = __webpack_require__(5);
-	
-	var _types2 = _interopRequireDefault(_types);
-	
-	var _array = __webpack_require__(6);
-	
-	var _array2 = _interopRequireDefault(_array);
-	
-	var _date = __webpack_require__(7);
-	
-	var _date2 = _interopRequireDefault(_date);
-	
-	var _helpers = __webpack_require__(8);
-	
-	var _helpers2 = _interopRequireDefault(_helpers);
-	
-	var _emitter = __webpack_require__(9);
-	
-	var _store = __webpack_require__(10);
-	
-	var _gridLayout = __webpack_require__(11);
-	
-	var _loader = __webpack_require__(13);
-	
-	var _highlightKeywords = __webpack_require__(14);
-	
-	var _popupFilter = __webpack_require__(15);
-	
-	var _dropdown = __webpack_require__(16);
-	
-	var _checkList = __webpack_require__(18);
-	
-	var _rowsCounter = __webpack_require__(19);
-	
-	var _statusBar = __webpack_require__(20);
-	
-	var _paging = __webpack_require__(21);
-	
-	var _clearButton = __webpack_require__(22);
-	
-	var _help = __webpack_require__(23);
-	
-	var _alternateRows = __webpack_require__(24);
-	
-	var _noResults = __webpack_require__(25);
-	
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-	
-	function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
-	
-	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-	
-	var global = window,
-	    doc = global.document;
-	
-	var TableFilter = exports.TableFilter = (function () {
-	
-	    /**
-	     * TableFilter object constructor
-	     * requires `table` or `id` arguments, `row` and `configuration` optional
-	     * @param {DOMElement} table Table DOM element
-	     * @param {String} id Table id
-	     * @param {Number} row index indicating the 1st row
-	     * @param {Object} configuration object
-	     */
-	
-	    function TableFilter() {
-	        var _this = this;
-	
-	        _classCallCheck(this, TableFilter);
-	
-	        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
-	            args[_key] = arguments[_key];
-	        }
-	
-	        if (args.length === 0) {
-	            return;
-	        }
-	
-	        this.id = null;
-	        this.version = '0.1.5';
-	        this.year = new Date().getFullYear();
-	        this.tbl = null;
-	        this.startRow = null;
-	        this.refRow = null;
-	        this.headersRow = null;
-	        this.cfg = {};
-	        this.nbFilterableRows = null;
-	        this.nbRows = null;
-	        this.nbCells = null;
-	        this._hasGrid = false;
-	
-	        // TODO: use for-of with babel plug-in
-	        args.forEach(function (arg) {
-	            // for (let arg of args) {
-	            var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg);
-	            if (argtype === 'object' && arg && arg.nodeName === 'TABLE') {
-	                _this.tbl = arg;
-	                _this.id = arg.id || 'tf_' + new Date().getTime() + '_';
-	            } else if (argtype === 'string') {
-	                _this.id = arg;
-	                _this.tbl = _dom2.default.id(arg);
-	            } else if (argtype === 'number') {
-	                _this.startRow = arg;
-	            } else if (argtype === 'object') {
-	                _this.cfg = arg;
-	            }
-	            // }
-	        });
-	
-	        if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) {
-	            throw new Error('Could not instantiate TableFilter: HTML table not found.');
-	        }
-	
-	        // configuration object
-	        var f = this.cfg;
-	
-	        this.emitter = new _emitter.Emitter();
-	
-	        //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 || 'tablefilter/';
-	
-	        /*** filter types ***/
-	        this.fltTypeInp = 'input';
-	        this.fltTypeSlc = 'select';
-	        this.fltTypeMulti = 'multiple';
-	        this.fltTypeCheckList = 'checklist';
-	        this.fltTypeNone = 'none';
-	
-	        /*** filters' grid properties ***/
-	
-	        //enables/disables filter grid
-	        this.fltGrid = f.grid === false ? false : true;
-	
-	        //enables/disables grid layout (fixed headers)
-	        this.gridLayout = Boolean(f.grid_layout);
-	
-	        this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index;
-	        this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index;
-	
-	        // 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 valid rows indexes (rows visible upon filtering)
-	        this.validRowsIndex = [];
-	        //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;
-	
-	        //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.stylePath = f.style_path || this.basePath + 'style/';
-	        this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows);
-	        //defines widths of columns
-	        this.hasColWidths = _types2.default.isArray(f.col_widths);
-	        this.colWidths = this.hasColWidths ? f.col_widths : null;
-	        //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';
-	
-	        /*** filters' grid behaviours ***/
-	        //enables/disables enter key
-	        this.enterKey = f.enter_key === false ? false : true;
-	        //calls function before filtering starts
-	        this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null;
-	        //calls function after filtering
-	        this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null;
-	        //enables/disables case sensitivity
-	        this.caseSensitive = Boolean(f.case_sensitive);
-	        //has exact match per column
-	        this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match);
-	        this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : [];
-	        //enables/disbles exact match for search
-	        this.exactMatch = Boolean(f.exact_match);
-	        //refreshes drop-down lists upon validation
-	        this.linkedFilters = Boolean(f.linked_filters);
-	        //wheter excluded options are disabled
-	        this.disableExcludedOptions = Boolean(f.disable_excluded_options);
-	        //stores active filter element
-	        this.activeFlt = null;
-	        //id of active filter
-	        this.activeFilterId = null;
-	        //enables always visible rows
-	        this.hasVisibleRows = Boolean(f.rows_always_visible);
-	        //array containing always visible rows
-	        this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : [];
-	        //enables/disables external filters generation
-	        this.isExternalFlt = Boolean(f.external_flt_grid);
-	        //array containing ids of external elements containing filters
-	        this.externalFltTgtIds = f.external_flt_grid_ids || [];
-	        //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null;
-	        //enables/disables single filter search
-	        this.singleSearchFlt = Boolean(f.single_filter);
-	        //calls function after row is validated
-	        this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null;
-	        //input watermark text array
-	        this.watermark = f.watermark || '';
-	        this.isWatermarkArray = _types2.default.isArray(this.watermark);
-	        //id of toolbar container element
-	        this.toolBarTgtId = f.toolbar_target_id || null;
-	        //enables/disables help div
-	        this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions);
-	        //popup filters
-	        this.popupFilters = Boolean(f.popup_filters);
-	        //active columns color
-	        this.markActiveColumns = Boolean(f.mark_active_columns);
-	        //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null;
-	        //calls function after active column header is marked
-	        this.onAfterActiveColumn = _types2.default.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 || 'Clear';
-	        //enables/disables empty option in combo-box filters
-	        this.enableEmptyOption = Boolean(f.enable_empty_option);
-	        //defines empty option text
-	        this.emptyText = f.empty_text || '(Empty)';
-	        //enables/disables non empty option in combo-box filters
-	        this.enableNonEmptyOption = Boolean(f.enable_non_empty_option);
-	        //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 = Boolean(f.sort_num_asc);
-	        this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null;
-	        //enables/disables descending numeric options sorting
-	        this.isSortNumDesc = Boolean(f.sort_num_desc);
-	        this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null;
-	        //Select filters are populated on demand
-	        this.loadFltOnDemand = Boolean(f.load_filters_on_demand);
-	        this.hasCustomOptions = _types2.default.isObj(f.custom_options);
-	        this.customOptions = f.custom_options;
-	
-	        /*** 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 || '^[¥£€$]';
-	        this.separator = f.separator || ',';
-	
-	        /*** rows counter ***/
-	        //show/hides rows counter
-	        this.rowsCounter = Boolean(f.rows_counter);
-	
-	        /*** status bar ***/
-	        //show/hides status bar
-	        this.statusBar = Boolean(f.status_bar);
-	
-	        /*** loader ***/
-	        //enables/disables loader/spinner indicator
-	        this.loader = Boolean(f.loader);
-	
-	        /*** validation - reset buttons/links ***/
-	        //show/hides filter's validation button
-	        this.displayBtn = Boolean(f.btn);
-	        //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 = Boolean(f.btn_reset);
-	        //defines css class for reset button
-	        this.btnResetCssClass = f.btn_reset_css_class || 'reset';
-	        //callback function before filters are cleared
-	        this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null;
-	        //callback function after filters are cleared
-	        this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null;
-	
-	        /*** paging ***/
-	        //enables/disables table paging
-	        this.paging = Boolean(f.paging);
-	        this.nbVisibleRows = 0; //nb visible rows
-	        this.nbHiddenRows = 0; //nb hidden rows
-	
-	        /*** autofilter on typing ***/
-	        //enables/disables auto filtering, table is filtered when user stops
-	        //typing
-	        this.autoFilter = Boolean(f.auto_filter);
-	        //onkeyup delay timer (msecs)
-	        this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900;
-	        //typing indicator
-	        this.isUserTyping = null;
-	        this.autoFilterTimer = null;
-	
-	        /*** keyword highlighting ***/
-	        //enables/disables keyword highlighting
-	        this.highlightKeywords = Boolean(f.highlight_keywords);
-	
-	        /*** No results feature ***/
-	        this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message);
-	
-	        /*** 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 = _types2.default.isArray(f.col_number_format);
-	        //array containing columns nb formats
-	        this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null;
-	        //enables date type per column
-	        this.hasColDateType = _types2.default.isArray(f.col_date_type);
-	        //array containing columns date type
-	        this.colDateType = this.hasColDateType ? f.col_date_type : null;
-	
-	        /*** 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_';
-	        //filter values cookie
-	        this.prfxCookieFltsValues = 'tf_flts_';
-	        //page nb cookie
-	        this.prfxCookiePageNb = 'tf_pgnb_';
-	        //page length cookie
-	        this.prfxCookiePageLen = 'tf_pglen_';
-	
-	        /*** cookies ***/
-	        this.hasStoredValues = false;
-	        //remembers filters values on page load
-	        this.rememberGridValues = Boolean(f.remember_grid_values);
-	        //cookie storing filter values
-	        this.fltsValuesCookie = this.prfxCookieFltsValues + this.id;
-	        //remembers page nb on page load
-	        this.rememberPageNb = this.paging && f.remember_page_number;
-	        //cookie storing page nb
-	        this.pgNbCookie = this.prfxCookiePageNb + this.id;
-	        //remembers page length on page load
-	        this.rememberPageLen = this.paging && f.remember_page_length;
-	        //cookie storing page length
-	        this.pgLenCookie = this.prfxCookiePageLen + this.id;
-	
-	        /*** extensions ***/
-	        //imports external script
-	        this.extensions = f.extensions;
-	        this.hasExtensions = _types2.default.isArray(this.extensions);
-	
-	        /*** themes ***/
-	        this.enableDefaultTheme = Boolean(f.enable_default_theme);
-	        //imports themes
-	        this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes);
-	        this.themes = f.themes || [];
-	        //themes path
-	        this.themesPath = f.themes_path || this.stylePath + 'themes/';
-	
-	        // Features registry
-	        this.Mod = {};
-	
-	        // Extensions registry
-	        this.ExtRegistry = {};
-	
-	        /*** TF events ***/
-	        this.Evt = {
-	            // Detect  key
-	
-	            detectKey: function detectKey(e) {
-	                if (!this.enterKey) {
-	                    return;
-	                }
-	                var _ev = e || global.event;
-	                if (_ev) {
-	                    var key = _event2.default.keyCode(_ev);
-	                    if (key === 13) {
-	                        this.filter();
-	                        _event2.default.cancel(_ev);
-	                        _event2.default.stop(_ev);
-	                    } else {
-	                        this.isUserTyping = true;
-	                        global.clearInterval(this.autoFilterTimer);
-	                        this.autoFilterTimer = null;
-	                    }
-	                }
-	            },
-	
-	            // if auto-filter on, detect user is typing and filter columns
-	            onKeyUp: function onKeyUp(e) {
-	                if (!this.autoFilter) {
-	                    return;
-	                }
-	                var _ev = e || global.event;
-	                var key = _event2.default.keyCode(_ev);
-	                this.isUserTyping = false;
-	
-	                function filter() {
-	                    /*jshint validthis:true */
-	                    global.clearInterval(this.autoFilterTimer);
-	                    this.autoFilterTimer = null;
-	                    if (!this.isUserTyping) {
-	                        this.filter();
-	                        this.isUserTyping = null;
-	                    }
-	                }
-	
-	                if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) {
-	                    if (this.autoFilterTimer === null) {
-	                        this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay);
-	                    }
-	                } else {
-	                    global.clearInterval(this.autoFilterTimer);
-	                    this.autoFilterTimer = null;
-	                }
-	            },
-	
-	            // if auto-filter on, detect user is typing
-	            onKeyDown: function onKeyDown() {
-	                if (!this.autoFilter) {
-	                    return;
-	                }
-	                this.isUserTyping = true;
-	            },
-	
-	            // if auto-filter on, clear interval on filter blur
-	            onInpBlur: function onInpBlur() {
-	                if (this.autoFilter) {
-	                    this.isUserTyping = false;
-	                    global.clearInterval(this.autoFilterTimer);
-	                }
-	                // TODO: hack to prevent ezEditTable enter key event hijaking.
-	                // Needs to be fixed in the vendor's library
-	                if (this.hasExtension('advancedGrid')) {
-	                    var advGrid = this.extension('advancedGrid');
-	                    var ezEditTable = advGrid._ezEditTable;
-	                    if (advGrid.cfg.editable) {
-	                        ezEditTable.Editable.Set();
-	                    }
-	                    if (advGrid.cfg.selection) {
-	                        ezEditTable.Selection.Set();
-	                    }
-	                }
-	            },
-	
-	            // set focused text-box filter as active
-	            onInpFocus: function onInpFocus(e) {
-	                var _ev = e || global.event;
-	                var elm = _event2.default.target(_ev);
-	                this.activeFilterId = elm.getAttribute('id');
-	                this.activeFlt = _dom2.default.id(this.activeFilterId);
-	                if (this.popupFilters) {
-	                    _event2.default.cancel(_ev);
-	                    _event2.default.stop(_ev);
-	                }
-	                // TODO: hack to prevent ezEditTable enter key event hijaking.
-	                // Needs to be fixed in the vendor's library
-	                if (this.hasExtension('advancedGrid')) {
-	                    var advGrid = this.extension('advancedGrid');
-	                    var ezEditTable = advGrid._ezEditTable;
-	                    if (advGrid.cfg.editable) {
-	                        ezEditTable.Editable.Remove();
-	                    }
-	                    if (advGrid.cfg.selection) {
-	                        ezEditTable.Selection.Remove();
-	                    }
-	                }
-	            },
-	
-	            // set focused drop-down filter as active
-	            onSlcFocus: function onSlcFocus(e) {
-	                var _ev = e || global.event;
-	                var elm = _event2.default.target(_ev);
-	                this.activeFilterId = elm.getAttribute('id');
-	                this.activeFlt = _dom2.default.id(this.activeFilterId);
-	                // select is populated when element has focus
-	                if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') {
-	                    var ct = elm.getAttribute('ct');
-	                    this.Mod.dropdown.build(ct);
-	                }
-	                if (this.popupFilters) {
-	                    _event2.default.cancel(_ev);
-	                    _event2.default.stop(_ev);
-	                }
-	            },
-	
-	            // filter columns on drop-down filter change
-	            onSlcChange: function onSlcChange(e) {
-	                if (!this.activeFlt) {
-	                    return;
-	                }
-	                var _ev = e || global.event;
-	                if (this.popupFilters) {
-	                    _event2.default.stop(_ev);
-	                }
-	                if (this.onSlcChange) {
-	                    this.filter();
-	                }
-	            } /*,
-	              // fill checklist filter on click if required
-	              onCheckListClick(e) {
-	                 let _ev = e || global.event;
-	                 let elm = Event.target(_ev);
-	                 if(this.loadFltOnDemand && elm.getAttribute('filled') === '0'){
-	                     let ct = elm.getAttribute('ct');
-	                     this.Mod.checkList.build(ct);
-	                     this.Mod.checkList.checkListDiv[ct].onclick = null;
-	                     this.Mod.checkList.checkListDiv[ct].title = '';
-	                 }
-	              }*/
-	
-	        };
-	    }
-	
-	    /**
-	     * Initialise filtering grid bar behaviours and layout
-	     *
-	     * TODO: decompose in smaller methods
-	     */
-	
-	    _createClass(TableFilter, [{
-	        key: 'init',
-	        value: function init() {
-	            var _this2 = this;
-	
-	            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 Mod = this.Mod;
-	            var n = this.singleSearchFlt ? 1 : this.nbCells,
-	                inpclass = undefined;
-	
-	            //loads stylesheet if not imported
-	            this.import(this.stylesheetId, this.stylesheet, null, 'link');
-	
-	            //loads theme
-	            if (this.hasThemes) {
-	                this.loadThemes();
-	            }
-	
-	            if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) {
-	                Mod.store = new _store.Store(this);
-	                Mod.store.init();
-	            }
-	
-	            if (this.gridLayout) {
-	                Mod.gridLayout = new _gridLayout.GridLayout(this);
-	                Mod.gridLayout.init();
-	            }
-	
-	            if (this.loader) {
-	                if (!Mod.loader) {
-	                    Mod.loader = new _loader.Loader(this);
-	                }
-	                Mod.loader.init();
-	            }
-	
-	            if (this.highlightKeywords) {
-	                Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this);
-	                Mod.highlightKeyword.init();
-	            }
-	
-	            if (this.popupFilters) {
-	                if (!Mod.popupFilter) {
-	                    Mod.popupFilter = new _popupFilter.PopupFilter(this);
-	                }
-	                Mod.popupFilter.init();
-	            }
-	
-	            //filters grid is not generated
-	            if (!this.fltGrid) {
-	                this._initNoFilters();
-	            } else {
-	                if (this.isFirstLoad) {
-	                    var fltrow = this._insertFiltersRow();
-	                    // if(!this.gridLayout){
-	                    //     let 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.popupFilters){
-	                    //         fltrow.style.display = 'none';
-	                    //     }
-	                    // }
-	
-	                    this.nbFilterableRows = this.getRowsNb();
-	                    this.nbVisibleRows = this.nbFilterableRows;
-	                    this.nbRows = this.tbl.rows.length;
-	
-	                    // Generate filters
-	                    for (var i = 0; i < n; i++) {
-	
-	                        // if(this.popupFilters){
-	                        //     Mod.popupFilter.build(i);
-	                        // }
-	                        this.emitter.emit('before-filter-init', this, i);
-	
-	                        var fltcell = _dom2.default.create(this.fltCellTag),
-	                            col = this.getFilterType(i),
-	                            externalFltTgtId = this.isExternalFlt ? 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;
-	
-	                        //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 (!Mod.dropdown) {
-	                                Mod.dropdown = new _dropdown.Dropdown(this);
-	                            }
-	                            Mod.dropdown.init(i, this.isExternalFlt, fltcell);
-	                            // let dropdown = Mod.dropdown;
-	
-	                            // let 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;
-	
-	                            // //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.loadFltOnDemand){
-	                            //     dropdown.build(i);
-	                            // }
-	
-	                            // Event.add(slc, 'keypress',
-	                            //     this.Evt.detectKey.bind(this));
-	                            // Event.add(slc, 'change',
-	                            //     this.Evt.onSlcChange.bind(this));
-	                            // Event.add(slc, 'focus',
-	                            // this.Evt.onSlcFocus.bind(this));
-	
-	                            // 1st option is created here since dropdown.build isn't
-	                            // invoked
-	                            // if(this.loadFltOnDemand){
-	                            //    let opt0 = Dom.createOpt(this.displayAllText, '');
-	                            //     slc.appendChild(opt0);
-	                            // }
-	                        }
-	                        // checklist
-	                        else if (col === this.fltTypeCheckList) {
-	                                // let checkList;
-	                                // Mod.checkList = new CheckList(this);
-	                                // checkList = Mod.checkList;
-	                                if (!Mod.checkList) {
-	                                    Mod.checkList = new _checkList.CheckList(this);
-	                                }
-	                                Mod.checkList.init(i, this.isExternalFlt, fltcell);
-	
-	                                // let divCont = Dom.create('div',
-	                                //     ['id', checkList.prfxCheckListDiv+i+'_'+this.id],
-	                                //     ['ct', i], ['filled', '0']);
-	                                // divCont.className = checkList.checkListDivCssClass;
-	
-	                                // //filter is appended in desired element
-	                                // if(externalFltTgtId){
-	                                //     Dom.id(externalFltTgtId).appendChild(divCont);
-	                                //     this.externalFltEls.push(divCont);
-	                                // } else {
-	                                //     fltcell.appendChild(divCont);
-	                                // }
-	
-	                                // checkList.checkListDiv[i] = divCont;
-	                                // this.fltIds.push(this.prfxFlt+i+'_'+this.id);
-	                                // if(!this.loadFltOnDemand){
-	                                //     checkList.build(i);
-	                                // }
-	
-	                                // if(this.loadFltOnDemand){
-	                                //     Event.add(divCont, 'click',
-	                                //         this.Evt.onCheckListClick.bind(this));
-	                                //     divCont.appendChild(
-	                                //         Dom.text(checkList.activateCheckListTxt));
-	                                // }
-	                            } else {
-	                                    this._buildInputFilter(i, inpclass, fltcell);
-	                                    //show/hide input
-	                                    //let inptype = col===this.fltTypeInp ? 'text' :
-	                                    //'hidden';
-	                                    // let 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;
-	                                    //Event.add(inp, 'focus',
-	                                    //this.Evt.onInpFocus.bind(this));
-	
-	                                    // //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);
-	
-	                                    // Event.add(inp, 'keypress',
-	                                    //     this.Evt.detectKey.bind(this));
-	                                    // Event.add(inp, 'keydown',
-	                                    //     this.Evt.onKeyDown.bind(this));
-	                                    // Event.add(inp, 'keyup', this.Evt.onKeyUp.bind(this));
-	                                    //Event.add(inp, 'blur', this.Evt.onInpBlur.bind(this));
-	
-	                                    // if(this.rememberGridValues){
-	                                    //     let flts_values = this.Mod.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 = _dom2.default.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) {
-	                                _dom2.default.id(externalFltTgtId).appendChild(btn);
-	                            } else {
-	                                fltcell.appendChild(btn);
-	                            }
-	
-	                            _event2.default.add(btn, 'click', function () {
-	                                return _this2.filter();
-	                            });
-	                        } //if
-	
-	                        this.emitter.emit('after-filter-init', this, i);
-	                    } // for i
-	                } else {
-	                        this._resetGrid();
-	                    } //if isFirstLoad
-	            } //if this.fltGrid
-	
-	            /* Features */
-	            if (this.hasVisibleRows) {
-	                this.emitter.on(['after-filtering'], function () {
-	                    return _this2.enforceVisibility();
-	                });
-	                this.enforceVisibility();
-	            }
-	            if (this.rowsCounter) {
-	                Mod.rowsCounter = new _rowsCounter.RowsCounter(this);
-	                Mod.rowsCounter.init();
-	            }
-	            if (this.statusBar) {
-	                Mod.statusBar = new _statusBar.StatusBar(this);
-	                Mod.statusBar.init();
-	            }
-	            if (this.paging || Mod.paging) {
-	                if (!Mod.paging) {
-	                    Mod.paging = new _paging.Paging(this);
-	                    Mod.paging.init();
-	                }
-	                Mod.paging.reset();
-	            }
-	            if (this.btnReset) {
-	                Mod.clearButton = new _clearButton.ClearButton(this);
-	                Mod.clearButton.init();
-	            }
-	            if (this.help) {
-	                if (!Mod.help) {
-	                    Mod.help = new _help.Help(this);
-	                }
-	                Mod.help.init();
-	            }
-	            if (this.hasColWidths && !this.gridLayout) {
-	                this.setColWidths();
-	            }
-	            if (this.alternateRows) {
-	                Mod.alternateRows = new _alternateRows.AlternateRows(this);
-	                Mod.alternateRows.init();
-	            }
-	            if (this.noResults) {
-	                if (!Mod.noResults) {
-	                    Mod.noResults = new _noResults.NoResults(this);
-	                }
-	                Mod.noResults.init();
-	            }
-	
-	            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) {
-	                _dom2.default.addClass(this.tbl, this.prfxTf);
-	            }
-	
-	            /* Loads extensions */
-	            if (this.hasExtensions) {
-	                this.initExtensions();
-	            }
-	
-	            // Subscribe to events
-	            if (this.markActiveColumns) {
-	                this.emitter.on(['before-filtering'], function () {
-	                    return _this2.clearActiveColumns();
-	                });
-	                this.emitter.on(['cell-processed'], function (tf, colIndex) {
-	                    return _this2.markActiveColumn(colIndex);
-	                });
-	            }
-	            if (this.linkedFilters) {
-	                this.emitter.on(['after-filtering'], function () {
-	                    return _this2.linkFilters();
-	                });
-	            }
-	
-	            if (this.onFiltersLoaded) {
-	                this.onFiltersLoaded.call(null, this);
-	            }
-	
-	            this.emitter.emit('initialized', this);
-	        }
-	    }, {
-	        key: '_insertFiltersRow',
-	        value: function _insertFiltersRow() {
-	            if (this.gridLayout) {
-	                return;
-	            }
-	            var fltrow = undefined;
-	
-	            var thead = _dom2.default.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++;
-	                }
-	
-	            fltrow.className = this.fltsRowCssClass;
-	
-	            if (this.isExternalFlt) {
-	                fltrow.style.display = 'none';
-	            }
-	
-	            this.emitter.emit('filters-row-inserted', this, fltrow);
-	
-	            return fltrow;
-	        }
-	    }, {
-	        key: '_initNoFilters',
-	        value: function _initNoFilters() {
-	            if (this.fltGrid) {
-	                return;
-	            }
-	            this.refRow = this.refRow > 0 ? this.refRow - 1 : 0;
-	            // if(this.gridLayout){
-	            //     this.refRow = 0;
-	            // }
-	            this.nbFilterableRows = this.getRowsNb();
-	            this.nbVisibleRows = this.nbFilterableRows;
-	            this.nbRows = this.nbFilterableRows + this.refRow;
-	        }
-	    }, {
-	        key: '_buildInputFilter',
-	        value: function _buildInputFilter(colIndex, cssClass, container) {
-	            var col = this.getFilterType(colIndex);
-	            var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null;
-	            var inptype = col === this.fltTypeInp ? 'text' : 'hidden';
-	            var inp = _dom2.default.create(this.fltTypeInp, ['id', this.prfxFlt + colIndex + '_' + this.id], ['type', inptype], ['ct', colIndex]);
-	            if (inptype !== 'hidden' && this.watermark) {
-	                inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark);
-	            }
-	            inp.className = cssClass || this.fltCssClass;
-	            _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this));
-	
-	            //filter is appended in desired element
-	            if (externalFltTgtId) {
-	                _dom2.default.id(externalFltTgtId).appendChild(inp);
-	                this.externalFltEls.push(inp);
-	            } else {
-	                container.appendChild(inp);
-	            }
-	
-	            this.fltIds.push( /*this.prfxFlt+i+'_'+this.id*/inp.id);
-	
-	            _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this));
-	            _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this));
-	            _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this));
-	            _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this));
-	
-	            // if(this.rememberGridValues){
-	            //     let fltValues = this.Mod.store.getFilterValues(
-	            //         this.fltsValuesCookie);
-	            //     if(fltValues[colIndex]!=' '){
-	            //         this.setFilterValue(colIndex, fltValues[colIndex], false);
-	            //     }
-	            // }
-	        }
-	
-	        /**
-	         * Return a feature instance for a given name
-	         * @param  {String} name Name of the feature
-	         * @return {Object}
-	         */
-	
-	    }, {
-	        key: 'feature',
-	        value: function feature(name) {
-	            return this.Mod[name];
-	        }
-	
-	        /**
-	         * Initialise all the extensions defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'initExtensions',
-	        value: function initExtensions() {
-	            var exts = this.extensions;
-	
-	            this.emitter.emit('before-loading-extensions', this);
-	            for (var i = 0, len = exts.length; i < len; i++) {
-	                var ext = exts[i];
-	                if (!this.ExtRegistry[ext.name]) {
-	                    this.loadExtension(ext);
-	                }
-	            }
-	            this.emitter.emit('after-loading-extensions', this);
-	        }
-	
-	        /**
-	         * Load an extension module
-	         * @param  {Object} ext Extension config object
-	         */
-	
-	    }, {
-	        key: 'loadExtension',
-	        value: function loadExtension(ext) {
-	            var _this3 = this;
-	
-	            if (!ext || !ext.name) {
-	                return;
-	            }
-	
-	            var name = ext.name;
-	            var path = ext.path;
-	            var modulePath = undefined;
-	
-	            if (name && path) {
-	                modulePath = ext.path + name;
-	            } else {
-	                name = name.replace('.js', '');
-	                modulePath = 'extensions/{}/{}'.replace(/{}/g, name);
-	            }
-	
-	            // Trick to set config's publicPath dynamically for Webpack...
-	            __webpack_require__.p = this.basePath;
-	
-	            __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) {
-	                var inst = new mod.default(_this3, ext);
-	                inst.init();
-	                _this3.ExtRegistry[name] = inst;
-	            }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});
-	        }
-	
-	        /**
-	         * Get an extension instance
-	         * @param  {String} name Name of the extension
-	         * @return {Object}      Extension instance
-	         */
-	
-	    }, {
-	        key: 'extension',
-	        value: function extension(name) {
-	            return this.ExtRegistry[name];
-	        }
-	
-	        /**
-	         * Check passed extension name exists
-	         * @param  {String}  name Name of the extension
-	         * @return {Boolean}
-	         */
-	
-	    }, {
-	        key: 'hasExtension',
-	        value: function hasExtension(name) {
-	            return !_types2.default.isEmpty(this.ExtRegistry[name]);
-	        }
-	
-	        /**
-	         * Destroy all the extensions defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'destroyExtensions',
-	        value: function destroyExtensions() {
-	            var exts = this.extensions;
-	
-	            for (var i = 0, len = exts.length; i < len; i++) {
-	                var ext = exts[i];
-	                var extInstance = this.ExtRegistry[ext.name];
-	                if (extInstance) {
-	                    extInstance.destroy();
-	                    this.ExtRegistry[ext.name] = null;
-	                }
-	            }
-	        }
-	
-	        /**
-	         * Load themes defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'loadThemes',
-	        value: function loadThemes() {
-	            var themes = this.themes;
-	            this.emitter.emit('before-loading-themes', this);
-	
-	            //Default theme config
-	            if (this.enableDefaultTheme) {
-	                var defaultTheme = { name: 'default' };
-	                this.themes.push(defaultTheme);
-	            }
-	            if (_types2.default.isArray(themes)) {
-	                for (var i = 0, len = themes.length; i < len; i++) {
-	                    var theme = themes[i];
-	                    var name = theme.name;
-	                    var path = theme.path;
-	                    var styleId = this.prfxTf + name;
-	                    if (name && !path) {
-	                        path = this.themesPath + name + '/' + name + '.css';
-	                    } else if (!name && theme.path) {
-	                        name = 'theme{0}'.replace('{0}', i);
-	                    }
-	
-	                    if (!this.isImported(path, 'link')) {
-	                        this.import(styleId, path, null, 'link');
-	                    }
-	                }
-	            }
-	
-	            //Some elements need to be overriden for default 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; - - this.emitter.emit('after-loading-themes', this); - } - - /** - * Return stylesheet DOM element for a given theme name - * @return {DOMElement} stylesheet element - */ - - }, { - key: 'getStylesheet', - value: function getStylesheet() { - var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; - - return _dom2.default.id(this.prfxTf + name); - } - - /** - * Destroy filter grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this._hasGrid) { - return; - } - var rows = this.tbl.rows, - Mod = this.Mod; - - this.clearFilters(); - - if (this.isExternalFlt && !this.popupFilters) { - this.removeExternalFlts(); - } - if (this.infDiv) { - this.removeToolbar(); - } - if (this.highlightKeywords) { - Mod.highlightKeyword.unhighlightAll(); - } - if (this.markActiveColumns) { - this.clearActiveColumns(); - this.emitter.off(['before-filtering'], function () { - return _this4.clearActiveColumns(); - }); - this.emitter.off(['cell-processed'], function (tf, colIndex) { - return _this4.markActiveColumn(colIndex); - }); - } - if (this.hasExtensions) { - this.destroyExtensions(); - } - - for (var j = this.refRow; j < this.nbRows; j++) { - // validate row - this.validateRow(j, true); - - //removes alternating colors - if (this.alternateRows) { - Mod.alternateRows.removeRowBg(j); - } - } //for j - - if (this.fltGrid && !this.gridLayout) { - this.fltGridEl = rows[this.filtersRowIndex]; - this.tbl.deleteRow(this.filtersRowIndex); - } - - // Destroy modules - Object.keys(Mod).forEach(function (key) { - var feature = Mod[key]; - if (feature && _types2.default.isFn(feature.destroy)) { - feature.destroy(); - } - }); - - // unsubscribe to events - if (this.hasVisibleRows) { - this.emitter.off(['after-filtering'], function () { - return _this4.enforceVisibility(); - }); - } - if (this.linkedFilters) { - this.emitter.off(['after-filtering'], function () { - return _this4.linkFilters(); - }); - } - - _dom2.default.removeClass(this.tbl, this.prfxTf); - this.nbHiddenRows = 0; - this.validRowsIndex = []; - this.activeFlt = null; - this._hasGrid = false; - // this.tbl = null; - } - - /** - * Generate container element for paging, reset button, rows counter etc. - */ - - }, { - key: 'setToolbar', - value: function setToolbar() { - if (this.infDiv) { - return; - } - - /*** container div ***/ - var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); - infdiv.className = this.infDivCssClass; - - //custom container - if (this.toolBarTgtId) { - _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); - } - //grid-layout - else if (this.gridLayout) { - var gridLayout = this.Mod.gridLayout; - gridLayout.tblMainCont.appendChild(infdiv); - infdiv.className = gridLayout.gridInfDivCssClass; - } - //default location: just above the table - else { - var cont = _dom2.default.create('caption'); - cont.appendChild(infdiv); - this.tbl.insertBefore(cont, this.tbl.firstChild); - } - this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); - - /*** left div containing rows # displayer ***/ - var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); - ldiv.className = this.lDivCssClass; - infdiv.appendChild(ldiv); - this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); - - /*** right div containing reset button - + nb results per page select ***/ - var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); - rdiv.className = this.rDivCssClass; - infdiv.appendChild(rdiv); - this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); - - /*** mid div containing paging elements ***/ - var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); - mdiv.className = this.mDivCssClass; - infdiv.appendChild(mdiv); - this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); - - // Enable help instructions by default if topbar is generated and not - // explicitely set to false - if (_types2.default.isUndef(this.help)) { - if (!this.Mod.help) { - this.Mod.help = new _help.Help(this); - } - this.Mod.help.init(); - this.help = true; - } - } - - /** - * Remove toolbar container element - */ - - }, { - key: 'removeToolbar', - value: function removeToolbar() { - if (!this.infDiv) { - return; - } - _dom2.default.remove(this.infDiv); - this.infDiv = null; - - var tbl = this.tbl; - var captions = _dom2.default.tag(tbl, 'caption'); - if (captions.length > 0) { - [].forEach.call(captions, function (elm) { - tbl.removeChild(elm); - }); - } - } - - /** - * Remove all the external column filters - */ - - }, { - key: 'removeExternalFlts', - value: function removeExternalFlts() { - if (!this.isExternalFlt) { - return; - } - var ids = this.externalFltTgtIds, - len = ids.length; - for (var ct = 0; ct < len; ct++) { - var externalFltTgtId = ids[ct], - externalFlt = _dom2.default.id(externalFltTgtId); - if (externalFlt) { - externalFlt.innerHTML = ''; - } - } - } - - /** - * Check if given column implements a filter with custom options - * @param {Number} colIndex Column's index - * @return {Boolean} - */ - - }, { - key: 'isCustomOptions', - value: function isCustomOptions(colIndex) { - return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; - } - - /** - * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the - * custom options values and texts - * @param {Number} colIndex Column's index - * @return {Array} - */ - - }, { - key: 'getCustomOptions', - value: function getCustomOptions(colIndex) { - if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { - return; - } - - var customOptions = this.customOptions; - var cols = customOptions.cols; - var optTxt = [], - optArray = []; - var index = cols.indexOf(colIndex); - var slcValues = customOptions.values[index]; - var slcTexts = customOptions.texts[index]; - var slcSort = customOptions.sorts[index]; - - for (var r = 0, len = slcValues.length; r < len; r++) { - optArray.push(slcValues[r]); - if (slcTexts[r]) { - optTxt.push(slcTexts[r]); - } else { - optTxt.push(slcValues[r]); - } - } - if (slcSort) { - optArray.sort(); - optTxt.sort(); - } - return [optArray, optTxt]; - } - - /** - * Reset persisted filter values - */ - - }, { - key: 'resetValues', - value: function resetValues() { - var _this5 = this; - - //only loadFltOnDemand - if (this.rememberGridValues) { - if (this.loadFltOnDemand) { - this._resetGridValues(this.fltsValuesCookie); - } else { - var fltValues = this.Mod.store.getFilterValues(this.fltsValuesCookie); - fltValues.forEach(function (val, idx) { - if (val !== ' ') { - _this5.setFilterValue(idx, val); - } - }); - } - } - this.filter(); - } - - /** - * Reset persisted filter values when load filters on demand feature is - * enabled - * @param {String} name cookie name storing filter values - */ - - }, { - key: '_resetGridValues', - value: function _resetGridValues(name) { - if (!this.loadFltOnDemand) { - return; - } - var fltsValues = this.Mod.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 = undefined, - opt = undefined; - var fltType = this.getFilterType(i); - // if loadFltOnDemand, drop-down needs to contain stored - // value(s) for filtering - if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { - var slc = _dom2.default.id(this.fltIds[i]); - slc.options[0].selected = false; - - //selects - if (slcFltsIndex.indexOf(i) != -1) { - opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - //multiple select - if (multiFltsIndex.indexOf(i) != -1) { - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - opt = _dom2.default.createOpt(s[j], s[j], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - } // if multiFltsIndex - } else if (fltType === this.fltTypeCheckList) { - var checkList = this.Mod.checkList; - var divChk = checkList.checkListDiv[i]; - divChk.title = divChk.innerHTML; - divChk.innerHTML = ''; - - var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); - ul.className = checkList.checkListCssClass; - - var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); - li0.className = checkList.checkListItemCssClass; - ul.appendChild(li0); - - divChk.appendChild(ul); - - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - var li = _dom2.default.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; - } - } else if (fltType === this.fltTypeInp) { - this.setFilterValue(i, fltsValues[i]); - } - } //end for - - if (!this.hasStoredValues && this.paging) { - this.Mod.paging.setPagingInfo(); - } - } //end if - } - - /** - * Filter the table by retrieving the data from each cell in every single - * row and comparing it to the search term for current column. A row is - * hidden when all the search terms are not found in inspected row. - * - * TODO: Reduce complexity of this massive method - */ - - }, { - key: 'filter', - value: function filter() { - if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { - return; - } - //invoke onbefore callback - if (this.onBeforeFilter) { - this.onBeforeFilter.call(null, this); - } - this.emitter.emit('before-filtering', this); - - var row = this.tbl.rows, - Mod = this.Mod, - hiddenrows = 0; - - this.validRowsIndex = []; - // search args re-init - this.searchArgs = this.getFiltersValue(); - - var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); - - //keyword highlighting - function highlight(str, ok, cell) { - /*jshint validthis:true */ - if (this.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 = _dom2.default.getText(cell); - } - if (w !== '') { - Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); - } - } - } - - //looks for search argument in current row - function hasArg(sA, cellData, j) { - /*jshint validthis:true */ - var occurence = undefined, - removeNbFormat = _helpers2.default.removeNbFormat; - - //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); - var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); - var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); - var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); - var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); - var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); - - var dte1 = undefined, - dte2 = undefined; - //dates - if (_date2.default.isValid(cellData, dtType)) { - dte1 = _date2.default.format(cellData, dtType); - // lower date - if (isLDate) { - dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); - occurence = dte1 < dte2; - } - // lower equal date - else if (isLEDate) { - dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); - occurence = dte1 <= dte2; - } - // greater equal date - else if (isGEDate) { - dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); - occurence = dte1 >= dte2; - } - // greater date - else if (isGDate) { - dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); - occurence = dte1 > dte2; - } - // different date - else if (isDFDate) { - dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); - occurence = dte1.toString() != dte2.toString(); - } - // equal date - else if (isEQDate) { - dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } else if (_date2.default.isValid(sA, dtType)) { - dte2 = _date2.default.format(sA, dtType); - occurence = dte1.toString() === dte2.toString(); - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } else { - //first numbers need to be formated - if (this.hasColNbFormat && this.colNbFormat[j]) { - numCellData = removeNbFormat(cellData, this.colNbFormat[j]); - nbFormat = this.colNbFormat[j]; - } else { - if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { - numCellData = removeNbFormat(cellData, 'us'); - nbFormat = 'us'; - } else { - numCellData = removeNbFormat(cellData, 'eu'); - nbFormat = 'eu'; - } - } - - // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, - // rgx:) - // lower equal - if (hasLE) { - occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); - } - //greater equal - else if (hasGE) { - occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); - } - //lower - else if (hasLO) { - occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); - } - //greater - else if (hasGR) { - occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); - } - //different - else if (hasDF) { - occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; - } - //like - else if (hasLK) { - occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } - //equal - else if (hasEQ) { - occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); - } - //starts with - else if (hasST) { - occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; - } - //ends with - else if (hasEN) { - var searchArg = sA.replace(re_en, ''); - occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } - //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(cellData); - } catch (e) { - occurence = false; - } - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } //else - return occurence; - } //fn - - for (var k = this.refRow; k < this.nbRows; k++) { - /*** if table already filtered some rows are not visible ***/ - if (this.getRowDisplay(row[k]) === '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 = true, - - //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]; - var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; - if (sA === '') { - continue; - } - - var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); - - //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 = undefined, - occur = false, - s = hasMultiOrSA ? sAOrSplit : sAAndSplit; - for (var w = 0, len = s.length; w < len; w++) { - cS = _string2.default.trim(s[w]); - occur = hasArg.call(this, cS, cellData, j); - highlight.call(this, cS, occur, cell[j]); - if (hasMultiOrSA && occur) { - break; - } - if (hasMultiAndSA && !occur) { - break; - } - } - occurence[j] = occur; - } - //single search parameter - else { - occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); - highlight.call(this, sA, occurence[j], cell[j]); - } //else single param - - if (!occurence[j]) { - isRowValid = false; - } - if (this.singleSearchFlt && occurence[j]) { - singleFltRowValid = true; - } - - this.emitter.emit('cell-processed', this, j, cell[j]); - } //for j - - if (this.singleSearchFlt && singleFltRowValid) { - isRowValid = true; - } - - if (!isRowValid) { - this.validateRow(k, false); - hiddenrows++; - } else { - this.validateRow(k, true); - } - - this.emitter.emit('row-processed', this, k, this.validRowsIndex.length, isRowValid); - } // for k - - this.nbVisibleRows = this.validRowsIndex.length; - this.nbHiddenRows = hiddenrows; - - //invokes onafterfilter callback - if (this.onAfterFilter) { - this.onAfterFilter.call(null, this); - } - - this.emitter.emit('after-filtering', this); - } - - /** - * Return the data of a specified colum - * @param {Number} colIndex Column index - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} num Optional: return unformatted number - * @param {Array} exclude Optional: list of row indexes to be excluded - * @return {Array} Flat list of data for a column - */ - - }, { - key: 'getColValues', - value: function getColValues(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; - - if (!this.fltGrid) { - return; - } - var row = this.tbl.rows, - colValues = []; - - if (includeHeaders) { - colValues.push(this.getHeadersText()[colIndex]); - } - - for (var i = this.refRow; i < this.nbRows; i++) { - var isExludedRow = false; - // checks if current row index appears in exclude array - if (exclude.length > 0) { - isExludedRow = exclude.indexOf(i) != -1; - } - 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 !== '') { - continue; - } - var cellData = this.getCellData(cell[j]), - nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, - data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; - colValues.push(data); - } - } - } - return colValues; - } - - /** - * Return the filter's value of a specified column - * @param {Number} index Column index - * @return {String} Filter value - */ - - }, { - key: 'getFilterValue', - value: function getFilterValue(index) { - if (!this.fltGrid) { - return; - } - var fltValue = undefined, - flt = this.getFilterElement(index); - if (!flt) { - return ''; - } - - var fltColType = this.getFilterType(index); - if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { - fltValue = flt.value; - } - //mutiple select - else if (fltColType === this.fltTypeMulti) { - fltValue = ''; - for (var j = 0, len = flt.options.length; j < len; 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; - } - - /** - * Return the filters' values - * @return {Array} List of filters' values - */ - - }, { - key: 'getFiltersValue', - value: function getFiltersValue() { - if (!this.fltGrid) { - return; - } - var searchArgs = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); - } - return searchArgs; - } - - /** - * Return the ID of the filter of a specified column - * @param {Number} index Column's index - * @return {String} ID of the filter element - */ - - }, { - key: 'getFilterId', - value: function getFilterId(index) { - if (!this.fltGrid) { - return; - } - return this.fltIds[index]; - } - - /** - * Return the list of ids of filters matching a specified type. - * Note: hidden filters are also returned - * - * @param {String} type Filter type string ('input', 'select', 'multiple', - * 'checklist') - * @param {Boolean} bool If true returns columns indexes instead of IDs - * @return {[type]} List of element IDs or column indexes - */ - - }, { - key: 'getFiltersByType', - value: function getFiltersByType(type, bool) { - if (!this.fltGrid) { - return; - } - var arr = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - var fltType = this.getFilterType(i); - if (fltType === _string2.default.lower(type)) { - var a = bool ? i : this.fltIds[i]; - arr.push(a); - } - } - return arr; - } - - /** - * Return the filter's DOM element for a given column - * @param {Number} index Column's index - * @return {DOMElement} - */ - - }, { - key: 'getFilterElement', - value: function getFilterElement(index) { - var fltId = this.fltIds[index]; - return _dom2.default.id(fltId); - } - - /** - * Return the number of cells for a given row index - * @param {Number} rowIndex Index of the row - * @return {Number} Number of cells - */ - - }, { - key: 'getCellsNb', - value: function getCellsNb() { - var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; - - var tr = this.tbl.rows[rowIndex]; - return tr.cells.length; - } - - /** - * Return the number of filterable rows starting from reference row if - * defined - * @param {Boolean} includeHeaders Include the headers row - * @return {Number} Number of filterable rows - */ - - }, { - key: 'getRowsNb', - value: function getRowsNb(includeHeaders) { - var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, - ntrs = this.tbl.rows.length; - if (includeHeaders) { - s = 0; - } - return parseInt(ntrs - s, 10); - } - - /** - * Return the data of a given cell - * @param {DOMElement} cell Cell's DOM object - * @return {String} - */ - - }, { - key: 'getCellData', - value: function getCellData(cell) { - var idx = cell.cellIndex; - //Check for customCellData callback - if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { - return this.customCellData.call(null, this, cell, idx); - } else { - return _dom2.default.getText(cell); - } - } - - /** - * Return the table data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getTableData', - value: function getTableData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - var rows = this.tbl.rows; - var tblData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - tblData.push([this.getHeadersRowIndex(), headers]); - } - for (var k = this.refRow; k < this.nbRows; k++) { - var rowData = [k, []]; - var cells = rows[k].cells; - for (var j = 0, len = cells.length; j < len; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var cellData = this.getCellData(cells[j]); - rowData[1].push(cellData); - } - tblData.push(rowData); - } - return tblData; - } - - /** - * Return the filtered data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredData', - value: function getFilteredData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (!this.validRowsIndex) { - return []; - } - var rows = this.tbl.rows, - filteredData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - filteredData.push([this.getHeadersRowIndex(), headers]); - } - - var validRows = this.getValidRows(true); - for (var i = 0; i < validRows.length; i++) { - var rData = [this.validRowsIndex[i], []], - cells = rows[this.validRowsIndex[i]].cells; - for (var k = 0; k < cells.length; k++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(k)) { - continue; - } - } - var cellData = this.getCellData(cells[k]); - rData[1].push(cellData); - } - filteredData.push(rData); - } - return filteredData; - } - - /** - * Return the filtered data for a given column index - * @param {Number} colIndex Colmun's index - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} Flat list of values ['val0','val1','val2'...] - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredDataCol', - value: function getFilteredDataCol(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (_types2.default.isUndef(colIndex)) { - return []; - } - var data = this.getFilteredData(), - colData = []; - if (includeHeaders) { - colData.push(this.getHeadersText()[colIndex]); - } - for (var i = 0, len = data.length; i < len; 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; - } - - /** - * Get the display value of a row - * @param {RowElement} DOM element of the row - * @return {String} Usually 'none' or '' - */ - - }, { - key: 'getRowDisplay', - value: function getRowDisplay(row) { - if (!_types2.default.isObj(row)) { - return null; - } - return row.style.display; - } - - /** - * Validate/invalidate row by setting the 'validRow' attribute on the row - * @param {Number} rowIndex Index of the row - * @param {Boolean} isValid - */ - - }, { - key: 'validateRow', - value: function validateRow(rowIndex, isValid) { - var row = this.tbl.rows[rowIndex]; - if (!row || typeof isValid !== 'boolean') { - return; - } - - // always visible rows are valid - if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { - isValid = true; - } - - var displayFlag = isValid ? '' : 'none', - validFlag = isValid ? 'true' : 'false'; - row.style.display = displayFlag; - - if (this.paging) { - row.setAttribute('validRow', validFlag); - } - - if (isValid) { - if (this.validRowsIndex.indexOf(rowIndex) === -1) { - this.validRowsIndex.push(rowIndex); - } - - if (this.onRowValidated) { - this.onRowValidated.call(null, this, rowIndex); - } - - this.emitter.emit('row-validated', this, rowIndex); - } - } - - /** - * Validate all filterable rows - */ - - }, { - key: 'validateAllRows', - value: function validateAllRows() { - if (!this._hasGrid) { - return; - } - this.validRowsIndex = []; - for (var k = this.refRow; k < this.nbFilterableRows; k++) { - this.validateRow(k, true); - } - } - - /** - * Set search value to a given filter - * @param {Number} index Column's index - * @param {String} searcharg Search term - */ - - }, { - key: 'setFilterValue', - value: function setFilterValue(index) { - var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; - - if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { - return; - } - var slc = this.getFilterElement(index), - fltColType = this.getFilterType(index); - - if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { - slc.value = searcharg; - } - //multiple selects - else if (fltColType === this.fltTypeMulti) { - var s = searcharg.split(' ' + this.orOperator + ' '); - // let ct = 0; //keywords counter - for (var j = 0, len = slc.options.length; j < len; j++) { - var option = slc.options[j]; - if (s === '' || s[0] === '') { - option.selected = false; - } - if (option.value === '') { - option.selected = false; - } - if (option.value !== '' && _array2.default.has(s, option.value, true)) { - option.selected = true; - } //if - } //for j - } - //checklist - else if (fltColType === this.fltTypeCheckList) { - searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); - var sarg = searcharg.split(' ' + this.orOperator + ' '); - var lisNb = _dom2.default.tag(slc, 'li').length; - - slc.setAttribute('value', ''); - slc.setAttribute('indexes', ''); - - for (var k = 0; k < lisNb; k++) { - var li = _dom2.default.tag(slc, 'li')[k], - lbl = _dom2.default.tag(li, 'label')[0], - chk = _dom2.default.tag(li, 'input')[0], - lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); - if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { - chk.checked = true; - this.Mod.checkList.setCheckListValues(chk); - } else { - chk.checked = false; - this.Mod.checkList.setCheckListValues(chk); - } - } - } - } - - /** - * Set them columns' widths as per configuration - * @param {Number} rowIndex Optional row index to apply the widths to - * @param {Element} tbl DOM element - */ - - }, { - key: 'setColWidths', - value: function setColWidths(rowIndex, tbl) { - if (!this.fltGrid || !this.hasColWidths) { - return; - } - tbl = tbl || this.tbl; - var rIndex = undefined; - if (rowIndex === undefined) { - rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; - } else { - rIndex = rowIndex; - } - - setWidths.call(this); - - function setWidths() { - /*jshint validthis:true */ - var nbCols = this.nbCells; - var colWidths = this.colWidths; - var colTags = _dom2.default.tag(tbl, 'col'); - var tblHasColTag = colTags.length > 0; - var frag = !tblHasColTag ? doc.createDocumentFragment() : null; - for (var k = 0; k < nbCols; k++) { - var col = undefined; - if (tblHasColTag) { - col = colTags[k]; - } else { - col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); - frag.appendChild(col); - } - col.style.width = colWidths[k]; - } - if (!tblHasColTag) { - tbl.insertBefore(frag, tbl.firstChild); - } - } - } - - /** - * Makes defined rows always visible - */ - - }, { - key: 'enforceVisibility', - value: function enforceVisibility() { - if (!this.hasVisibleRows) { - return; - } - for (var i = 0, len = this.visibleRows.length; i < len; i++) { - var row = this.visibleRows[i]; - //row index cannot be > nrows - if (row <= this.nbRows) { - this.validateRow(row, true); - } - } - } - - /** - * Clear all the filters' values - */ - - }, { - key: 'clearFilters', - value: function clearFilters() { - if (!this.fltGrid) { - return; - } - - this.emitter.emit('before-clearing-filters', this); - - if (this.onBeforeReset) { - this.onBeforeReset.call(null, this, this.getFiltersValue()); - } - for (var i = 0, len = this.fltIds.length; i < len; i++) { - this.setFilterValue(i, ''); - } - // if(this.linkedFilters){ - // this.linkFilters(); - // } - if (this.rememberPageLen) { - _cookie2.default.remove(this.pgLenCookie); - } - if (this.rememberPageNb) { - _cookie2.default.remove(this.pgNbCookie); - } - if (this.onAfterReset) { - this.onAfterReset.call(null, this); - } - - this.filter(); - - this.emitter.emit('after-clearing-filters', this); - } - - /** - * Clears filtered columns visual indicator (background color) - */ - - }, { - key: 'clearActiveColumns', - value: function clearActiveColumns() { - for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { - _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); - } - } - - /** - * Mark currently filtered column - * @param {Number} colIndex Column index - */ - - }, { - key: 'markActiveColumn', - value: function markActiveColumn(colIndex) { - var header = this.getHeaderElement(colIndex); - if (_dom2.default.hasClass(header, this.activeColumnsCssClass)) { - return; - } - if (this.onBeforeActiveColumn) { - this.onBeforeActiveColumn.call(null, this, colIndex); - } - _dom2.default.addClass(header, this.activeColumnsCssClass); - if (this.onAfterActiveColumn) { - this.onAfterActiveColumn.call(null, this, colIndex); - } - } - - /** - * Refresh the filters subject to linking ('select', 'multiple', - * 'checklist' type) - */ - - }, { - key: 'linkFilters', - value: function linkFilters() { - if (!this.linkedFilters || !this.activeFilterId) { - return; - } - 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); - - var activeFlt = this.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(this.prfxFlt)[1]; - var slcSelectedValue = undefined; - for (var i = 0, len = slcIndex.length; i < len; i++) { - var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); - slcSelectedValue = this.getFilterValue(slcIndex[i]); - - // Welcome to cyclomatic complexity hell :) - // TODO: simplify/refactor if statement - if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; - } else { - curSlc.innerHTML = ''; - } - - //1st option needs to be inserted - if (this.loadFltOnDemand) { - var opt0 = _dom2.default.createOpt(this.displayAllText, ''); - if (curSlc) { - curSlc.appendChild(opt0); - } - } - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.build(slcIndex[i]); - } else { - this.Mod.dropdown.build(slcIndex[i], true); - } - - this.setFilterValue(slcIndex[i], slcSelectedValue); - } - } // for i - } - - /** - * Re-generate the filters grid bar when previously removed - */ - - }, { - key: '_resetGrid', - value: function _resetGrid() { - if (this.isFirstLoad) { - return; - } - - var Mod = this.Mod; - var tbl = this.tbl; - var rows = tbl.rows; - var filtersRowIndex = this.filtersRowIndex; - var filtersRow = rows[filtersRowIndex]; - - // grid was removed, grid row element is stored in fltGridEl property - if (!this.gridLayout) { - // If table has a thead ensure the filters row is appended in the - // thead element - if (tbl.tHead) { - var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); - tbl.tHead.replaceChild(this.fltGridEl, tempRow); - } else { - filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); - } - - _dom2.default.addClass(tbl, this.prfxTf); - } - - // filters are appended in external placeholders elements - if (this.isExternalFlt) { - var externalFltTgtIds = this.externalFltTgtIds; - for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { - var extFlt = _dom2.default.id(externalFltTgtIds[ct]); - - if (!extFlt) { - continue; - } - - var externalFltEl = this.externalFltEls[ct]; - extFlt.appendChild(externalFltEl); - var colFltType = this.getFilterType(ct); - //IE special treatment for gridLayout, appended filters are - //empty - if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { - if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { - Mod.dropdown.build(ct); - } - if (colFltType === this.fltTypeCheckList) { - Mod.checkList.build(ct); - } - } - } - } - - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = rows.length; - - if (this.popupFilters) { - this.headersRow++; - Mod.popupFilter.reset(); - } - - this._hasGrid = true; - } - - /** - * Determines if passed filter column implements exact query match - * @param {Number} colIndex [description] - * @return {Boolean} [description] - */ - - }, { - key: 'isExactMatch', - value: function isExactMatch(colIndex) { - var fltType = this.getFilterType(colIndex); - return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; - } - - /** - * Check if passed script or stylesheet is already imported - * @param {String} filePath Ressource path - * @param {String} type Possible values: 'script' or 'link' - * @return {Boolean} - */ - - }, { - key: 'isImported', - value: function isImported(filePath, type) { - var imported = false, - importType = !type ? 'script' : type, - attr = importType == 'script' ? 'src' : 'href', - files = _dom2.default.tag(doc, importType); - for (var i = 0, len = files.length; i < len; i++) { - if (files[i][attr] === undefined) { - continue; - } - if (files[i][attr].match(filePath)) { - imported = true; - break; - } - } - return imported; - } - - /** - * Import script or stylesheet - * @param {String} fileId Ressource ID - * @param {String} filePath Ressource path - * @param {Function} callback Callback - * @param {String} type Possible values: 'script' or 'link' - */ - - }, { - key: 'import', - value: function _import(fileId, filePath, callback, type) { - var ftype = !type ? 'script' : type, - imported = this.isImported(filePath, ftype); - if (imported) { - return; - } - var o = this, - isLoaded = false, - file = undefined, - head = _dom2.default.tag(doc, 'head')[0]; - - if (_string2.default.lower(ftype) === 'link') { - file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); - } else { - file = _dom2.default.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: ' + filePath); - }; - head.appendChild(file); - } - - /** - * Check if table has filters grid - * @return {Boolean} - */ - - }, { - key: 'hasGrid', - value: function hasGrid() { - return this._hasGrid; - } - - /** - * Get list of filter IDs - * @return {[type]} [description] - */ - - }, { - key: 'getFiltersId', - value: function getFiltersId() { - return this.fltIds || []; - } - - /** - * Get filtered (valid) rows indexes - * @param {Boolean} reCalc Force calculation of filtered rows list - * @return {Array} List of row indexes - */ - - }, { - key: 'getValidRows', - value: function getValidRows(reCalc) { - 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; - } - - /** - * Get the index of the row containing the filters - * @return {Number} - */ - - }, { - key: 'getFiltersRowIndex', - value: function getFiltersRowIndex() { - return this.filtersRowIndex; - } - - /** - * Get the index of the headers row - * @return {Number} - */ - - }, { - key: 'getHeadersRowIndex', - value: function getHeadersRowIndex() { - return this.headersRow; - } - - /** - * Get the row index from where the filtering process start (1st filterable - * row) - * @return {Number} - */ - - }, { - key: 'getStartRowIndex', - value: function getStartRowIndex() { - return this.refRow; - } - - /** - * Get the index of the last row - * @return {Number} - */ - - }, { - key: 'getLastRowIndex', - value: function getLastRowIndex() { - if (!this._hasGrid) { - return; - } - return this.nbRows - 1; - } - - /** - * Get the header DOM element for a given column index - * @param {Number} colIndex Column index - * @return {Object} - */ - - }, { - key: 'getHeaderElement', - value: function getHeaderElement(colIndex) { - var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; - var tHead = _dom2.default.tag(table, 'thead'); - var headersRow = this.headersRow; - var header = undefined; - for (var i = 0; i < this.nbCells; i++) { - if (i !== colIndex) { - continue; - } - if (tHead.length === 0) { - header = table.rows[headersRow].cells[i]; - } - if (tHead.length === 1) { - header = tHead[0].rows[headersRow].cells[i]; - } - break; - } - return header; - } - - /** - * Return the list of headers' text - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} list of headers' text - */ - - }, { - key: 'getHeadersText', - value: function getHeadersText() { - var excludeHiddenCols = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var headers = []; - for (var j = 0; j < this.nbCells; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var header = this.getHeaderElement(j); - var headerText = _dom2.default.getText(header); - headers.push(headerText); - } - return headers; - } - - /** - * Return the filter type for a specified column - * @param {Number} colIndex Column's index - * @return {String} - */ - - }, { - key: 'getFilterType', - value: function getFilterType(colIndex) { - var colType = this.cfg['col_' + colIndex]; - return !colType ? this.fltTypeInp : _string2.default.lower(colType); - } - - /** - * Get the total number of filterable rows - * @return {Number} - */ - - }, { - key: 'getFilterableRowsNb', - value: function getFilterableRowsNb() { - return this.getRowsNb(false); - } - - /** - * Get the configuration object (literal object) - * @return {Object} - */ - - }, { - key: 'config', - value: function config() { - return this.cfg; - } - }]); - - return TableFilter; - })(); - -/***/ }, -/* 1 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * DOM event utilities - */ - - exports.default = { - 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; - } - }, - target: function target(evt) { - return evt && evt.target || window.event && window.event.srcElement; - }, - keyCode: function keyCode(evt) { - return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; - } - }; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * DOM utilities - */ - - exports.default = { - - /** - * Returns text + text of children of given node - * @param {NodeElement} node - * @return {String} - */ - - getText: function getText(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 - */ - create: function create(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]); - } - } - } - return el; - }, - - /** - * Removes passed node from DOM - * @param {DOMElement} node - * @return {DOMElement} old node reference - */ - remove: function remove(node) { - return node.parentNode.removeChild(node); - }, - - /** - * Returns a text node with given text - * @param {String} txt - * @return {Object} - */ - text: function text(txt) { - return document.createTextNode(txt); - }, - hasClass: function hasClass(ele, cls) { - if (!ele) { - return false; - } - - if (supportsClassList()) { - return ele.classList.contains(cls); - } - return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); - }, - addClass: function addClass(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; - } - }, - removeClass: function removeClass(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 - */ - createOpt: function createOpt(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 - */ - createCheckItem: function createCheckItem(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; - }, - id: function id(key) { - return document.getElementById(key); - }, - tag: function tag(o, tagname) { - return o.getElementsByTagName(tagname); - } - }; - - // HTML5 classList API - - function supportsClassList() { - return document.documentElement.classList; - } - -/***/ }, -/* 3 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * String utilities - */ - - exports.default = { - lower: function lower(text) { - return text.toLowerCase(); - }, - upper: function upper(text) { - return text.toUpperCase(); - }, - trim: function trim(text) { - if (text.trim) { - return text.trim(); - } - return text.replace(/^\s*|\s*$/g, ''); - }, - isEmpty: function isEmpty(text) { - return this.trim(text) === ''; - }, - rgxEsc: function rgxEsc(text) { - var chars = /[-\/\\^$*+?.()|[\]{}]/g; - var escMatch = '\\$&'; - return String(text).replace(chars, escMatch); - }, - matchCase: function matchCase(text, caseSensitive) { - if (!caseSensitive) { - return this.lower(text); - } - return text; - }, - - /** - * Checks if passed data contains the searched term - * @param {String} term Searched term - * @param {String} data Data string - * @param {Boolean} exactMatch Exact match - * @param {Boolean} caseSensitive Case sensitive - * @return {Boolean} - */ - contains: function contains(term, data) { - var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; - - // Improved by Cedric Wartel (cwl) automatic exact match for selects and - // special characters are now filtered - var regexp = undefined, - modifier = caseSensitive ? 'g' : 'gi'; - if (exactMatch) { - regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); - } else { - regexp = new RegExp(this.rgxEsc(term), modifier); - } - return regexp.test(data); - } - }; - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Cookie utilities - */ - - exports.default = { - write: function write(name, value, hours) { - var expire = ''; - if (hours) { - expire = new Date(new Date().getTime() + hours * 3600000); - expire = '; expires=' + expire.toGMTString(); - } - document.cookie = name + '=' + escape(value) + expire; - }, - read: function read(name) { - var cookieValue = '', - search = name + '='; - if (document.cookie.length > 0) { - var cookie = document.cookie, - offset = cookie.indexOf(search); - if (offset !== -1) { - offset += search.length; - var end = cookie.indexOf(';', offset); - if (end === -1) { - end = cookie.length; - } - cookieValue = unescape(cookie.substring(offset, end)); - } - } - return cookieValue; - }, - remove: function remove(name) { - this.write(name, '', -1); - }, - valueToArray: function valueToArray(name, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.read(name); - //creates an array with filters' values - var arr = val.split(separator); - return arr; - }, - getValueByIndex: function getValueByIndex(name, index, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.valueToArray(name, separator); - return val[index]; - } - }; - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * Types utilities - */ - - var UNDEFINED = void 0; - - exports.default = { - /** - * Check if argument is an object or a global object - * @param {String or Object} v - * @return {Boolean} - */ - - isObj: function isObj(v) { - var isO = false; - if (typeof v === 'string') { - if (window[v] && _typeof(window[v]) === 'object') { - isO = true; - } - } else { - if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { - isO = true; - } - } - return isO; - }, - - /** - * Check if argument is a function - * @param {Function} fn - * @return {Boolean} - */ - isFn: function isFn(fn) { - return fn && fn.constructor == Function; - }, - - /** - * Check if argument is an array - * @param {Array} obj - * @return {Boolean} - */ - isArray: function isArray(obj) { - return obj && obj.constructor == Array; - }, - - /** - * Determine if argument is undefined - * @param {Any} o - * @return {Boolean} - */ - isUndef: function isUndef(o) { - return o === UNDEFINED; - }, - - /** - * Determine if argument is null - * @param {Any} o - * @return {Boolean} - */ - isNull: function isNull(o) { - return o === null; - }, - - /** - * Determine if argument is empty (undefined, null or empty string) - * @param {Any} o - * @return {Boolean} - */ - isEmpty: function isEmpty(o) { - return this.isUndef(o) || this.isNull(o) || o.length === 0; - } - }; - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - has: function has(arr, val, caseSensitive) { - var sCase = caseSensitive === undefined ? false : caseSensitive; - for (var i = 0; i < arr.length; i++) { - if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { - return true; - } - } - return false; - } - }; /** - * Array utilities - */ - -/***/ }, -/* 7 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Date utilities - */ - - exports.default = { - 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 = undefined, - reg2 = undefined; - // 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 = undefined, - dd = undefined, - yy = undefined; - // 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(dateStr, formatStr) { - if (!formatStr) { - formatStr = 'DMY'; - } - if (!dateStr || dateStr === '') { - return new Date(1001, 0, 1); - } - var oDate = undefined; - var parts = undefined; - - switch (formatStr.toUpperCase()) { - case 'DDMMMYYYY': - parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); - oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); - break; - case 'DMY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'MDY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'YMD': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - default: - //in case format is not correct - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - } - return oDate; - } - }; - - function y2kDate(yr) { - if (yr === undefined) { - return 0; - } - if (yr.length > 2) { - return yr; - } - var y = undefined; - //>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; - } - - function mmm2mm(mmm) { - if (mmm === undefined) { - return 0; - } - var mondigit = undefined; - 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; - } - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - removeNbFormat: function removeNbFormat(data, format) { - if (!data) { - return; - } - if (!format) { - format = 'us'; - } - var n = data; - if (_string2.default.lower(format) === 'us') { - n = +n.replace(/[^\d\.-]/g, ''); - } else { - n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); - } - return n; - } - }; /** - * Misc helpers - */ - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - "use strict"; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /** - * Event emitter class - */ - - var Emitter = exports.Emitter = (function () { - function Emitter() { - _classCallCheck(this, Emitter); - - /** - * Events object - * @type {Object} - */ - this.events = {}; - } - - /** - * Subscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - _createClass(Emitter, [{ - key: "on", - value: function on(evts, fn) { - var _this = this; - - evts.forEach(function (evt) { - _this.events[evt] = _this.events[evt] || []; - _this.events[evt].push(fn); - }); - } - - /** - * Unsubscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - }, { - key: "off", - value: function off(evts, fn) { - var _this2 = this; - - evts.forEach(function (evt) { - if (evt in _this2.events) { - _this2.events[evt].splice(_this2.events[evt].indexOf(fn), 1); - } - }); - } - - /** - * Emit an event - * @param {String} evt Event name followed by any other argument passed to - * the invoked function - */ - - }, { - key: "emit", - value: function emit(evt /*, args...*/) { - if (evt in this.events) { - for (var i = 0; i < this.events[evt].length; i++) { - this.events[evt][i].apply(this, [].slice.call(arguments, 1)); - } - } - } - }]); - - return Emitter; - })(); - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Store = undefined; - - var _cookie = __webpack_require__(4); - - var _cookie2 = _interopRequireDefault(_cookie); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Store = exports.Store = (function () { - - /** - * Store, persistence manager - * @param {Object} tf TableFilter instance - * - * TODO: use localStorage and fallback to cookie persistence - */ - - function Store(tf) { - _classCallCheck(this, Store); - - var f = tf.config(); - - this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(Store, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on(['after-filtering'], function () { - return _this.saveFilterValues(_this.tf.fltsValuesCookie); - }); - } - - /** - * Store filters' values in cookie - * @param {String} cookie name - */ - - }, { - key: 'saveFilterValues', - value: function saveFilterValues(name) { - var tf = this.tf; - var fltValues = []; - //store filters' values - for (var i = 0; i < tf.fltIds.length; i++) { - var value = tf.getFilterValue(i); - if (value === '') { - value = ' '; - } - fltValues.push(value); - } - //adds array size - fltValues.push(tf.fltIds.length); - - //writes cookie - _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); - } - - /** - * Retrieve filters' values from cookie - * @param {String} cookie name - * @return {Array} - */ - - }, { - key: 'getFilterValues', - value: function getFilterValues(name) { - var flts = _cookie2.default.read(name); - var rgx = new RegExp(this.tf.separator, 'g'); - // filters' values array - return flts.split(rgx); - } - - /** - * Store page number in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageNb', - value: function savePageNb(name) { - _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); - } - - /** - * Retrieve page number from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageNb', - value: function getPageNb(name) { - return _cookie2.default.read(name); - } - - /** - * Store page length in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageLength', - value: function savePageLength(name) { - _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); - } - - /** - * Retrieve page length from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageLength', - value: function getPageLength(name) { - return _cookie2.default.read(name); - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off(['after-filtering'], function () { - return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); - }); - } - }]); - - return Store; - })(); - -/***/ }, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.GridLayout = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var GridLayout = exports.GridLayout = (function (_Feature) { - _inherits(GridLayout, _Feature); - - /** - * Grid layout, table with fixed headers - * @param {Object} tf TableFilter instance - */ - - function GridLayout(tf) { - _classCallCheck(this, GridLayout); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); - - var f = _this.config; - - //defines grid width - _this.gridWidth = f.grid_width || null; - //defines grid height - _this.gridHeight = f.grid_height || null; - //defines css class for main container - _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; - //defines css class for div containing table - _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; - //defines css class for div containing headers' table - _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; - //defines css class for div containing rows counter, paging etc. - _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; - //defines which row contains column headers - _this.gridHeadRowIndex = f.grid_headers_row_index || 0; - //array of headers row indexes to be placed in header table - _this.gridHeadRows = f.grid_headers_rows || [0]; - //generate filters in table headers - _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; - //default col width - _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; - - _this.gridColElms = []; - - //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_'; - - _this.sourceTblHtml = tf.tbl.outerHTML; - return _this; - } - - /** - * Generates a grid with fixed headers - */ - - _createClass(GridLayout, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - var f = this.config; - var tbl = tf.tbl; - - if (this.initialized) { - return; - } - - // Override reference rows indexes - tf.refRow = _types2.default.isNull(tf.startRow) ? 0 : tf.startRow; - tf.headersRow = 0; - tf.filtersRowIndex = 1; - - tf.isExternalFlt = true; - - // default width of 100px if column widths not set - if (!tf.hasColWidths) { - tf.colWidths = []; - for (var k = 0; k < tf.nbCells; k++) { - var colW = undefined, - cell = tbl.rows[this.gridHeadRowIndex].cells[k]; - if (cell.width !== '') { - colW = cell.width; - } else if (cell.style.width !== '') { - colW = parseInt(cell.style.width, 10); - } else { - colW = this.gridDefaultColWidth; - } - tf.colWidths[k] = colW; - } - tf.hasColWidths = true; - } - tf.setColWidths(this.gridHeadRowIndex); - - var tblW = undefined; //initial table width - if (tbl.width !== '') { - tblW = tbl.width; - } else if (tbl.style.width !== '') { - tblW = parseInt(tbl.style.width, 10); - } else { - tblW = tbl.clientWidth; - } - - //Main container: it will contain all the elements - this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); - this.tblMainCont.className = this.gridMainContCssClass; - if (this.gridWidth) { - this.tblMainCont.style.width = this.gridWidth; - } - tbl.parentNode.insertBefore(this.tblMainCont, tbl); - - //Table container: div wrapping content table - this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); - this.tblCont.className = this.gridContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.tblCont.style.width = '100%'; - } else { - this.tblCont.style.width = this.gridWidth; - } - } - if (this.gridHeight) { - this.tblCont.style.height = this.gridHeight; - } - tbl.parentNode.insertBefore(this.tblCont, tbl); - var t = _dom2.default.remove(tbl); - this.tblCont.appendChild(t); - - //In case table width is expressed in % - if (tbl.style.width === '') { - tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; - } - - var d = _dom2.default.remove(this.tblCont); - this.tblMainCont.appendChild(d); - - //Headers table container: div wrapping headers table - this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); - this.headTblCont.className = this.gridHeadContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.headTblCont.style.width = '100%'; - } else { - this.headTblCont.style.width = this.gridWidth; - } - } - - //Headers table - this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); - var tH = _dom2.default.create('tHead'); - - //1st row should be headers row, ids are added if not set - //Those ids are used by the sort feature - var hRow = tbl.rows[this.gridHeadRowIndex]; - var sortTriggers = []; - for (var n = 0; n < tf.nbCells; n++) { - var c = hRow.cells[n]; - var thId = c.getAttribute('id'); - if (!thId || thId === '') { - thId = this.prfxGridTh + n + '_' + tf.id; - c.setAttribute('id', thId); - } - sortTriggers.push(thId); - } - - //Filters row is created - var filtersRow = _dom2.default.create('tr'); - if (this.gridEnableFilters && tf.fltGrid) { - tf.externalFltTgtIds = []; - for (var j = 0; j < tf.nbCells; j++) { - var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; - var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); - filtersRow.appendChild(cl); - tf.externalFltTgtIds[j] = fltTdId; - } - } - //Headers row are moved from content table to headers table - for (var i = 0; i < this.gridHeadRows.length; i++) { - var headRow = tbl.rows[this.gridHeadRows[0]]; - tH.appendChild(headRow); - } - this.headTbl.appendChild(tH); - if (tf.filtersRowIndex === 0) { - tH.insertBefore(filtersRow, hRow); - } else { - tH.appendChild(filtersRow); - } - - this.headTblCont.appendChild(this.headTbl); - this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); - - //THead needs to be removed in content table for sort feature - var thead = _dom2.default.tag(tbl, 'thead'); - if (thead.length > 0) { - tbl.removeChild(thead[0]); - } - - //Headers table style - this.headTbl.style.tableLayout = 'fixed'; - tbl.style.tableLayout = 'fixed'; - this.headTbl.cellPadding = tbl.cellPadding; - this.headTbl.cellSpacing = tbl.cellSpacing; - // this.headTbl.style.width = tbl.style.width; - - //content table without headers needs col widths to be reset - tf.setColWidths(0, this.headTbl); - - //Headers container width - // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; - - tbl.style.width = ''; - // - this.headTbl.style.width = tbl.clientWidth + 'px'; - // - - //scroll synchronisation - _event2.default.add(this.tblCont, 'scroll', function (evt) { - var elm = _event2.default.target(evt); - var scrollLeft = elm.scrollLeft; - _this2.headTblCont.scrollLeft = scrollLeft; - //New pointerX calc taking into account scrollLeft - // if(!o.isPointerXOverwritten){ - // try{ - // o.Evt.pointerX = function(evt){ - // let e = evt || global.event; - // let bdScrollLeft = tf_StandardBody().scrollLeft + - // scrollLeft; - // return (e.pageX + scrollLeft) || - // (e.clientX + bdScrollLeft); - // }; - // o.isPointerXOverwritten = true; - // } catch(err) { - // o.isPointerXOverwritten = false; - // } - // } - }); - - //Configure sort extension if any - var sort = (f.extensions || []).filter(function (itm) { - return itm.name === 'sort'; - }); - if (sort.length === 1) { - sort[0].async_sort = true; - sort[0].trigger_ids = sortTriggers; - } - - //Cols generation for all browsers excepted IE<=7 - this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; - - //Col elements are enough to keep column widths after sorting and - //filtering - var createColTags = function createColTags() { - for (var k = tf.nbCells - 1; k >= 0; k--) { - var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); - tbl.insertBefore(col, tbl.firstChild); - col.style.width = tf.colWidths[k]; - this.gridColElms[k] = col; - } - this.tblHasColTag = true; - }; - - if (!this.tblHasColTag) { - createColTags.call(this); - } else { - var cols = _dom2.default.tag(tbl, 'col'); - for (var ii = 0; ii < tf.nbCells; ii++) { - cols[ii].setAttribute('id', tf.id + '_col_' + ii); - cols[ii].style.width = tf.colWidths[ii]; - this.gridColElms.push(cols[ii]); - } - } - - var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; - f.on_after_col_resized = function (o, colIndex) { - if (!colIndex) { - return; - } - var w = o.crWColsRow.cells[colIndex].style.width; - var col = o.gridColElms[colIndex]; - col.style.width = w; - - var thCW = o.crWColsRow.cells[colIndex].clientWidth; - var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; - - if (thCW != tdCW) { - o.headTbl.style.width = tbl.clientWidth + 'px'; - } - - if (afterColResizedFn) { - afterColResizedFn.call(null, o, colIndex); - } - }; - - if (tf.popupFilters) { - filtersRow.style.display = 'none'; - } - - if (tbl.clientWidth !== this.headTbl.clientWidth) { - tbl.style.width = this.headTbl.clientWidth + 'px'; - } - - this.initialized = true; - } - - /** - * Removes the grid layout - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - var tbl = tf.tbl; - - if (!this.initialized) { - return; - } - var t = _dom2.default.remove(tbl); - this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); - _dom2.default.remove(this.tblMainCont); - - this.tblMainCont = null; - this.headTblCont = null; - this.headTbl = null; - this.tblCont = null; - - tbl.outerHTML = this.sourceTblHtml; - //needed to keep reference of table element for future usage - this.tf.tbl = t; - - this.initialized = false; - } - }]); - - return GridLayout; - })(_feature.Feature); - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var NOTIMPLEMENTED = 'Not implemented.'; - - var Feature = exports.Feature = (function () { - function Feature(tf, feature) { - _classCallCheck(this, Feature); - - this.tf = tf; - this.feature = feature; - this.enabled = tf[feature]; - this.config = tf.config(); - this.emitter = tf.emitter; - this.initialized = false; - } - - _createClass(Feature, [{ - key: 'init', - value: function init() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - } - }, { - key: 'destroy', - value: function destroy() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'enable', - value: function enable() { - this.enabled = true; - } - }, { - key: 'disable', - value: function disable() { - this.enabled = false; - } - }, { - key: 'isEnabled', - value: function isEnabled() { - return this.enabled; - } - }]); - - return Feature; - })(); - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Loader = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var Loader = exports.Loader = (function (_Feature) { - _inherits(Loader, _Feature); - - /** - * Loading message/spinner - * @param {Object} tf TableFilter instance - */ - - function Loader(tf) { - _classCallCheck(this, Loader); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); - - var f = _this.config; - - //id of container element - _this.loaderTgtId = f.loader_target_id || null; - //div containing loader - _this.loaderDiv = null; - //defines loader text - _this.loaderText = f.loader_text || 'Loading...'; - //defines loader innerHtml - _this.loaderHtml = f.loader_html || null; - //defines css class for loader div - _this.loaderCssClass = f.loader_css_class || 'loader'; - //delay for hiding loader - _this.loaderCloseDelay = 250; - //callback function before loader is displayed - _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; - //callback function after loader is closed - _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; - //loader div - _this.prfxLoader = 'load_'; - return _this; - } - - _createClass(Loader, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); - containerDiv.className = this.loaderCssClass; - - var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); - if (!this.loaderTgtId) { - targetEl.insertBefore(containerDiv, tf.tbl); - } else { - targetEl.appendChild(containerDiv); - } - this.loaderDiv = containerDiv; - if (!this.loaderHtml) { - this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); - } else { - this.loaderDiv.innerHTML = this.loaderHtml; - } - - this.show('none'); - - // Subscribe to events - emitter.on(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this2.show(''); - }); - emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.show('none'); - }); - - this.initialized = true; - } - }, { - key: 'show', - value: function show(p) { - var _this3 = this; - - if (!this.isEnabled() /*|| this.loaderDiv.style.display === p*/) { - return; - } - - var displayLoader = function displayLoader() { - if (!_this3.loaderDiv) { - return; - } - if (_this3.onShowLoader && p !== 'none') { - _this3.onShowLoader.call(null, _this3); - } - _this3.loaderDiv.style.display = p; - if (_this3.onHideLoader && p === 'none') { - _this3.onHideLoader.call(null, _this3); - } - }; - - var t = p === 'none' ? this.loaderCloseDelay : 1; - global.setTimeout(displayLoader, t); - } - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - _dom2.default.remove(this.loaderDiv); - this.loaderDiv = null; - - // Unsubscribe to events - emitter.off(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this4.show(''); - }); - emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.show('none'); - }); - - this.initialized = false; - } - }]); - - return Loader; - })(_feature.Feature); - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.HighlightKeyword = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var HighlightKeyword = exports.HighlightKeyword = (function () { - - /** - * HighlightKeyword, highlight matched keyword - * @param {Object} tf TableFilter instance - */ - - function HighlightKeyword(tf) { - _classCallCheck(this, HighlightKeyword); - - var f = tf.config(); - //defines css class for highlighting - this.highlightCssClass = f.highlight_css_class || 'keyword'; - this.highlightedNodes = []; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(HighlightKeyword, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on(['before-filtering'], function () { - return _this.unhighlightAll(); - }); - } - - /** - * highlight occurences of searched term in passed node - * @param {Node} node - * @param {String} word Searched term - * @param {String} cssClass Css class name - */ - - }, { - key: 'highlight', - value: function highlight(node, word, cssClass) { - // Iterate into this nodes childNodes - if (node.hasChildNodes) { - var children = node.childNodes; - for (var i = 0; i < children.length; i++) { - this.highlight(children[i], word, cssClass); - } - } - - if (node.nodeType === 3) { - var tempNodeVal = _string2.default.lower(node.nodeValue); - var tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) != -1) { - var pn = node.parentNode; - if (pn && pn.className != cssClass) { - // word not highlighted yet - var nv = node.nodeValue, - ni = tempNodeVal.indexOf(tempWordVal), - - // Create a load of replacement nodes - before = _dom2.default.text(nv.substr(0, ni)), - docWordVal = nv.substr(ni, word.length), - after = _dom2.default.text(nv.substr(ni + word.length)), - hiwordtext = _dom2.default.text(docWordVal), - hiword = _dom2.default.create('span'); - hiword.className = cssClass; - hiword.appendChild(hiwordtext); - pn.insertBefore(before, node); - pn.insertBefore(hiword, node); - pn.insertBefore(after, node); - pn.removeChild(node); - this.highlightedNodes.push(hiword.firstChild); - } - } - } - } - - /** - * Removes highlight to nodes matching passed string - * @param {String} word - * @param {String} cssClass Css class to remove - */ - - }, { - key: 'unhighlight', - value: function unhighlight(word, cssClass) { - var arrRemove = []; - var highlightedNodes = this.highlightedNodes; - for (var i = 0; i < highlightedNodes.length; i++) { - var n = highlightedNodes[i]; - if (!n) { - continue; - } - var tempNodeVal = _string2.default.lower(n.nodeValue), - tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) !== -1) { - var pn = n.parentNode; - if (pn && pn.className === cssClass) { - var prevSib = pn.previousSibling, - nextSib = pn.nextSibling; - if (!prevSib || !nextSib) { - continue; - } - nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; - prevSib.nodeValue = ''; - n.nodeValue = ''; - arrRemove.push(i); - } - } - } - for (var k = 0; k < arrRemove.length; k++) { - highlightedNodes.splice(arrRemove[k], 1); - } - } - - /** - * Clear all occurrences of highlighted nodes - */ - - }, { - key: 'unhighlightAll', - value: function unhighlightAll() { - if (!this.tf.highlightKeywords || !this.tf.searchArgs) { - return; - } - for (var y = 0; y < this.tf.searchArgs.length; y++) { - this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); - } - this.highlightedNodes = []; - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off(['before-filtering'], function () { - return _this2.unhighlightAll(); - }); - } - }]); - - return HighlightKeyword; - })(); - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.PopupFilter = undefined; - - var _feature = __webpack_require__(12); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var PopupFilter = exports.PopupFilter = (function (_Feature) { - _inherits(PopupFilter, _Feature); - - /** - * Pop-up filter component - * @param {Object} tf TableFilter instance - */ - - function PopupFilter(tf) { - _classCallCheck(this, PopupFilter); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); - - var f = _this.config; - - // Enable external filters - tf.isExternalFlt = true; - tf.externalFltTgtIds = []; - - //filter icon path - _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; - //active filter icon path - _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; - _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; - //defines css class for popup div containing filter - _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; - //callback function before popup filtes is opened - _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; - //callback function after popup filtes is opened - _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; - //callback function before popup filtes is closed - _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; - //callback function after popup filtes is closed - _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; - - //stores filters spans - _this.popUpFltSpans = []; - //stores filters icons - _this.popUpFltImgs = []; - //stores filters containers - _this.popUpFltElms = _this.popUpFltElmCache || []; - _this.popUpFltAdjustToContainer = true; - - //id prefix for pop-up filter span - _this.prfxPopUpSpan = 'popUpSpan_'; - //id prefix for pop-up div containing filter - _this.prfxPopUpDiv = 'popUpDiv_'; - return _this; - } - - _createClass(PopupFilter, [{ - key: 'onClick', - value: function onClick(e) { - var evt = e || global.event, - elm = evt.target.parentNode, - colIndex = parseInt(elm.getAttribute('ci'), 10); - - this.closeAll(colIndex); - this.toggle(colIndex); - - if (this.popUpFltAdjustToContainer) { - var popUpDiv = this.popUpFltElms[colIndex], - header = this.tf.getHeaderElement(colIndex), - headerWidth = header.clientWidth * 0.95; - popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; - } - _event2.default.cancel(evt); - _event2.default.stop(evt); - } - - /** - * Initialize DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - // Override headers row index if no grouped headers - if (tf.headersRow <= 1) { - tf.headersRow = 0; - } - - for (var i = 0; i < tf.nbCells; i++) { - if (tf.getFilterType(i) === tf.fltTypeNone) { - continue; - } - var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); - popUpSpan.innerHTML = this.popUpImgFltHtml; - var header = tf.getHeaderElement(i); - header.appendChild(popUpSpan); - _event2.default.add(popUpSpan, 'click', function (evt) { - _this2.onClick(evt); - }); - this.popUpFltSpans[i] = popUpSpan; - this.popUpFltImgs[i] = popUpSpan.firstChild; - } - - // subscribe to events - this.emitter.on(['before-filtering'], function () { - return _this2.buildIcons(); - }); - this.emitter.on(['after-filtering'], function () { - return _this2.closeAll(); - }); - this.emitter.on(['cell-processed'], function (tf, cellIndex) { - return _this2.buildIcon(cellIndex, true); - }); - this.emitter.on(['filters-row-inserted'], function () { - return _this2.tf.headersRow++; - }); - this.emitter.on(['before-filter-init'], function (tf, colIndex) { - return _this2.build(colIndex); - }); - - this.initialized = true; - } - - /** - * Reset previously destroyed feature - */ - - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - this.buildAll(); - } - - /** - * Build all pop-up filters elements - */ - - }, { - key: 'buildAll', - value: function buildAll() { - for (var i = 0; i < this.popUpFltElmCache.length; i++) { - this.build(i, this.popUpFltElmCache[i]); - } - } - - /** - * Build a specified pop-up filter elements - * @param {Number} colIndex Column index - * @param {Object} div Optional container DOM element - */ - - }, { - key: 'build', - value: function build(colIndex, div) { - var tf = this.tf; - var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; - popUpDiv.className = this.popUpDivCssClass; - tf.externalFltTgtIds.push(popUpDiv.id); - var header = tf.getHeaderElement(colIndex); - header.insertBefore(popUpDiv, header.firstChild); - _event2.default.add(popUpDiv, 'click', function (evt) { - _event2.default.stop(evt); - }); - this.popUpFltElms[colIndex] = popUpDiv; - } - - /** - * Toogle visibility of specified filter - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggle', - value: function toggle(colIndex) { - var tf = this.tf, - popUpFltElm = this.popUpFltElms[colIndex]; - - if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { - if (this.onBeforePopUpOpen) { - this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'block'; - if (tf.getFilterType(colIndex) === tf.fltTypeInp) { - var flt = tf.getFilterElement(colIndex); - if (flt) { - flt.focus(); - } - } - if (this.onAfterPopUpOpen) { - this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } else { - if (this.onBeforePopUpClose) { - this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'none'; - if (this.onAfterPopUpClose) { - this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } - } - - /** - * Close all filters excepted for the specified one if any - * @param {Number} exceptIdx Column index of the filter to not close - */ - - }, { - key: 'closeAll', - value: function closeAll(exceptIdx) { - for (var i = 0; i < this.popUpFltElms.length; i++) { - if (i === exceptIdx) { - continue; - } - var popUpFltElm = this.popUpFltElms[i]; - if (popUpFltElm) { - popUpFltElm.style.display = 'none'; - } - } - } - - /** - * Build all the icons representing the pop-up filters - */ - - }, { - key: 'buildIcons', - value: function buildIcons() { - for (var i = 0; i < this.popUpFltImgs.length; i++) { - this.buildIcon(i, false); - } - } - - /** - * Apply specified icon state - * @param {Number} colIndex Column index - * @param {Boolean} active Apply active state - */ - - }, { - key: 'buildIcon', - value: function buildIcon(colIndex, active) { - if (this.popUpFltImgs[colIndex]) { - this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; - } - } - - /** - * Remove pop-up filters - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - this.popUpFltElmCache = []; - for (var i = 0; i < this.popUpFltElms.length; i++) { - var popUpFltElm = this.popUpFltElms[i], - popUpFltSpan = this.popUpFltSpans[i], - popUpFltImg = this.popUpFltImgs[i]; - if (popUpFltElm) { - _dom2.default.remove(popUpFltElm); - this.popUpFltElmCache[i] = popUpFltElm; - } - popUpFltElm = null; - if (popUpFltSpan) { - _dom2.default.remove(popUpFltSpan); - } - popUpFltSpan = null; - if (popUpFltImg) { - _dom2.default.remove(popUpFltImg); - } - popUpFltImg = null; - } - this.popUpFltElms = []; - this.popUpFltSpans = []; - this.popUpFltImgs = []; - - // unsubscribe to events - this.emitter.off(['before-filtering'], function () { - return _this3.buildIcons(); - }); - this.emitter.off(['after-filtering'], function () { - return _this3.closeAll(); - }); - this.emitter.off(['cell-processed'], function (tf, cellIndex) { - return _this3.buildIcon(cellIndex, true); - }); - this.emitter.off(['filters-row-inserted'], function () { - return _this3.tf.headersRow++; - }); - this.emitter.off(['before-filter-init'], function (tf, colIndex) { - return _this3.build(colIndex); - }); - - this.initialized = false; - } - }]); - - return PopupFilter; - })(_feature.Feature); - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Dropdown = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Dropdown = exports.Dropdown = (function (_Feature) { - _inherits(Dropdown, _Feature); - - /** - * Dropdown UI component - * @param {Object} tf TableFilter instance - */ - - function Dropdown(tf) { - _classCallCheck(this, Dropdown); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Dropdown).call(this, tf, 'dropdown')); - - var f = tf.config(); - - _this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; - //defines empty option text - _this.nonEmptyText = f.non_empty_text || '(Non empty)'; - //sets select filling method: 'innerHTML' or 'createElement' - _this.slcFillingMethod = f.slc_filling_method || 'createElement'; - //IE only, tooltip text appearing on select before it is populated - _this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; - //tooltip text appearing on multiple select - _this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; - - _this.isCustom = null; - _this.opts = null; - _this.optsTxt = null; - _this.slcInnerHtml = null; - return _this; - } - - /** - * Initialize drop-down filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - _createClass(Dropdown, [{ - key: 'init', - value: function init(colIndex, isExternal, container) { - var tf = this.tf; - var col = tf.getFilterType(colIndex); - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var slc = _dom2.default.create(tf.fltTypeSlc, ['id', tf.prfxFlt + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - - if (col === tf.fltTypeMulti) { - slc.multiple = tf.fltTypeMulti; - slc.title = this.multipleSlcTooltip; - } - slc.className = _string2.default.lower(col) === tf.fltTypeSlc ? tf.fltCssClass : tf.fltMultiCssClass; - - //filter is appended in container element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(slc); - tf.externalFltEls.push(slc); - } else { - container.appendChild(slc); - } - - tf.fltIds.push( /*this.prfxFlt+i+'_'+this.id*/slc.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - //1st option is created here since build isn't invoked - var opt0 = _dom2.default.createOpt(tf.displayAllText, ''); - slc.appendChild(opt0); - } - - _event2.default.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); - _event2.default.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); - _event2.default.add(slc, 'focus', tf.Evt.onSlcFocus.bind(tf)); - - this.initialized = true; - } - - /** - * Build drop-down filter UI - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Boolean} isExternal Render in external container - * @param {String} extSlcId External container id - */ - - }, { - key: 'build', - value: function build(colIndex) { - var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - this.slcInnerHtml = ''; - - var slcId = tf.fltIds[colIndex]; - if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { - return; - } - var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), - rows = tf.tbl.rows, - matchCase = tf.matchCase; - - //custom select test - this.isCustom = tf.isCustomOptions(colIndex); - - //custom selects text - var activeFlt = undefined; - if (isLinked && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - /*** remember grid values ***/ - var fltsValues = [], - fltArr = []; - // if(tf.rememberGridValues){ - // fltsValues = tf.feature('store').getFilterValues( - // tf.fltsValuesCookie); - // if(fltsValues && !Str.isEmpty(fltsValues.toString())){ - // if(this.isCustom){ - // fltArr.push(fltsValues[colIndex]); - // } else { - // fltArr = fltsValues[colIndex].split(' '+tf.orOperator+' '); - // } - // } - // } - - var excludedOpts = null, - filteredDataCol = null; - if (isLinked && tf.disableExcludedOptions) { - excludedOpts = []; - filteredDataCol = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cell = rows[k].cells, - nchilds = cell.length; - - // checks if row has exact cell # - if (nchilds !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - // WTF: cyclomatic complexity hell - if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cell[j]), - - //Vary Peter's patch - cell_string = _string2.default.matchCase(cell_data, matchCase); - - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, matchCase)) { - this.opts.push(cell_data); - } - - if (isLinked && tf.disableExcludedOptions) { - var filteredCol = filteredDataCol[j]; - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { - excludedOpts.push(cell_data); - } - } - } //if colIndex==j - } //for j - } //for k - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (excludedOpts) { - excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - } - } - - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (excludedOpts) { - excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (excludedOpts) { - excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - //populates drop-down - this.addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr); - - this.emitter.emit('after-populating-filter', tf, colIndex, slc); - } - - /** - * Add drop-down options - * @param {Number} colIndex Column index - * @param {Object} slc Select Dom element - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Array} excludedOpts Array of excluded options - * @param {Array} fltsValues Collection of persisted filter values - * @param {Array} fltArr Collection of persisted filter values - */ - - }, { - key: 'addOptions', - value: function addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod), - slcValue = slc.value; - - slc.innerHTML = ''; - slc = this.addFirstOption(slc); - - for (var y = 0; y < this.opts.length; y++) { - if (this.opts[y] === '') { - continue; - } - var val = this.opts[y]; //option value - var lbl = this.isCustom ? this.optsTxt[y] : val; //option text - var isDisabled = false; - if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - isDisabled = true; - } - - if (fillMethod === 'innerhtml') { - var slcAttr = ''; - if (tf.loadFltOnDemand && slcValue === this.opts[y]) { - slcAttr = 'selected="selected"'; - } - this.slcInnerHtml += ''; - } else { - var opt = undefined; - //fill select on demand - if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { - opt = _dom2.default.createOpt(lbl, val, true); - } else { - if (tf.getFilterType(colIndex) !== tf.fltTypeMulti) { - opt = _dom2.default.createOpt(lbl, val, fltsValues[colIndex] !== ' ' && val === fltsValues[colIndex] ? true : false); - } else { - opt = _dom2.default.createOpt(lbl, val, _array2.default.has(fltArr, _string2.default.matchCase(this.opts[y], tf.matchCase), tf.matchCase) || fltArr.toString().indexOf(val) !== -1 ? true : false); - } - } - if (isDisabled) { - opt.disabled = true; - } - slc.appendChild(opt); - } - } // for y - - if (fillMethod === 'innerhtml') { - slc.innerHTML += this.slcInnerHtml; - } - slc.setAttribute('filled', '1'); - } - - /** - * Add drop-down header option - * @param {Object} slc Select DOM element - */ - - }, { - key: 'addFirstOption', - value: function addFirstOption(slc) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod); - - if (fillMethod === 'innerhtml') { - this.slcInnerHtml += ''; - } else { - var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); - if (!this.enableSlcResetFilter) { - opt0.style.display = 'none'; - } - slc.appendChild(opt0); - if (tf.enableEmptyOption) { - var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); - slc.appendChild(opt1); - } - if (tf.enableNonEmptyOption) { - var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); - slc.appendChild(opt2); - } - } - return slc; - } - }, { - key: 'destroy', - value: function destroy() {} - }]); - - return Dropdown; - })(_feature.Feature); - -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - ignoreCase: function ignoreCase(a, b) { - var x = _string2.default.lower(a); - var y = _string2.default.lower(b); - return x < y ? -1 : x > y ? 1 : 0; - } - }; - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.CheckList = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var CheckList = exports.CheckList = (function (_Feature) { - _inherits(CheckList, _Feature); - - /** - * Checklist UI component - * @param {Object} tf TableFilter instance - */ - - function CheckList(tf) { - _classCallCheck(this, CheckList); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CheckList).call(this, tf, 'checkList')); - - var f = tf.config(); - - _this.checkListDiv = []; //checklist container div - //defines css class for div containing checklist filter - _this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; - //defines css class for checklist filters - _this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; - //defines css class for checklist item (li) - _this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; - //defines css class for selected checklist item (li) - _this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; - //Load on demand text - _this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; - //defines css class for checklist filters - _this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; - _this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; - //checklist filter container div - _this.prfxCheckListDiv = 'chkdiv_'; - - _this.isCustom = null; - _this.opts = null; - _this.optsTxt = null; - _this.excludedOpts = null; - return _this; - } - - // TODO: move event here - - _createClass(CheckList, [{ - key: 'onChange', - value: function onChange(evt) { - var elm = evt.target; - this.tf.activeFilterId = elm.getAttribute('id'); - this.tf.activeFlt = _dom2.default.id(this.tf.activeFilterId); - this.tf.Evt.onSlcChange.call(this.tf, evt); - } - }, { - key: 'optionClick', - value: function optionClick(evt) { - this.setCheckListValues(evt.target); - this.onChange(evt); - } - }, { - key: 'onCheckListClick', - value: function onCheckListClick(evt) { - var _this2 = this; - - var elm = _event2.default.target(evt); - if (this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - var div = this.checkListDiv[ct]; - this.build(ct); - _event2.default.remove(div, 'click', function (evt) { - return _this2.onCheckListClick(evt); - }); - } - } - - /** - * Initialize checklist filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - }, { - key: 'init', - value: function init(colIndex, isExternal, container) { - var _this3 = this; - - var tf = this.tf; - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var divCont = _dom2.default.create('div', ['id', this.prfxCheckListDiv + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - divCont.className = this.checkListDivCssClass; - - //filter is appended in desired element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(divCont); - tf.externalFltEls.push(divCont); - } else { - container.appendChild(divCont); - } - - this.checkListDiv[colIndex] = divCont; - tf.fltIds.push(tf.prfxFlt + colIndex + '_' + tf.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - _event2.default.add(divCont, 'click', function (evt) { - return _this3.onCheckListClick(evt); - }); - divCont.appendChild(_dom2.default.text(this.activateCheckListTxt)); - } - - this.initialized = true; - } - - /** - * Build checklist UI - * @param {Number} colIndex Column index - * @param {Boolean} isExternal Render in external container - * @param {String} extFltId External container id - */ - - }, { - key: 'build', - value: function build(colIndex) { - var _this4 = this; - - var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - - var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; - if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { - return; - } - - var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); - var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); - ul.className = this.checkListCssClass; - _event2.default.add(ul, 'change', function (evt) { - _this4.onChange(evt); - }); - - var rows = tf.tbl.rows; - this.isCustom = tf.isCustomOptions(colIndex); - - var activeFlt = undefined; - if (tf.linkedFilters && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - var filteredDataCol = []; - if (tf.linkedFilters && tf.disableExcludedOptions) { - this.excludedOpts = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cells = rows[k].cells; - var ncells = cells.length; - - // checks if row has exact cell # - if (ncells !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < ncells; j++) { - // WTF: cyclomatic complexity hell :) - if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cells[j]); - //Vary Peter's patch - var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { - this.opts.push(cell_data); - } - var filteredCol = filteredDataCol[j]; - if (tf.linkedFilters && tf.disableExcludedOptions) { - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { - this.excludedOpts.push(cell_data); - } - } - } - } - } - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!tf.matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (this.excludedOpts) { - this.excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - } - } - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - this.addChecks(colIndex, ul, tf.separator); - - if (tf.loadFltOnDemand) { - flt.innerHTML = ''; - } - flt.appendChild(ul); - flt.setAttribute('filled', '1'); - - this.emitter.emit('after-populating-filter', tf, colIndex, flt); - } - - /** - * Add checklist options - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addChecks', - value: function addChecks(colIndex, ul) { - var _this5 = this; - - var tf = this.tf; - var chkCt = this.addTChecks(colIndex, ul); - var fltArr = []; //remember grid values - // let store = tf.feature('store'); - // let tmpVal = store ? - // store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null; - // if(tmpVal && Str.trim(tmpVal).length > 0){ - // if(tf.hasCustomSlcOptions && - // tf.customSlcOptions.cols.indexOf(colIndex) != -1){ - // fltArr.push(tmpVal); - // } else { - // fltArr = tmpVal.split(' '+tf.orOperator+' '); - // } - // } - - for (var y = 0; y < this.opts.length; y++) { - var val = this.opts[y]; //item value - var lbl = this.isCustom ? this.optsTxt[y] : val; //item text - var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); - li.className = this.checkListItemCssClass; - if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - _dom2.default.addClass(li, this.checkListItemDisabledCssClass); - li.check.disabled = true; - li.disabled = true; - } else { - _event2.default.add(li.check, 'click', function (evt) { - _this5.optionClick(evt); - }); - } - ul.appendChild(li); - - if (val === '') { - //item is hidden - li.style.display = 'none'; - } - - /*** remember grid values ***/ - if (tf.rememberGridValues) { - if (tf.hasCustomSlcOptions && tf.customSlcOptions.cols.indexOf(colIndex) != -1 && fltArr.toString().indexOf(val) != -1 || _array2.default.has(fltArr, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - li.check.checked = true; - this.setCheckListValues(li.check); - } - } - } - } - - /** - * Add checklist header option - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addTChecks', - value: function addTChecks(colIndex, ul) { - var _this6 = this; - - var tf = this.tf; - var chkCt = 1; - var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); - li0.className = this.checkListItemCssClass; - ul.appendChild(li0); - - _event2.default.add(li0.check, 'click', function (evt) { - _this6.optionClick(evt); - }); - - if (!this.enableCheckListResetFilter) { - li0.style.display = 'none'; - } - - if (tf.enableEmptyOption) { - var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); - li1.className = this.checkListItemCssClass; - ul.appendChild(li1); - _event2.default.add(li1.check, 'click', function (evt) { - _this6.optionClick(evt); - }); - chkCt++; - } - - if (tf.enableNonEmptyOption) { - var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); - li2.className = this.checkListItemCssClass; - ul.appendChild(li2); - _event2.default.add(li2.check, 'click', function (evt) { - _this6.optionClick(evt); - }); - chkCt++; - } - return chkCt; - } - - /** - * Store checked options in DOM element attribute - * @param {Object} o checklist option DOM element - */ - - }, { - key: 'setCheckListValues', - value: function setCheckListValues(o) { - if (!o) { - return; - } - var tf = this.tf; - var chkValue = o.value; //checked item value - var chkIndex = parseInt(o.id.split('_')[2], 10); - var filterTag = 'ul', - itemTag = 'li'; - var n = o; - - //ul tag search - while (_string2.default.lower(n.nodeName) !== filterTag) { - n = n.parentNode; - } - - var li = n.childNodes[chkIndex]; - var colIndex = n.getAttribute('colIndex'); - var fltValue = n.getAttribute('value'); //filter value (ul tag) - var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) - - if (o.checked) { - //show all item - if (chkValue === '') { - if (fltIndexes && fltIndexes !== '') { - //items indexes - var indSplit = fltIndexes.split(tf.separator); - //checked items loop - for (var u = 0; u < indSplit.length; u++) { - //checked item - var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); - if (cChk) { - cChk.checked = false; - _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); - } - } - } - n.setAttribute('value', ''); - n.setAttribute('indexes', ''); - } else { - fltValue = fltValue ? fltValue : ''; - chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); - chkIndex = fltIndexes + chkIndex + tf.separator; - n.setAttribute('value', chkValue); - n.setAttribute('indexes', chkIndex); - //1st option unchecked - if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { - _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; - } - } - - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); - _dom2.default.addClass(li, this.checkListSlcItemCssClass); - } - } else { - //removes values and indexes - if (chkValue !== '') { - var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); - fltValue = fltValue.replace(replaceValue, ''); - n.setAttribute('value', _string2.default.trim(fltValue)); - - var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); - fltIndexes = fltIndexes.replace(replaceIndex, ''); - n.setAttribute('indexes', fltIndexes); - } - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(li, this.checkListSlcItemCssClass); - } - } - } - }, { - key: 'destroy', - value: function destroy() {} - }]); - - return CheckList; - })(_feature.Feature); - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.RowsCounter = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var RowsCounter = exports.RowsCounter = (function (_Feature) { - _inherits(RowsCounter, _Feature); - - /** - * Rows counter - * @param {Object} tf TableFilter instance - */ - - function RowsCounter(tf) { - _classCallCheck(this, RowsCounter); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); - - var f = _this.config; - - //id of custom container element - _this.rowsCounterTgtId = f.rows_counter_target_id || null; - //element containing tot nb rows - _this.rowsCounterDiv = null; - //element containing tot nb rows label - _this.rowsCounterSpan = null; - //defines rows counter text - _this.rowsCounterText = f.rows_counter_text || 'Rows: '; - _this.fromToTextSeparator = f.from_to_text_separator || '-'; - _this.overText = f.over_text || ' / '; - //defines css class rows counter - _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; - //rows counter div - _this.prfxCounter = 'counter_'; - //nb displayed rows label - _this.prfxTotRows = 'totrows_span_'; - //label preceding nb rows label - _this.prfxTotRowsTxt = 'totRowsTextSpan_'; - //callback raised before counter is refreshed - _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; - //callback raised after counter is refreshed - _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; - return _this; - } - - _createClass(RowsCounter, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - //rows counter container - var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); - countDiv.className = this.totRowsCssClass; - //rows counter label - var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); - var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); - countText.appendChild(_dom2.default.text(this.rowsCounterText)); - - // counter is added to defined element - if (!this.rowsCounterTgtId) { - tf.setToolbar(); - } - var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); - - //default container: 'lDiv' - if (!this.rowsCounterTgtId) { - countDiv.appendChild(countText); - countDiv.appendChild(countSpan); - targetEl.appendChild(countDiv); - } else { - //custom container, no need to append statusDiv - targetEl.appendChild(countText); - targetEl.appendChild(countSpan); - } - this.rowsCounterDiv = countDiv; - this.rowsCounterSpan = countSpan; - - // subscribe to events - this.emitter.on(['after-filtering', 'grouped-by-page'], function () { - return _this2.refresh(tf.nbVisibleRows); - }); - this.emitter.on(['rows-changed'], function () { - return _this2.refresh(); - }); - - this.initialized = true; - this.refresh(); - } - }, { - key: 'refresh', - value: function refresh(p) { - if (!this.initialized || !this.isEnabled()) { - return; - } - - var tf = this.tf; - - if (this.onBeforeRefreshCounter) { - this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); - } - - var totTxt; - if (!tf.paging) { - if (p && p !== '') { - totTxt = p; - } else { - totTxt = tf.nbFilterableRows - tf.nbHiddenRows; - } - } else { - var paging = tf.feature('paging'); - if (paging) { - //paging start row - var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); - var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; - totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; - } - } - - this.rowsCounterSpan.innerHTML = totTxt; - if (this.onAfterRefreshCounter) { - this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - if (!this.rowsCounterTgtId && this.rowsCounterDiv) { - _dom2.default.remove(this.rowsCounterDiv); - } else { - _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; - } - this.rowsCounterSpan = null; - this.rowsCounterDiv = null; - - // unsubscribe to events - this.emitter.off(['after-filtering', 'grouped-by-page'], function () { - return _this3.refresh(tf.nbVisibleRows); - }); - this.emitter.off(['rows-changed'], function () { - return _this3.refresh(); - }); - - this.initialized = false; - } - }]); - - return RowsCounter; - })(_feature.Feature); - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.StatusBar = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var StatusBar = exports.StatusBar = (function (_Feature) { - _inherits(StatusBar, _Feature); - - /** - * Status bar UI component - * @param {Object} tf TableFilter instance - */ - - function StatusBar(tf) { - _classCallCheck(this, StatusBar); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); - - var f = _this.config; - - //id of custom container element - _this.statusBarTgtId = f.status_bar_target_id || null; - //element containing status bar label - _this.statusBarDiv = null; - //status bar - _this.statusBarSpan = null; - //status bar label - _this.statusBarSpanText = null; - //defines status bar text - _this.statusBarText = f.status_bar_text || ''; - //defines css class status bar - _this.statusBarCssClass = f.status_bar_css_class || 'status'; - //delay for status bar clearing - _this.statusBarCloseDelay = 250; - - //calls function before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //calls function after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - - //status messages - _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 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)...'; - - // status bar div - _this.prfxStatus = 'status_'; - // status bar label - _this.prfxStatusSpan = 'statusSpan_'; - // text preceding status bar label - _this.prfxStatusTxt = 'statusText_'; - return _this; - } - - _createClass(StatusBar, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - //status bar container - var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); - statusDiv.className = this.statusBarCssClass; - - //status bar label - var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); - //preceding text - var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); - statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); - - // target element container - if (!this.statusBarTgtId) { - tf.setToolbar(); - } - var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); - - //default container: 'lDiv' - if (!this.statusBarTgtId) { - statusDiv.appendChild(statusSpanText); - statusDiv.appendChild(statusSpan); - targetEl.appendChild(statusDiv); - } else { - // custom container, no need to append statusDiv - targetEl.appendChild(statusSpanText); - targetEl.appendChild(statusSpan); - } - - this.statusBarDiv = statusDiv; - this.statusBarSpan = statusSpan; - this.statusBarSpanText = statusSpanText; - - // Subscribe to events - emitter.on(['before-filtering'], function () { - return _this2.message(_this2.msgFilter); - }); - emitter.on(['before-populating-filter'], function () { - return _this2.message(_this2.msgPopulate); - }); - emitter.on(['before-changing-page'], function () { - return _this2.message(_this2.msgChangePage); - }); - emitter.on(['before-clearing-filters'], function () { - return _this2.message(_this2.msgClear); - }); - emitter.on(['before-changing-results-per-page'], function () { - return _this2.message(_this2.msgChangeResults); - }); - emitter.on(['before-reset-page'], function () { - return _this2.message(_this2.msgResetPage); - }); - emitter.on(['before-reset-page-length'], function () { - return _this2.message(_this2.msgResetPageLength); - }); - emitter.on(['before-loading-extensions'], function () { - return _this2.message(_this2.msgLoadExtensions); - }); - emitter.on(['before-loading-themes'], function () { - return _this2.message(_this2.msgLoadThemes); - }); - - emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.message(''); - }); - - this.initialized = true; - } - }, { - key: 'message', - value: function message() { - var _this3 = this; - - var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; - - if (!this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, t); - } - - var d = t === '' ? this.statusBarCloseDelay : 1; - global.setTimeout(function () { - if (!_this3.initialized) { - return; - } - _this3.statusBarSpan.innerHTML = t; - if (_this3.onAfterShowMsg) { - _this3.onAfterShowMsg.call(null, _this3.tf, t); - } - }, d); - } - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - this.statusBarDiv.innerHTML = ''; - _dom2.default.remove(this.statusBarDiv); - this.statusBarSpan = null; - this.statusBarSpanText = null; - this.statusBarDiv = null; - - // Unsubscribe to events - emitter.off(['before-filtering'], function () { - return _this4.message(_this4.msgFilter); - }); - emitter.off(['before-populating-filter'], function () { - return _this4.message(_this4.msgPopulate); - }); - emitter.off(['before-changing-page'], function () { - return _this4.message(_this4.msgChangePage); - }); - emitter.off(['before-clearing-filters'], function () { - return _this4.message(_this4.msgClear); - }); - emitter.off(['before-changing-results-per-page'], function () { - return _this4.message(_this4.msgChangeResults); - }); - emitter.off(['before-reset-page'], function () { - return _this4.message(_this4.msgResetPage); - }); - emitter.off(['before-reset-page-length'], function () { - return _this4.message(_this4.msgResetPageLength); - }); - emitter.off(['before-loading-extensions'], function () { - return _this4.message(_this4.msgLoadExtensions); - }); - emitter.off(['before-loading-themes'], function () { - return _this4.message(_this4.msgLoadThemes); - }); - - emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.message(''); - }); - - this.initialized = false; - } - }]); - - return StatusBar; - })(_feature.Feature); - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Paging = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Paging = exports.Paging = (function (_Feature) { - _inherits(Paging, _Feature); - - /** - * Pagination component - * @param {Object} tf TableFilter instance - */ - - function Paging(tf) { - _classCallCheck(this, Paging); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); - - var f = _this.config; - - //css class for paging buttons (previous,next,etc.) - _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; - //stores paging select element - _this.pagingSlc = null; - //results per page select element - _this.resultsPerPageSlc = null; - //id of container element - _this.pagingTgtId = f.paging_target_id || null; - //defines table paging length - _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; - //id of container element - _this.resultsPerPageTgtId = f.results_per_page_target_id || null; - //css class for paging select element - _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; - //css class for paging input element - _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; - //stores results per page text and values - _this.resultsPerPage = f.results_per_page || null; - //enables/disables results per page drop-down - _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); - //defines css class for results per page select - _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; - //css class for label preceding results per page select - _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; - //1st row index of current page - _this.startPagingRow = 0; - //total nb of pages - _this.nbPages = 0; - //current page nb - _this.currentPageNb = 1; - //defines next page button text - _this.btnNextPageText = f.btn_next_page_text || '>'; - //defines previous page button text - _this.btnPrevPageText = f.btn_prev_page_text || '<'; - //defines last page button text - _this.btnLastPageText = f.btn_last_page_text || '>|'; - //defines first page button text - _this.btnFirstPageText = f.btn_first_page_text || '|<'; - //defines next page button html - _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); - //defines last page button html - _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); - //defines text preceeding page selector drop-down - _this.pageText = f.page_text || ' Page '; - //defines text after page selector drop-down - _this.ofText = f.of_text || ' of '; - //css class for span containing tot nb of pages - _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; - //enables/disables paging buttons - _this.hasPagingBtns = f.paging_btns === false ? false : true; - //defines previous page button html - _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; - //calls function before page is changed - _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; - //calls function before page is changed - _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; - - //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_'; - - var start_row = tf.refRow; - var nrows = tf.nbRows; - //calculates page nb - _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); - - //Paging elements events - var o = _this; - // Paging DOM events - _this.evt = { - slcIndex: function slcIndex() { - return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; - }, - nbOpts: function nbOpts() { - return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; - }, - next: function next() { - var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; - o.changePage(nextIndex); - }, - prev: function prev() { - var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); - o.changePage(prevIndex); - }, - last: function last() { - o.changePage(o.evt.nbOpts()); - }, - first: function first() { - o.changePage(0); - }, - _detectKey: function _detectKey(e) { - var key = _event2.default.keyCode(e); - if (key === 13) { - if (tf.sorted) { - tf.filter(); - o.changePage(o.evt.slcIndex()); - } else { - o.changePage(); - } - this.blur(); - } - }, - - slcPagesChange: null, - nextEvt: null, - prevEvt: null, - lastEvt: null, - firstEvt: null - }; - return _this; - } - - /** - * Initialize DOM elements - */ - - _createClass(Paging, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var slcPages; - var tf = this.tf; - var evt = this.evt; - - if (this.initialized) { - return; - } - - // Check resultsPerPage is in expected format and initialise the - // results per page component - if (this.hasResultsPerPage) { - if (this.resultsPerPage.length < 2) { - this.hasResultsPerPage = false; - } else { - this.pagingLength = this.resultsPerPage[1][0]; - this.setResultsPerPage(); - } - } - - evt.slcPagesChange = function (event) { - var slc = event.target; - _this2.changePage(slc.selectedIndex); - }; - - // Paging drop-down list selector - if (this.pageSelectorType === tf.fltTypeSlc) { - slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); - slcPages.className = this.pgSlcCssClass; - _event2.default.add(slcPages, 'change', evt.slcPagesChange); - } - - // Paging input selector - if (this.pageSelectorType === tf.fltTypeInp) { - slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); - slcPages.className = this.pgInpCssClass; - _event2.default.add(slcPages, 'keypress', evt._detectKey); - } - - // btns containers - var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); - var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); - var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); - var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); - - if (this.hasPagingBtns) { - // Next button - if (!this.btnNextPageHtml) { - var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); - btn_next.className = this.btnPageCssClass; - _event2.default.add(btn_next, 'click', evt.next); - btnNextSpan.appendChild(btn_next); - } else { - btnNextSpan.innerHTML = this.btnNextPageHtml; - _event2.default.add(btnNextSpan, 'click', evt.next); - } - // Previous button - if (!this.btnPrevPageHtml) { - var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); - btn_prev.className = this.btnPageCssClass; - _event2.default.add(btn_prev, 'click', evt.prev); - btnPrevSpan.appendChild(btn_prev); - } else { - btnPrevSpan.innerHTML = this.btnPrevPageHtml; - _event2.default.add(btnPrevSpan, 'click', evt.prev); - } - // Last button - if (!this.btnLastPageHtml) { - var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); - btn_last.className = this.btnPageCssClass; - _event2.default.add(btn_last, 'click', evt.last); - btnLastSpan.appendChild(btn_last); - } else { - btnLastSpan.innerHTML = this.btnLastPageHtml; - _event2.default.add(btnLastSpan, 'click', evt.last); - } - // First button - if (!this.btnFirstPageHtml) { - var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); - btn_first.className = this.btnPageCssClass; - _event2.default.add(btn_first, 'click', evt.first); - btnFirstSpan.appendChild(btn_first); - } else { - btnFirstSpan.innerHTML = this.btnFirstPageHtml; - _event2.default.add(btnFirstSpan, 'click', evt.first); - } - } - - // paging elements (buttons+drop-down list) are added to defined element - if (!this.pagingTgtId) { - tf.setToolbar(); - } - var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - targetEl.appendChild(btnFirstSpan); - targetEl.appendChild(btnPrevSpan); - - var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); - pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); - pgBeforeSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgBeforeSpan); - targetEl.appendChild(slcPages); - var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); - pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); - pgAfterSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgAfterSpan); - var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); - pgspan.className = this.nbPgSpanCssClass; - pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); - targetEl.appendChild(pgspan); - targetEl.appendChild(btnNextSpan); - targetEl.appendChild(btnLastSpan); - this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); - - if (!tf.rememberGridValues) { - this.setPagingInfo(); - } - if (!tf.fltGrid) { - tf.validateAllRows(); - this.setPagingInfo(tf.validRowsIndex); - } - - this.emitter.on(['after-filtering'], function () { - return _this2.resetPagingInfo(); - }); - this.emitter.on(['initialized'], function () { - return _this2.resetValues(); - }); - - this.initialized = true; - } - - /** - * Reset paging when filters are already instantiated - * @param {Boolean} filterTable Execute filtering once paging instanciated - */ - - }, { - key: 'reset', - value: function reset() { - var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var tf = this.tf; - if (!tf.hasGrid() || this.isEnabled()) { - return; - } - this.enable(); - this.init(); - tf.resetValues(); - if (filterTable) { - tf.filter(); - } - } - - /** - * Reset paging info from scratch after a filtering process - */ - - }, { - key: 'resetPagingInfo', - value: function resetPagingInfo() { - this.startPagingRow = 0; - this.currentPageNb = 1; - this.setPagingInfo(this.tf.validRowsIndex); - } - - /** - * Calculate number of pages based on valid rows - * Refresh paging select according to number of pages - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'setPagingInfo', - value: function setPagingInfo(validRows) { - var tf = this.tf; - var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - //store valid rows indexes - tf.validRowsIndex = validRows || tf.getValidRows(true); - - //calculate nb of pages - this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); - //refresh page nb span - pgspan.innerHTML = this.nbPages; - //select clearing shortcut - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.innerHTML = ''; - } - - if (this.nbPages > 0) { - mdiv.style.visibility = 'visible'; - if (this.pageSelectorType === tf.fltTypeSlc) { - for (var z = 0; z < this.nbPages; z++) { - var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); - this.pagingSlc.options[z] = opt; - } - } else { - //input type - this.pagingSlc.value = this.currentPageNb; - } - } else { - /*** if no results paging select and buttons are hidden ***/ - mdiv.style.visibility = 'hidden'; - } - this.groupByPage(tf.validRowsIndex); - } - - /** - * Group table rows by page and display valid rows - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'groupByPage', - value: function groupByPage(validRows) { - var tf = this.tf; - var rows = tf.tbl.rows; - var startPagingRow = parseInt(this.startPagingRow, 10); - var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); - - //store valid rows indexes - if (validRows) { - tf.validRowsIndex = validRows; - } - - //this loop shows valid rows of current page - for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { - var validRowIdx = tf.validRowsIndex[h]; - var r = rows[validRowIdx]; - var isRowValid = r.getAttribute('validRow'); - var rowDisplayed = false; - - if (h >= startPagingRow && h < endPagingRow) { - if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { - r.style.display = ''; - rowDisplayed = true; - } - } else { - r.style.display = 'none'; - } - this.emitter.emit('row-paged', tf, validRowIdx, h, rowDisplayed); - } - - tf.nbVisibleRows = tf.validRowsIndex.length; - - // broadcast grouping by page - this.emitter.emit('grouped-by-page', tf, this); - } - - /** - * Return the current page number - * @return {Number} Page number - */ - - }, { - key: 'getPage', - value: function getPage() { - return this.currentPageNb; - } - - /** - * Show page based on passed param value (string or number): - * @param {String} or {Number} cmd possible string values: 'next', - * 'previous', 'last', 'first' or page number as per param - */ - - }, { - key: 'setPage', - value: function setPage(cmd) { - var tf = this.tf; - if (!tf.hasGrid() || !this.isEnabled()) { - return; - } - var btnEvt = this.evt, - cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); - if (cmdtype === 'string') { - switch (_string2.default.lower(cmd)) { - case 'next': - btnEvt.next(); - break; - case 'previous': - btnEvt.prev(); - break; - case 'last': - btnEvt.last(); - break; - case 'first': - btnEvt.first(); - break; - default: - btnEvt.next(); - break; - } - } else if (cmdtype === 'number') { - this.changePage(cmd - 1); - } - } - - /** - * Generates UI elements for the number of results per page drop-down - */ - - }, { - key: 'setResultsPerPage', - value: function setResultsPerPage() { - var _this3 = this; - - var tf = this.tf; - var evt = this.evt; - - if (!tf.hasGrid() && !tf.isFirstLoad) { - return; - } - if (this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - - evt.slcResultsChange = function (ev) { - _this3.changeResultsPerPage(); - ev.target.blur(); - }; - - var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); - slcR.className = this.resultsSlcCssClass; - var slcRText = this.resultsPerPage[0], - slcROpts = this.resultsPerPage[1]; - var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); - slcRSpan.className = this.resultsSpanCssClass; - - // results per page select is added to external element - if (!this.resultsPerPageTgtId) { - tf.setToolbar(); - } - var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); - slcRSpan.appendChild(_dom2.default.text(slcRText)); - - var help = tf.feature('help'); - if (help && help.btn) { - help.btn.parentNode.insertBefore(slcRSpan, help.btn); - help.btn.parentNode.insertBefore(slcR, help.btn); - } else { - targetEl.appendChild(slcRSpan); - targetEl.appendChild(slcR); - } - - for (var r = 0; r < slcROpts.length; r++) { - var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); - slcR.options[r] = currOpt; - } - _event2.default.add(slcR, 'change', evt.slcResultsChange); - this.resultsPerPageSlc = slcR; - } - - /** - * Remove number of results per page UI elements - */ - - }, { - key: 'removeResultsPerPage', - value: function removeResultsPerPage() { - var tf = this.tf; - if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - var slcR = this.resultsPerPageSlc, - slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); - if (slcR) { - _dom2.default.remove(slcR); - } - if (slcRSpan) { - _dom2.default.remove(slcRSpan); - } - this.resultsPerPageSlc = null; - } - - /** - * Change the page according to passed index - * @param {Number} index Index of the page (0-n) - */ - - }, { - key: 'changePage', - value: function changePage(index) { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-changing-page', tf, index); - - if (index === null) { - index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; - } - if (index >= 0 && index <= this.nbPages - 1) { - if (this.onBeforeChangePage) { - this.onBeforeChangePage.call(null, this, index); - } - this.currentPageNb = parseInt(index, 10) + 1; - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.options[index].selected = true; - } else { - this.pagingSlc.value = this.currentPageNb; - } - - if (tf.rememberPageNb) { - tf.feature('store').savePageNb(tf.pgNbCookie); - } - this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; - - this.groupByPage(); - - if (this.onAfterChangePage) { - this.onAfterChangePage.call(null, this, index); - } - } - - this.emitter.emit('after-changing-page', tf, index); - } - - /** - * Change rows according to page results drop-down - * TODO: accept a parameter setting the results per page length - */ - - }, { - key: 'changeResultsPerPage', - value: function changeResultsPerPage() { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-changing-results-per-page', tf); - - var slcR = this.resultsPerPageSlc; - var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); - this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); - this.startPagingRow = this.pagingLength * slcPagesSelIndex; - - if (!isNaN(this.pagingLength)) { - if (this.startPagingRow >= tf.nbFilterableRows) { - this.startPagingRow = tf.nbFilterableRows - this.pagingLength; - } - this.setPagingInfo(); - - if (this.pageSelectorType === tf.fltTypeSlc) { - var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; - this.pagingSlc.options[slcIndex].selected = true; - } - if (tf.rememberPageLen) { - tf.feature('store').savePageLength(tf.pgLenCookie); - } - } - - this.emitter.emit('after-changing-results-per-page', tf); - } - - /** - * Re-set persisted pagination info - */ - - }, { - key: 'resetValues', - value: function resetValues() { - var tf = this.tf; - if (tf.rememberPageLen) { - this.resetPageLength(tf.pgLenCookie); - } - if (tf.rememberPageNb) { - this.resetPage(tf.pgNbCookie); - } - } - - /** - * Re-set page nb at page re-load - */ - - }, { - key: 'resetPage', - value: function resetPage(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page', tf); - var pgnb = tf.feature('store').getPageNb(name); - if (pgnb !== '') { - this.changePage(pgnb - 1); - } - this.emitter.emit('after-reset-page', tf, pgnb); - } - - /** - * Re-set page length value at page re-load - */ - - }, { - key: 'resetPageLength', - value: function resetPageLength(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page-length', tf); - var pglenIndex = tf.feature('store').getPageLength(name); - - if (pglenIndex !== '') { - this.resultsPerPageSlc.options[pglenIndex].selected = true; - this.changeResultsPerPage(); - } - this.emitter.emit('after-reset-page-length', tf, pglenIndex); - } - - /** - * Remove paging feature - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - var tf = this.tf; - - if (!this.initialized) { - return; - } - // btns containers - var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); - var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); - var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); - var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); - //span containing 'Page' text - var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); - //span containing 'of' text - var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); - //span containing nb of pages - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - var evt = this.evt; - - if (this.pagingSlc) { - if (this.pageSelectorType === tf.fltTypeSlc) { - _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); - } else if (this.pageSelectorType === tf.fltTypeInp) { - _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); - } - _dom2.default.remove(this.pagingSlc); - } - - if (btnNextSpan) { - _event2.default.remove(btnNextSpan, 'click', evt.next); - _dom2.default.remove(btnNextSpan); - } - - if (btnPrevSpan) { - _event2.default.remove(btnPrevSpan, 'click', evt.prev); - _dom2.default.remove(btnPrevSpan); - } - - if (btnLastSpan) { - _event2.default.remove(btnLastSpan, 'click', evt.last); - _dom2.default.remove(btnLastSpan); - } - - if (btnFirstSpan) { - _event2.default.remove(btnFirstSpan, 'click', evt.first); - _dom2.default.remove(btnFirstSpan); - } - - if (pgBeforeSpan) { - _dom2.default.remove(pgBeforeSpan); - } - - if (pgAfterSpan) { - _dom2.default.remove(pgAfterSpan); - } - - if (pgspan) { - _dom2.default.remove(pgspan); - } - - if (this.hasResultsPerPage) { - this.removeResultsPerPage(); - } - - this.emitter.off(['after-filtering'], function () { - return _this4.resetPagingInfo(); - }); - this.emitter.off(['initialized'], function () { - return _this4.resetValues(); - }); - - this.pagingSlc = null; - this.nbPages = 0; - this.disable(); - this.initialized = false; - } - }]); - - return Paging; - })(_feature.Feature); - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.ClearButton = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var ClearButton = exports.ClearButton = (function (_Feature) { - _inherits(ClearButton, _Feature); - - /** - * Clear button component - * @param {Object} tf TableFilter instance - */ - - function ClearButton(tf) { - _classCallCheck(this, ClearButton); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); - - var f = _this.config; - - //id of container element - _this.btnResetTgtId = f.btn_reset_target_id || null; - //reset button element - _this.btnResetEl = null; - //defines reset text - _this.btnResetText = f.btn_reset_text || 'Reset'; - //defines reset button tooltip - _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; - //defines reset button innerHtml - _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); - //span containing reset button - _this.prfxResetSpan = 'resetspan_'; - return _this; - } - - _createClass(ClearButton, [{ - key: 'onClick', - value: function onClick() { - if (!this.isEnabled()) { - return; - } - this.tf.clearFilters(); - } - - /** - * Build DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - - if (this.initialized) { - return; - } - - var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); - - // reset button is added to defined element - if (!this.btnResetTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); - targetEl.appendChild(resetspan); - - if (!this.btnResetHtml) { - var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); - fltreset.className = tf.btnResetCssClass; - fltreset.appendChild(_dom2.default.text(this.btnResetText)); - resetspan.appendChild(fltreset); - _event2.default.add(fltreset, 'click', function () { - _this2.onClick(); - }); - } else { - resetspan.innerHTML = this.btnResetHtml; - var resetEl = resetspan.firstChild; - _event2.default.add(resetEl, 'click', function () { - _this2.onClick(); - }); - } - this.btnResetEl = resetspan.firstChild; - - this.initialized = true; - } - - /** - * Remove clear button UI - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - - if (!this.initialized) { - return; - } - - var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); - if (resetspan) { - _dom2.default.remove(resetspan); - } - this.btnResetEl = null; - this.initialized = false; - } - }]); - - return ClearButton; - })(_feature.Feature); - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Help = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; - var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; - - var Help = exports.Help = (function (_Feature) { - _inherits(Help, _Feature); - - /** - * Help UI component - * @param {Object} tf TableFilter instance - */ - - function Help(tf) { - _classCallCheck(this, Help); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); - - var f = _this.config; - - //id of custom container element for instructions - _this.tgtId = f.help_instructions_target_id || null; - //id of custom container element for instructions - _this.contTgtId = f.help_instructions_container_target_id || null; - //defines help text - _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; - //defines help innerHtml - _this.instrHtml = f.help_instructions_html || null; - //defines reset button text - _this.btnText = f.help_instructions_btn_text || '?'; - //defines reset button innerHtml - _this.btnHtml = f.help_instructions_btn_html || null; - //defines css class for help button - _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; - //defines css class for help container - _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; - //help button element - _this.btn = null; - //help content div - _this.cont = null; - _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; - - //id prefix for help elements - _this.prfxHelpSpan = 'helpSpan_'; - //id prefix for help elements - _this.prfxHelpDiv = 'helpDiv_'; - return _this; - } - - _createClass(Help, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); - var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); - - //help button is added to defined element - if (!this.tgtId) { - tf.setToolbar(); - } - var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); - targetEl.appendChild(helpspan); - - var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); - - if (!this.btnHtml) { - divContainer.appendChild(helpdiv); - var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); - helplink.className = this.btnCssClass; - helplink.appendChild(_dom2.default.text(this.btnText)); - helpspan.appendChild(helplink); - _event2.default.add(helplink, 'click', function () { - _this2.toggle(); - }); - } else { - helpspan.innerHTML = this.btnHtml; - var helpEl = helpspan.firstChild; - _event2.default.add(helpEl, 'click', function () { - _this2.toggle(); - }); - divContainer.appendChild(helpdiv); - } - - if (!this.instrHtml) { - helpdiv.innerHTML = this.instrText; - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } else { - if (this.contTgtId) { - divContainer.appendChild(helpdiv); - } - helpdiv.innerHTML = this.instrHtml; - if (!this.contTgtId) { - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } - } - helpdiv.innerHTML += this.defaultHtml; - _event2.default.add(helpdiv, 'click', function () { - _this2.toggle(); - }); - - this.cont = helpdiv; - this.btn = helpspan; - this.initialized = true; - } - - /** - * Toggle help pop-up - */ - - }, { - key: 'toggle', - value: function toggle() { - // check only if explicitily set to false as in this case undefined - // signifies the help feature is enabled by default - if (this.enabled === false) { - return; - } - var divDisplay = this.cont.style.display; - if (divDisplay === '' || divDisplay === 'none') { - this.cont.style.display = 'inline'; - } else { - this.cont.style.display = 'none'; - } - } - - /** - * Remove help UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - _dom2.default.remove(this.btn); - this.btn = null; - if (!this.cont) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - this.initialized = false; - } - }]); - - return Help; - })(_feature.Feature); - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AlternateRows = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var AlternateRows = exports.AlternateRows = (function (_Feature) { - _inherits(AlternateRows, _Feature); - - /** - * Alternating rows color - * @param {Object} tf TableFilter instance - */ - - function AlternateRows(tf) { - _classCallCheck(this, AlternateRows); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); - - var config = _this.config; - //defines css class for even rows - _this.evenCss = config.even_row_css_class || 'even'; - //defines css class for odd rows - _this.oddCss = config.odd_row_css_class || 'odd'; - return _this; - } - - /** - * Sets alternating rows color - */ - - _createClass(AlternateRows, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - this.processAll(); - - // Subscribe to events - this.emitter.on(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this2.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.on(['column-sorted'], function () { - return _this2.processAll(); - }); - - this.initialized = true; - } - }, { - key: 'processAll', - value: function processAll() { - if (!this.isEnabled()) { - return; - } - var tf = this.tf; - var validRowsIndex = tf.getValidRows(true); - var noValidRowsIndex = validRowsIndex.length === 0; - //1st index - var beginIndex = noValidRowsIndex ? tf.refRow : 0; - // nb indexes - var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; - var idx = 0; - - //alternates bg color - for (var j = beginIndex; j < indexLen; j++) { - var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; - this.setRowBg(rowIdx, idx); - idx++; - } - } - - /** - * Set/remove row background based on row validation - * @param {Number} rowIdx Row index - * @param {Boolean} isValid Valid row flag - */ - - }, { - key: 'processRow', - value: function processRow(rowIdx, arrIdx, isValid) { - if (isValid) { - this.setRowBg(rowIdx, arrIdx); - } else { - this.removeRowBg(rowIdx); - } - } - - /** - * Sets row background color - * @param {Number} rowIdx Row index - * @param {Number} idx Valid rows collection index needed to calculate bg - * color - */ - - }, { - key: 'setRowBg', - value: function setRowBg(rowIdx, idx) { - if (!this.isEnabled() || isNaN(rowIdx)) { - return; - } - var rows = this.tf.tbl.rows; - var i = isNaN(idx) ? rowIdx : idx; - this.removeRowBg(rowIdx); - - _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); - } - - /** - * Removes row background color - * @param {Number} idx Row index - */ - - }, { - key: 'removeRowBg', - value: function removeRowBg(idx) { - if (isNaN(idx)) { - return; - } - var rows = this.tf.tbl.rows; - _dom2.default.removeClass(rows[idx], this.oddCss); - _dom2.default.removeClass(rows[idx], this.evenCss); - } - - /** - * Removes all alternating backgrounds - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { - this.removeRowBg(i); - } - - // Unsubscribe to events - this.emitter.off(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this3.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.off(['column-sorted'], function () { - return _this3.processAll(); - }); - - this.initialized = false; - } - }]); - - return AlternateRows; - })(_feature.Feature); - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.NoResults = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var NoResults = exports.NoResults = (function (_Feature) { - _inherits(NoResults, _Feature); - - /** - * No results message UI component - * @param {Object} tf TableFilter instance - */ - - function NoResults(tf) { - _classCallCheck(this, NoResults); - - //configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); - - var f = _this.config.no_results_message; - - _this.content = f.content || 'No results'; - _this.customContainer = f.custom_container || null; - _this.customContainerId = f.custom_container_id || null; - _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); - _this.cssClass = f.css_class || 'no-results'; - - _this.cont = null; - - //callback before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //callback after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - //callback before message is hidden - _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; - //callback after message is hidden - _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; - - _this.prfxNoResults = 'nores_'; - return _this; - } - - _createClass(NoResults, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - var tf = this.tf; - var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; - - //container - var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); - cont.className = this.cssClass; - cont.innerHTML = this.content; - - if (this.isExternal) { - target.appendChild(cont); - } else { - target.parentNode.insertBefore(cont, target.nextSibling); - } - - this.cont = cont; - - // subscribe to after-filtering event - this.emitter.on(['after-filtering'], function () { - return _this2.toggle(); - }); - - this.initialized = true; - this.hide(); - } - }, { - key: 'toggle', - value: function toggle() { - if (this.tf.nbVisibleRows > 0) { - this.hide(); - } else { - this.show(); - } - } - }, { - key: 'show', - value: function show() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, this); - } - - this.setWidth(); - this.cont.style.display = 'block'; - - if (this.onAfterShowMsg) { - this.onAfterShowMsg.call(null, this.tf, this); - } - } - }, { - key: 'hide', - value: function hide() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - - this.cont.style.display = 'none'; - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - } - }, { - key: 'setWidth', - value: function setWidth() { - if (!this.initialized || this.isExternal || !this.isEnabled()) { - return; - } - if (this.tf.gridLayout) { - var gridLayout = this.tf.feature('gridLayout'); - this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; - } else { - this.cont.style.width = this.tf.tbl.clientWidth + 'px'; - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - // unsubscribe to after-filtering event - this.emitter.off(['after-filtering'], function () { - return _this3.toggle(); - }); - - this.initialized = false; - } - }]); - - return NoResults; - })(_feature.Feature); - -/***/ } -/******/ ]) -}); -; -//# sourceMappingURL=tablefilter.js.map \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.5",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey){var e=t||A.event;if(e){var i=o["default"].keyCode(e);13===i?(this.filter(),o["default"].cancel(e),o["default"].stop(e)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=t||A.event,s=o["default"].keyCode(i);this.isUserTyping=!1,13!==s&&9!==s&&27!==s&&38!==s&&40!==s?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e)),this.hasExtension("advancedGrid")){var s=this.extension("advancedGrid"),n=s._ezEditTable;s.cfg.editable&&n.Editable.Remove(),s.cfg.selection&&n.Selection.Remove()}},onSlcFocus:function(t){var e=t||A.event,i=o["default"].target(e);if(this.activeFilterId=i.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct");this.Mod.dropdown.build(s)}this.popupFilters&&(o["default"].cancel(e),o["default"].stop(e))},onSlcChange:function(t){if(this.activeFlt){var e=t||A.event;this.popupFilters&&o["default"].stop(e),this.onSlcChange&&this.filter()}}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new S.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._resetGrid();else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;this.emitter.emit("before-loading-extensions",this);for(var e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),B=x&&_["default"].isValid(t.replace(r,""),O),M=T&&_["default"].isValid(t.replace(f,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=P&&_["default"].isValid(t.replace(c,""),O),j=R&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):B?(U=_["default"].format(t.replace(r,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):M?(U=_["default"].format(t.replace(f,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(S),E,I),t.call(this,S,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var a=this.externalFltTgtIds,r=0,o=a.length;o>r;r++){var h=u["default"].id(a[r]);if(h){var f=this.externalFltEls[r];h.appendChild(f);var d=this.getFilterType(r);this.gridLayout&&""===f.innerHTML&&d!==this.fltTypeInp&&((d===this.fltTypeSlc||d===this.fltTypeMulti)&&t.dropdown.build(r),d===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[], +e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||this.isFirstLoad||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]), +t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index a36acf80..90f6b247 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,2185 +1,8 @@ -webpackJsonp([1],{ +/** + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-09T02:39:28.382Z + * MIT License + */ -/***/ 26: -/***/ function(module, exports, __webpack_require__) { - - var map = { - "./array": 6, - "./array.js": 6, - "./cookie": 4, - "./cookie.js": 4, - "./date": 7, - "./date.js": 7, - "./dom": 2, - "./dom.js": 2, - "./emitter": 9, - "./emitter.js": 9, - "./event": 1, - "./event.js": 1, - "./extensions/advancedGrid/adapterEzEditTable": 27, - "./extensions/advancedGrid/adapterEzEditTable.js": 27, - "./extensions/advancedGrid/advancedGrid": 28, - "./extensions/advancedGrid/advancedGrid.js": 28, - "./extensions/colOps/colOps": 29, - "./extensions/colOps/colOps.js": 29, - "./extensions/colsVisibility/colsVisibility": 30, - "./extensions/colsVisibility/colsVisibility.js": 30, - "./extensions/filtersVisibility/filtersVisibility": 31, - "./extensions/filtersVisibility/filtersVisibility.js": 31, - "./extensions/sort/adapterSortabletable": 32, - "./extensions/sort/adapterSortabletable.js": 32, - "./extensions/sort/sort": 33, - "./extensions/sort/sort.js": 33, - "./helpers": 8, - "./helpers.js": 8, - "./modules/alternateRows": 24, - "./modules/alternateRows.js": 24, - "./modules/checkList": 18, - "./modules/checkList.js": 18, - "./modules/clearButton": 22, - "./modules/clearButton.js": 22, - "./modules/dropdown": 16, - "./modules/dropdown.js": 16, - "./modules/feature": 12, - "./modules/feature.js": 12, - "./modules/gridLayout": 11, - "./modules/gridLayout.js": 11, - "./modules/help": 23, - "./modules/help.js": 23, - "./modules/highlightKeywords": 14, - "./modules/highlightKeywords.js": 14, - "./modules/loader": 13, - "./modules/loader.js": 13, - "./modules/noResults": 25, - "./modules/noResults.js": 25, - "./modules/paging": 21, - "./modules/paging.js": 21, - "./modules/popupFilter": 15, - "./modules/popupFilter.js": 15, - "./modules/rowsCounter": 19, - "./modules/rowsCounter.js": 19, - "./modules/statusBar": 20, - "./modules/statusBar.js": 20, - "./modules/store": 10, - "./modules/store.js": 10, - "./sort": 17, - "./sort.js": 17, - "./string": 3, - "./string.js": 3, - "./types": 5, - "./types.js": 5 - }; - function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); - }; - function webpackContextResolve(req) { - return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); - }; - webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); - }; - webpackContext.resolve = webpackContextResolve; - module.exports = webpackContext; - webpackContext.id = 26; - - -/***/ }, - -/***/ 27: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterEzEditTable = (function () { - /** - * Adapter module for ezEditTable, an external library providing advanced - * grid features (selection and edition): - * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus - * - * @param {Object} tf TableFilter instance - */ - - function AdapterEzEditTable(tf, cfg) { - _classCallCheck(this, AdapterEzEditTable); - - // ezEditTable config - this.initialized = false; - this.desc = cfg.description || 'ezEditTable adapter'; - this.filename = cfg.filename || 'ezEditTable.js'; - this.vendorPath = cfg.vendor_path; - this.loadStylesheet = Boolean(cfg.load_stylesheet); - this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; - this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; - this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; - // Enable the ezEditTable's scroll into view behaviour if grid layout on - cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; - - this._ezEditTable = null; - this.cfg = cfg; - this.tf = tf; - } - - /** - * Conditionally load ezEditTable library and set advanced grid - * @return {[type]} [description] - */ - - _createClass(AdapterEzEditTable, [{ - key: 'init', - value: function init() { - var _this = this; - - var tf = this.tf; - if (window.EditTable) { - this._setAdvancedGrid(); - } else { - var path = this.vendorPath + this.filename; - tf.import(this.filename, path, function () { - _this._setAdvancedGrid(); - }); - } - if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { - tf.import(this.stylesheetName, this.stylesheet, null, 'link'); - } - } - - /** - * Instantiate ezEditTable component for advanced grid features - */ - - }, { - key: '_setAdvancedGrid', - value: function _setAdvancedGrid() { - var tf = this.tf; - - //start row for EditTable constructor needs to be calculated - var startRow, - cfg = this.cfg, - thead = _dom2.default.tag(tf.tbl, 'thead'); - - //if thead exists and startRow not specified, startRow is calculated - //automatically by EditTable - if (thead.length > 0 && !cfg.startRow) { - startRow = undefined; - } - //otherwise startRow config property if any or TableFilter refRow - else { - startRow = cfg.startRow || tf.refRow; - } - - cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; - var editable = cfg.editable; - var selectable = cfg.selection; - - if (selectable) { - cfg.default_selection = cfg.default_selection || 'row'; - } - //CSS Styles - cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; - - var _lastValidRowIndex = 0; - var _lastRowIndex = 0; - - if (selectable) { - //Row navigation needs to be calculated according to TableFilter's - //validRowsIndex array - var onAfterSelection = function onAfterSelection(et, selectedElm, e) { - var slc = et.Selection; - //Next valid filtered row needs to be selected - var doSelect = function doSelect(nextRowIndex) { - if (et.defaultSelection === 'row') { - slc.SelectRowByIndex(nextRowIndex); - } else { - et.ClearSelections(); - var cellIndex = selectedElm.cellIndex, - row = tf.tbl.rows[nextRowIndex]; - if (et.defaultSelection === 'both') { - slc.SelectRowByIndex(nextRowIndex); - } - if (row) { - slc.SelectCell(row.cells[cellIndex]); - } - } - //Table is filtered - if (tf.validRowsIndex.length !== tf.getRowsNb()) { - var r = tf.tbl.rows[nextRowIndex]; - if (r) { - r.scrollIntoView(false); - } - if (cell) { - if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { - tf.tblCont.scrollLeft = 100000000; - } else if (cell.cellIndex === 0 && tf.gridLayout) { - tf.tblCont.scrollLeft = 0; - } else { - cell.scrollIntoView(false); - } - } - } - }; - - //table is not filtered - if (!tf.validRowsIndex) { - return; - } - var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, - nextRowIndex, - paging = tf.feature('paging'), - - //pgup/pgdown keys - d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { - //last row - if (row.rowIndex >= validIndexes[validIdxLen - 1]) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - var calcRowIndex = _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[_lastValidRowIndex - d]; - nextRowIndex = v ? v : validIndexes[0]; - } - } - _lastRowIndex = row.rowIndex; - doSelect(nextRowIndex); - } else { - //If filtered row is valid, special calculation for - //pgup/pgdown keys - if (keyCode !== 34 && keyCode !== 33) { - _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); - _lastRowIndex = row.rowIndex; - } else { - if (keyCode === 34) { - //pgdown - //last row - if (_lastValidRowIndex + d <= validIdxLen - 1) { - nextRowIndex = validIndexes[_lastValidRowIndex + d]; - } else { - nextRowIndex = [validIdxLen - 1]; - } - } else { - //pgup - //first row - if (_lastValidRowIndex - d <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - nextRowIndex = validIndexes[_lastValidRowIndex - d]; - } - } - _lastRowIndex = nextRowIndex; - _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); - doSelect(nextRowIndex); - } - } - }; - - //Page navigation has to be enforced whenever selected row is out of - //the current page range - var onBeforeSelection = function onBeforeSelection(et, selectedElm) { - var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; - if (tf.paging) { - if (tf.feature('paging').nbPages > 1) { - var paging = tf.feature('paging'); - //page length is re-assigned in case it has changed - et.nbRowsPerPage = paging.pagingLength; - var validIndexes = tf.validRowsIndex, - validIdxLen = validIndexes.length, - pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); - var rowIndex = row.rowIndex; - - if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { - paging.setPage('last'); - } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { - paging.setPage('first'); - } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { - paging.setPage('next'); - } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { - paging.setPage('previous'); - } - } - } - }; - - //Selected row needs to be visible when paging is activated - if (tf.paging) { - tf.feature('paging').onAfterChangePage = function (paging) { - var advGrid = paging.tf.extension('advancedGrid'); - var et = advGrid._ezEditTable; - var slc = et.Selection; - var row = slc.GetActiveRow(); - if (row) { - row.scrollIntoView(false); - } - var cell = slc.GetActiveCell(); - if (cell) { - cell.scrollIntoView(false); - } - }; - } - - //Rows navigation when rows are filtered is performed with the - //EditTable row selection callback events - if (cfg.default_selection === 'row') { - var fnB = cfg.on_before_selected_row; - cfg.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 = cfg.on_after_selected_row; - cfg.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 = cfg.on_before_selected_cell; - cfg.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 = cfg.on_after_selected_cell; - cfg.on_after_selected_cell = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnC) { - fnC.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - } - } - if (editable) { - //Added or removed rows, TF rows number needs to be re-calculated - var fnE = cfg.on_added_dom_row; - cfg.on_added_dom_row = function () { - tf.nbFilterableRows++; - if (!tf.paging) { - tf.emitter.emit('rows-changed', tf, this); - //tf.feature('rowsCounter').refresh(); - } else { - tf.nbRows++; - tf.nbVisibleRows++; - tf.nbFilterableRows++; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnE) { - fnE.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - if (cfg.actions && cfg.actions['delete']) { - var fnF = cfg.actions['delete'].on_after_submit; - cfg.actions['delete'].on_after_submit = function () { - tf.nbFilterableRows--; - if (!tf.paging) { - // tf.feature('rowsCounter').refresh(); - tf.emitter.emit('rows-changed', tf, this); - } else { - tf.nbRows--; - tf.nbVisibleRows--; - tf.nbFilterableRows--; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(false); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnF) { - fnF.call(null, arguments[0], arguments[1]); - } - }; - } - } - - try { - this._ezEditTable = new EditTable(tf.id, cfg, startRow); - this._ezEditTable.Init(); - } catch (e) { - throw new Error(this.err); - } - - this.initialized = true; - } - - /** - * Reset advanced grid when previously removed - */ - - }, { - key: 'reset', - value: function reset() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.Set(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Set(); - } - } - } - - /** - * Remove advanced grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.ClearSelections(); - ezEditTable.Selection.Remove(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Remove(); - } - } - this.initialized = false; - } - }]); - - return AdapterEzEditTable; - })(); - - exports.default = AdapterEzEditTable; - -/***/ }, - -/***/ 28: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterEzEditTable = __webpack_require__(27); - - var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _adapterEzEditTable2.default; - -/***/ }, - -/***/ 29: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColOps = (function () { - - /** - * Column calculations - * @param {Object} tf TableFilter instance - */ - - function ColOps(tf, opts) { - _classCallCheck(this, ColOps); - - //calls function before col operation - this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; - //calls function after col operation - this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; - - this.opts = opts; - this.tf = tf; - } - - _createClass(ColOps, [{ - key: 'init', - value: function init() { - var _this = this; - - // subscribe to events - this.tf.emitter.on(['after-filtering'], function () { - return _this.calc(); - }); - - this.calc(); - } - - /** - * Calculates columns' values - * Configuration options are stored in 'opts' property - * - 'id' contains ids of elements showing result (array) - * - 'col' contains the columns' indexes (array) - * - 'operation' contains operation type (array, values: 'sum', 'mean', - * 'min', 'max', 'median', 'q1', 'q3') - * - 'write_method' array defines which method to use for displaying the - * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' - * - 'tot_row_index' defines in which row results are displayed - * (integers array) - * - * - changes made by Nuovella: - * (1) optimized the routine (now it will only process each column once), - * (2) added calculations for the median, lower and upper quartile. - */ - - }, { - key: 'calc', - value: function calc() { - var tf = this.tf; - if (!tf.isFirstLoad && !tf.hasGrid()) { - return; - } - - if (this.onBeforeOperation) { - this.onBeforeOperation.call(null, tf); - } - - var opts = this.opts, - labelId = opts.id, - colIndex = opts.col, - operation = opts.operation, - outputType = opts.write_method, - totRowIndex = opts.tot_row_index, - excludeRow = opts.exclude_row, - decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; - - //nuovella: determine unique list of columns to operate on - var ucolIndex = [], - ucolMax = 0; - ucolIndex[ucolMax] = colIndex[0]; - - for (var ii = 1; ii < colIndex.length; ii++) { - var saved = 0; - //see if colIndex[ii] is already in the list of unique indexes - for (var jj = 0; jj <= ucolMax; jj++) { - if (ucolIndex[jj] === colIndex[ii]) { - saved = 1; - } - } - //if not saved then, save the index; - if (saved === 0) { - ucolMax++; - ucolIndex[ucolMax] = colIndex[ii]; - } - } - - if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { - var rows = tf.tbl.rows, - colvalues = []; - - for (var ucol = 0; ucol <= ucolMax; ucol++) { - //this retrieves col values - //use ucolIndex because we only want to pass through this loop - //once for each column get the values in this unique column - colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); - - //next: calculate all operations for this column - 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; - - for (var k = 0; k < colIndex.length; k++) { - if (colIndex[k] === ucolIndex[ucol]) { - mThisCol++; - opsThisCol[mThisCol] = _string2.default.lower(operation[k]); - decThisCol[mThisCol] = decimalPrecision[k]; - labThisCol[mThisCol] = labelId[k]; - oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; - - switch (opsThisCol[mThisCol]) { - case 'mean': - meanFlag = 1; - break; - case 'sum': - sumFlag = 1; - break; - case 'min': - minFlag = 1; - break; - case 'max': - maxFlag = 1; - break; - case 'median': - medFlag = 1; - break; - case 'q1': - q1Flag = 1; - break; - case 'q3': - q3Flag = 1; - break; - } - } - } - - for (var j = 0; j < colvalues[ucol].length; j++) { - //sort the list for calculation of median and quartiles - if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { - if (j < colvalues[ucol].length - 1) { - for (k = j + 1; k < colvalues[ucol].length; k++) { - if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { - temp = colvalues[ucol][j]; - colvalues[ucol][j] = colvalues[ucol][k]; - colvalues[ucol][k] = temp; - } - } - } - } - var cvalue = parseFloat(colvalues[ucol][j]); - theList[j] = parseFloat(cvalue); - - if (!isNaN(cvalue)) { - nbvalues++; - if (sumFlag === 1 || meanFlag === 1) { - sumValue += parseFloat(cvalue); - } - if (minFlag === 1) { - if (minValue === null) { - minValue = parseFloat(cvalue); - } else { - minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; - } - } - if (maxFlag === 1) { - if (maxValue === null) { - maxValue = parseFloat(cvalue); - } else { - maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; - } - } - } - } //for j - if (meanFlag === 1) { - meanValue = sumValue / nbvalues; - } - if (medFlag === 1) { - var aux = 0; - if (nbvalues % 2 === 1) { - aux = Math.floor(nbvalues / 2); - medValue = theList[aux]; - } else { - medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; - } - } - var posa; - if (q1Flag === 1) { - posa = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa == nbvalues) { - q1Value = (theList[posa - 1] + theList[posa]) / 2; - } else { - q1Value = theList[posa]; - } - } - if (q3Flag === 1) { - posa = 0.0; - var posb = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa === nbvalues) { - posb = 3 * posa; - q3Value = (theList[posb] + theList[posb - 1]) / 2; - } else { - q3Value = theList[nbvalues - posa - 1]; - } - } - - for (var i = 0; i <= mThisCol; i++) { - switch (opsThisCol[i]) { - case 'mean': - result = meanValue; - break; - case 'sum': - result = sumValue; - break; - case 'min': - result = minValue; - break; - case 'max': - result = maxValue; - break; - case 'median': - result = medValue; - break; - case 'q1': - result = q1Value; - break; - case 'q3': - result = q3Value; - break; - } - - var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; - - //if outputType is defined - if (oTypeThisCol && result) { - result = result.toFixed(precision); - - if (_dom2.default.id(labThisCol[i])) { - switch (_string2.default.lower(oTypeThisCol)) { - case 'innerhtml': - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result; - } - break; - case 'setvalue': - _dom2.default.id(labThisCol[i]).value = result; - break; - case 'createtextnode': - var oldnode = _dom2.default.id(labThisCol[i]).firstChild; - var txtnode = _dom2.default.text(result); - _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); - break; - } //switch - } - } else { - try { - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); - } - } catch (e) {} //catch - } //else - } //for i - - // row(s) with result are always visible - var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; - if (totRow) { - totRow.style.display = ''; - } - } //for ucol - } //if typeof - - if (this.onAfterOperation) { - this.onAfterOperation.call(null, tf); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - // unsubscribe to events - this.tf.emitter.off(['after-filtering'], function () { - return _this2.calc(); - }); - } - }]); - - return ColOps; - })(); - - exports.default = ColOps; - -/***/ }, - -/***/ 30: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColsVisibility = (function () { - - /** - * Columns Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function ColsVisibility(tf, f) { - _classCallCheck(this, ColsVisibility); - - // Configuration object - var cfg = tf.config(); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Columns visibility manager'; - - //show/hide cols span element - this.spanEl = null; - //show/hide cols button element - this.btnEl = null; - //show/hide cols container div element - this.contEl = null; - - //tick to hide or show column - this.tickToHide = f.tick_to_hide === false ? false : true; - //enables/disables cols manager generation - this.manager = f.manager === false ? false : true; - //only if external headers - this.headersTbl = f.headers_table || false; - //only if external headers - this.headersIndex = f.headers_index || 1; - //id of container element - this.contElTgtId = f.container_target_id || null; - //alternative headers text - this.headersText = f.headers_text || null; - //id of button container element - this.btnTgtId = f.btn_target_id || null; - //defines show/hide cols text - this.btnText = f.btn_text || 'Columns▼'; - //defines show/hide cols button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for show/hide cols button - this.btnCssClass = f.btn_css_class || 'colVis'; - //defines close link text - this.btnCloseText = f.btn_close_text || 'Close'; - //defines close button innerHtml - this.btnCloseHtml = f.btn_close_html || null; - //defines css class for close button - this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; - this.stylesheet = f.stylesheet || 'colsVisibility.css'; - //span containing show/hide cols button - this.prfx = 'colVis_'; - //defines css class span containing show/hide cols - this.spanCssClass = f.span_css_class || 'colVisSpan'; - this.prfxCont = this.prfx + 'Cont_'; - //defines css class div containing show/hide cols - this.contCssClass = f.cont_css_class || 'colVisCont'; - //defines css class for cols list (ul) - this.listCssClass = cfg.list_css_class || 'cols_checklist'; - //defines css class for list item (li) - this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; - //defines css class for selected list item (li) - this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; - //text preceding columns list - this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); - this.atStart = f.at_start || null; - this.enableHover = Boolean(f.enable_hover); - //enables select all option - this.enableTickAll = Boolean(f.enable_tick_all); - //text preceding columns list - this.tickAllText = f.tick_all_text || 'Select all:'; - - //array containing hidden columns indexes - this.hiddenCols = []; - this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; - - //callback invoked just after cols manager is loaded - this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; - //calls function before cols manager is opened - this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; - //calls function after cols manager is opened - this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; - //calls function before cols manager is closed - this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; - //calls function after cols manager is closed - this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; - - //callback before col is hidden - this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; - //callback after col is hidden - this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; - //callback before col is displayed - this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; - //callback after col is displayed - this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; - - //Grid layout compatibility - if (tf.gridLayout) { - this.headersTbl = tf.feature('gridLayout').headTbl; //headers table - this.headersIndex = 0; //headers index - this.onAfterColDisplayed = function () {}; - this.onAfterColHidden = function () {}; - } - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - _createClass(ColsVisibility, [{ - key: 'toggle', - value: function toggle() { - var contDisplay = this.contEl.style.display; - var onBeforeOpen = this.onBeforeOpen; - var onBeforeClose = this.onBeforeClose; - var onAfterOpen = this.onAfterOpen; - var onAfterClose = this.onAfterClose; - - if (onBeforeOpen && contDisplay !== 'inline') { - onBeforeOpen.call(null, this); - } - if (onBeforeClose && contDisplay === 'inline') { - onBeforeClose.call(null, this); - } - - this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; - - if (onAfterOpen && contDisplay !== 'inline') { - onAfterOpen.call(null, this); - } - if (onAfterClose && contDisplay === 'inline') { - onAfterClose.call(null, this); - } - } - }, { - key: 'checkItem', - value: function checkItem(lbl) { - var li = lbl.parentNode; - if (!li || !lbl) { - return; - } - var isChecked = lbl.firstChild.checked; - var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; - colIndex = parseInt(colIndex, 10); - if (isChecked) { - _dom2.default.addClass(li, this.listSlcItemCssClass); - } else { - _dom2.default.removeClass(li, this.listSlcItemCssClass); - } - - var hide = false; - if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { - hide = true; - } - this.setHidden(colIndex, hide); - } - }, { - key: 'init', - value: function init() { - if (!this.manager) { - return; - } - this.buildBtn(); - this.buildManager(); - - this.initialized = true; - } - - /** - * Build main button UI - */ - - }, { - key: 'buildBtn', - value: function buildBtn() { - var _this = this; - - if (this.btnEl) { - return; - } - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.spanCssClass; - - //Container element (rdiv or custom element) - if (!this.btnTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); - - if (!this.btnTgtId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - if (!this.btnHtml) { - var btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCssClass; - btn.title = this.desc; - - btn.innerHTML = this.btnText; - span.appendChild(btn); - if (!this.enableHover) { - _event2.default.add(btn, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(btn, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } else { - //Custom html - span.innerHTML = this.btnHtml; - var colVisEl = span.firstChild; - if (!this.enableHover) { - _event2.default.add(colVisEl, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(colVisEl, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } - - this.spanEl = span; - this.btnEl = this.spanEl.firstChild; - - if (this.onLoaded) { - this.onLoaded.call(null, this); - } - } - - /** - * Build columns manager UI - */ - - }, { - key: 'buildManager', - value: function buildManager() { - var _this2 = this; - - var tf = this.tf; - - var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); - container.className = this.contCssClass; - - //Extension description - var extNameLabel = _dom2.default.create('p'); - extNameLabel.innerHTML = this.text; - container.appendChild(extNameLabel); - - //Headers list - var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); - ul.className = this.listCssClass; - - var tbl = this.headersTbl ? this.headersTbl : tf.tbl; - var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); - var headerRow = tbl.rows[headerIndex]; - - //Tick all option - if (this.enableTickAll) { - var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); - _dom2.default.addClass(li, this.listItemCssClass); - ul.appendChild(li); - li.check.checked = !this.tickToHide; - - _event2.default.add(li.check, 'click', function () { - for (var h = 0; h < headerRow.cells.length; h++) { - var itm = _dom2.default.id('col_' + h + '_' + tf.id); - if (itm && li.check.checked !== itm.checked) { - itm.click(); - itm.checked = li.check.checked; - } - } - }); - } - - for (var i = 0; i < headerRow.cells.length; i++) { - var cell = headerRow.cells[i]; - var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); - var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); - _dom2.default.addClass(liElm, this.listItemCssClass); - if (!this.tickToHide) { - _dom2.default.addClass(liElm, this.listSlcItemCssClass); - } - ul.appendChild(liElm); - if (!this.tickToHide) { - liElm.check.checked = true; - } - - _event2.default.add(liElm.check, 'click', function (evt) { - var elm = _event2.default.target(evt); - var lbl = elm.parentNode; - _this2.checkItem(lbl); - }); - } - - //separator - var p = _dom2.default.create('p', ['align', 'center']); - var btn; - //Close link - if (!this.btnCloseHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCloseCssClass; - btn.innerHTML = this.btnCloseText; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - p.appendChild(btn); - } else { - p.innerHTML = this.btnCloseHtml; - btn = p.firstChild; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - } - - container.appendChild(ul); - container.appendChild(p); - - this.btnEl.parentNode.insertBefore(container, this.btnEl); - this.contEl = container; - - if (this.atStart) { - var a = this.atStart; - for (var k = 0; k < a.length; k++) { - var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); - if (itm) { - itm.click(); - } - } - } - } - - /** - * Hide or show specified columns - * @param {Numner} colIndex Column index - * @param {Boolean} hide hide column if true or show if false - */ - - }, { - key: 'setHidden', - value: function setHidden(colIndex, hide) { - var tf = this.tf; - var tbl = tf.tbl; - - if (this.onBeforeColHidden && hide) { - this.onBeforeColHidden.call(null, this, colIndex); - } - if (this.onBeforeColDisplayed && !hide) { - this.onBeforeColDisplayed.call(null, this, colIndex); - } - - this._hideCells(tbl, colIndex, hide); - if (this.headersTbl) { - this._hideCells(this.headersTbl, colIndex, hide); - } - - var hiddenCols = this.hiddenCols; - var itemIndex = hiddenCols.indexOf(colIndex); - if (hide) { - if (itemIndex === -1) { - this.hiddenCols.push(colIndex); - } - } else { - if (itemIndex !== -1) { - this.hiddenCols.splice(itemIndex, 1); - } - } - - var gridLayout; - var headTbl; - var gridColElms; - if (this.onAfterColHidden && hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); - - var headTblW = parseInt(headTbl.style.width, 10); - headTbl.style.width = headTblW - hiddenWidth + 'px'; - tbl.style.width = headTbl.style.width; - } - this.onAfterColHidden.call(null, this, colIndex); - } - - if (this.onAfterColDisplayed && !hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var width = parseInt(gridColElms[colIndex].style.width, 10); - headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; - tf.tbl.style.width = headTbl.style.width; - } - this.onAfterColDisplayed.call(null, this, colIndex); - } - } - - /** - * Show specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'showCol', - value: function showCol(colIndex) { - if (colIndex === undefined || !this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, false); - } - } - - /** - * Hide specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'hideCol', - value: function hideCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, true); - } - } - - /** - * Determine if specified column is hidden - * @param {Number} colIndex Column index - */ - - }, { - key: 'isColHidden', - value: function isColHidden(colIndex) { - if (this.hiddenCols.indexOf(colIndex) !== -1) { - return true; - } - return false; - } - - /** - * Toggle visibility of specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggleCol', - value: function toggleCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - this.showCol(colIndex); - } else { - this.hideCol(colIndex); - } - } - - /** - * Returns the indexes of the columns currently hidden - * @return {Array} column indexes - */ - - }, { - key: 'getHiddenCols', - value: function getHiddenCols() { - return this.hiddenCols; - } - - /** - * Remove the columns manager - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - if (_dom2.default.id(this.contElTgtId)) { - _dom2.default.id(this.contElTgtId).innerHTML = ''; - } else { - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - } - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - this.initialized = false; - } - }, { - key: '_getHeaderText', - value: function _getHeaderText(cell) { - if (!cell.hasChildNodes) { - return ''; - } - - for (var i = 0; i < cell.childNodes.length; i++) { - var n = cell.childNodes[i]; - if (n.nodeType === 3) { - return n.nodeValue; - } else if (n.nodeType === 1) { - if (n.id && n.id.indexOf('popUp') !== -1) { - continue; - } else { - return _dom2.default.getText(n); - } - } - continue; - } - return ''; - } - }, { - key: '_hideCells', - value: function _hideCells(tbl, colIndex, hide) { - for (var i = 0; i < tbl.rows.length; i++) { - var row = tbl.rows[i]; - var cell = row.cells[colIndex]; - if (cell) { - cell.style.display = hide ? 'none' : ''; - } - } - } - }]); - - return ColsVisibility; - })(); - - exports.default = ColsVisibility; - -/***/ }, - -/***/ 31: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var FiltersVisibility = (function () { - - /** - * Filters Row Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function FiltersVisibility(tf, f) { - _classCallCheck(this, FiltersVisibility); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Filters row visibility manager'; - - // Path and image filenames - this.stylesheet = f.stylesheet || 'filtersVisibility.css'; - this.icnExpand = f.expand_icon_name || 'icn_exp.png'; - this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; - - //expand/collapse filters span element - this.contEl = null; - //expand/collapse filters btn element - this.btnEl = null; - - this.icnExpandHtml = 'Expand filters'; - this.icnCollapseHtml = 'Collapse filters'; - this.defaultText = 'Toggle filters'; - - //id of container element - this.targetId = f.target_id || null; - //enables/disables expand/collapse icon - this.enableIcon = f.enable_icon === false ? false : true; - this.btnText = f.btn_text || ''; - - //defines expand/collapse filters text - this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; - this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; - - //defines expand/collapse filters button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for expand/collapse filters button - this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; - //defines css class span containing expand/collapse filters - this.contCssClass = f.cont_css_class || 'expClpFlt'; - this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); - - this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; - - // Prefix - this.prfx = 'fltsVis_'; - - //callback before filters row is shown - this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; - //callback after filters row is shown - this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; - //callback before filters row is hidden - this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; - //callback after filters row is hidden - this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - /** - * Initialise extension - */ - - _createClass(FiltersVisibility, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - this.buildUI(); - this.initialized = true; - } - - /** - * Build UI elements - */ - - }, { - key: 'buildUI', - value: function buildUI() { - var _this = this; - - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.contCssClass; - - //Container element (rdiv or custom element) - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); - - if (!this.targetId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - var btn = undefined; - if (!this.btnHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); - btn.className = this.btnCssClass; - btn.title = this.btnText || this.defaultText; - btn.innerHTML = this.collapseBtnHtml; - span.appendChild(btn); - } else { - //Custom html - span.innerHTML = this.btnHtml; - btn = span.firstChild; - } - - _event2.default.add(btn, 'click', function () { - return _this.toggle(); - }); - - this.contEl = span; - this.btnEl = btn; - - if (!this.visibleAtStart) { - this.toggle(); - } - } - - /** - * Toggle filters visibility - */ - - }, { - key: 'toggle', - value: function toggle() { - var tf = this.tf; - var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; - var fltRow = tbl.rows[this.filtersRowIndex]; - var fltRowDisplay = fltRow.style.display; - - if (this.onBeforeShow && fltRowDisplay !== '') { - this.onBeforeShow.call(this, this); - } - if (this.onBeforeHide && fltRowDisplay === '') { - this.onBeforeHide.call(null, this); - } - - fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; - if (this.enableIcon && !this.btnHtml) { - this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; - } - - if (this.onAfterShow && fltRowDisplay !== '') { - this.onAfterShow.call(null, this); - } - if (this.onAfterHide && fltRowDisplay === '') { - this.onAfterHide.call(null, this); - } - } - - /** - * Destroy the UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - this.initialized = false; - } - }]); - - return FiltersVisibility; - })(); - - exports.default = FiltersVisibility; - -/***/ }, - -/***/ 32: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _date = __webpack_require__(7); - - var _date2 = _interopRequireDefault(_date); - - var _helpers = __webpack_require__(8); - - var _helpers2 = _interopRequireDefault(_helpers); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterSortableTable = (function () { - - /** - * SortableTable Adapter module - * @param {Object} tf TableFilter instance - */ - - function AdapterSortableTable(tf, opts) { - _classCallCheck(this, AdapterSortableTable); - - this.initialized = false; - this.name = opts.name; - this.desc = opts.description || 'Sortable table'; - - //indicates if tables was sorted - this.sorted = false; - - this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; - this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; - this.asyncSort = Boolean(opts.async_sort); - this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; - - // edit .sort-arrow.descending / .sort-arrow.ascending in - // tablefilter.css to reflect any path change - this.imgPath = opts.images_path || tf.themesPath; - this.imgBlank = opts.image_blank || 'blank.png'; - this.imgClassName = opts.image_class_name || 'sort-arrow'; - this.imgAscClassName = opts.image_asc_class_name || 'ascending'; - this.imgDescClassName = opts.image_desc_class_name || 'descending'; - //cell attribute storing custom key - this.customKey = opts.custom_key || 'data-tf-sortKey'; - - // callback invoked after sort is loaded and instanciated - this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; - // callback invoked before table is sorted - this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; - // callback invoked after table is sorted - this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(AdapterSortableTable, [{ - key: 'init', - value: function init() { - var tf = this.tf; - var adpt = this; - - // SortableTable class sanity check (sortabletable.js) - if (_types2.default.isUndef(SortableTable)) { - throw new Error('SortableTable class not found.'); - } - - this.overrideSortableTable(); - this.setSortTypes(); - - //Column sort at start - var sortColAtStart = adpt.sortColAtStart; - if (sortColAtStart) { - this.stt.sort(sortColAtStart[0], sortColAtStart[1]); - } - - if (this.onSortLoaded) { - this.onSortLoaded.call(null, tf, this); - } - - /*** SortableTable callbacks ***/ - this.stt.onbeforesort = function () { - if (adpt.onBeforeSort) { - adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); - } - - /*** sort behaviour for paging ***/ - if (tf.paging) { - tf.feature('paging').disable(); - } - }; - - this.stt.onsort = function () { - adpt.sorted = true; - - //sort behaviour for paging - if (tf.paging) { - var paginator = tf.feature('paging'); - // recalculate valid rows index as sorting may have change it - tf.getValidRows(true); - paginator.enable(); - paginator.setPage(paginator.getPage()); - } - - if (adpt.onAfterSort) { - adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); - } - - adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn); - }; - - this.initialized = true; - } - - /** - * Sort specified column - * @param {Number} colIdx Column index - * @param {Boolean} desc Optional: descending manner - */ - - }, { - key: 'sortByColumnIndex', - value: function sortByColumnIndex(colIdx, desc) { - this.stt.sort(colIdx, desc); - } - }, { - key: 'overrideSortableTable', - value: function overrideSortableTable() { - var adpt = this, - tf = this.tf; - - /** - * Overrides headerOnclick method in order to handle th event - * @param {Object} e [description] - */ - SortableTable.prototype.headerOnclick = function (evt) { - if (!adpt.initialized) { - return; - } - - // find Header element - var el = evt.target || evt.srcElement; - - while (el.tagName !== 'TD' && el.tagName !== 'TH') { - el = el.parentNode; - } - - this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); - }; - - /** - * Overrides getCellIndex IE returns wrong cellIndex when columns are - * hidden - * @param {Object} oTd TD element - * @return {Number} Cell index - */ - SortableTable.getCellIndex = function (oTd) { - var cells = oTd.parentNode.cells, - l = cells.length, - i = undefined; - for (i = 0; cells[i] != oTd && i < l; i++) {} - return i; - }; - - /** - * Overrides initHeader in order to handle filters row position - * @param {Array} oSortTypes - */ - SortableTable.prototype.initHeader = function (oSortTypes) { - var stt = this; - if (!stt.tHead) { - if (tf.gridLayout) { - stt.tHead = tf.feature('gridLayout').headTbl.tHead; - } else { - return; - } - } - - stt.headersRow = tf.headersRow; - var cells = stt.tHead.rows[stt.headersRow].cells; - stt.sortTypes = oSortTypes || []; - var l = cells.length; - var img = undefined, - c = undefined; - - for (var i = 0; i < l; i++) { - c = cells[i]; - if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { - c.style.cursor = 'pointer'; - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - c.appendChild(img); - if (stt.sortTypes[i] !== null) { - c.setAttribute('_sortType', stt.sortTypes[i]); - } - _event2.default.add(c, 'click', stt._headerOnclick); - } else { - c.setAttribute('_sortType', oSortTypes[i]); - c._sortType = 'None'; - } - } - stt.updateHeaderArrows(); - }; - - /** - * Overrides updateHeaderArrows in order to handle arrows indicators - */ - SortableTable.prototype.updateHeaderArrows = function () { - var stt = this; - var cells = undefined, - l = undefined, - img = undefined; - - // external headers - if (adpt.asyncSort && adpt.triggerIds.length > 0) { - var triggers = adpt.triggerIds; - cells = []; - l = triggers.length; - for (var j = 0; j < triggers.length; j++) { - cells.push(_dom2.default.id(triggers[j])); - } - } else { - if (!this.tHead) { - return; - } - cells = stt.tHead.rows[stt.headersRow].cells; - l = cells.length; - } - for (var i = 0; i < l; i++) { - var cellAttr = cells[i].getAttribute('_sortType'); - if (cellAttr !== null && cellAttr !== 'None') { - img = cells[i].lastChild || cells[i]; - if (img.nodeName.toLowerCase() !== 'img') { - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - cells[i].appendChild(img); - } - if (i === stt.sortColumn) { - img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); - } else { - img.className = adpt.imgClassName; - } - } - } - }; - - /** - * Overrides getRowValue for custom key value feature - * @param {Object} oRow Row element - * @param {String} sType - * @param {Number} nColumn - * @return {String} - */ - SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { - var stt = this; - // if we have defined a custom getRowValue use that - var sortTypeInfo = stt._sortTypeInfo[sType]; - if (sortTypeInfo && sortTypeInfo.getRowValue) { - return sortTypeInfo.getRowValue(oRow, nColumn); - } - var c = oRow.cells[nColumn]; - var s = SortableTable.getInnerText(c); - return stt.getValueFromString(s, sType); - }; - - /** - * Overrides getInnerText in order to avoid Firefox unexpected sorting - * behaviour with untrimmed text elements - * @param {Object} oNode DOM element - * @return {String} DOM element inner text - */ - SortableTable.getInnerText = function (oNode) { - if (!oNode) { - return; - } - if (oNode.getAttribute(adpt.customKey)) { - return oNode.getAttribute(adpt.customKey); - } else { - return _dom2.default.getText(oNode); - } - }; - } - }, { - key: 'addSortType', - value: function addSortType() { - var args = arguments; - SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); - } - }, { - key: 'setSortTypes', - value: function setSortTypes() { - var _this = this; - - var tf = this.tf, - sortTypes = this.sortTypes, - _sortTypes = []; - - for (var i = 0; i < tf.nbCells; i++) { - var colType = undefined; - - if (sortTypes[i]) { - colType = sortTypes[i].toLowerCase(); - if (colType === 'none') { - colType = 'None'; - } - } else { - // resolve column types - if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { - colType = tf.colNbFormat[i].toLowerCase(); - } else if (tf.hasColDateType && tf.colDateType[i] !== null) { - colType = tf.colDateType[i].toLowerCase() + 'date'; - } else { - colType = 'String'; - } - } - _sortTypes.push(colType); - } - - //Public TF method to add sort type - - //Custom sort types - this.addSortType('number', Number); - this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); - this.addSortType('date', SortableTable.toDate); - this.addSortType('string'); - this.addSortType('us', usNumberConverter); - this.addSortType('eu', euNumberConverter); - this.addSortType('dmydate', dmyDateConverter); - this.addSortType('ymddate', ymdDateConverter); - this.addSortType('mdydate', mdyDateConverter); - this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); - this.addSortType('ipaddress', ipAddress, sortIP); - - this.stt = new SortableTable(tf.tbl, _sortTypes); - - /*** external table headers adapter ***/ - if (this.asyncSort && this.triggerIds.length > 0) { - (function () { - var triggers = _this.triggerIds; - for (var j = 0; j < triggers.length; j++) { - if (triggers[j] === null) { - continue; - } - var trigger = _dom2.default.id(triggers[j]); - if (trigger) { - trigger.style.cursor = 'pointer'; - - _event2.default.add(trigger, 'click', function (evt) { - var elm = evt.target; - if (!_this.tf.sort) { - return; - } - _this.stt.asyncSort(triggers.indexOf(elm.id)); - }); - trigger.setAttribute('_sortType', _sortTypes[j]); - } - } - })(); - } - } - - /** - * Destroy sort - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - this.sorted = false; - this.initialized = false; - this.stt.destroy(); - - var ids = tf.getFiltersId(); - for (var idx = 0; idx < ids.length; idx++) { - var header = tf.getHeaderElement(idx); - var img = _dom2.default.tag(header, 'img'); - - if (img.length === 1) { - header.removeChild(img[0]); - } - } - } - }]); - - return AdapterSortableTable; - })(); - - //Converters - - exports.default = AdapterSortableTable; - function usNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'us'); - } - function euNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'eu'); - } - function dateConverter(s, format) { - return _date2.default.format(s, format); - } - function dmyDateConverter(s) { - return dateConverter(s, 'DMY'); - } - function mdyDateConverter(s) { - return dateConverter(s, 'MDY'); - } - function ymdDateConverter(s) { - return dateConverter(s, 'YMD'); - } - function ddmmmyyyyDateConverter(s) { - return dateConverter(s, 'DDMMMYYYY'); - } - - function ipAddress(value) { - var vals = value.split('.'); - for (var x in vals) { - var val = vals[x]; - while (3 > val.length) { - val = '0' + val; - } - vals[x] = val; - } - return vals.join('.'); - } - - function sortIP(a, b) { - var aa = ipAddress(a.value.toLowerCase()); - var bb = ipAddress(b.value.toLowerCase()); - if (aa == bb) { - return 0; - } else if (aa < bb) { - return -1; - } else { - return 1; - } - } - -/***/ }, - -/***/ 33: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterSortabletable = __webpack_require__(32); - - var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - if (!window.SortableTable) { - __webpack_require__(34); - } // import 'script!sortabletable'; - - exports.default = _adapterSortabletable2.default; - -/***/ }, - -/***/ 34: -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") - -/***/ }, - -/***/ 35: -/***/ function(module, exports) { - - /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra - */ - module.exports = function(src) { - if (typeof execScript === "function") - execScript(src); - else - eval.call(null, src); - } - -/***/ }, - -/***/ 36: -/***/ function(module, exports) { - - module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" - -/***/ } - -}); -//# sourceMappingURL=tf-1.js.map \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/src/modules/checkList.js b/src/modules/checkList.js index 0d0174de..5622e1ee 100644 --- a/src/modules/checkList.js +++ b/src/modules/checkList.js @@ -275,7 +275,7 @@ export class CheckList extends Feature{ addChecks(colIndex, ul){ let tf = this.tf; let chkCt = this.addTChecks(colIndex, ul); - let fltArr = []; //remember grid values + // let fltArr = []; //remember grid values // let store = tf.feature('store'); // let tmpVal = store ? // store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null; @@ -312,16 +312,16 @@ export class CheckList extends Feature{ } /*** remember grid values ***/ - if(tf.rememberGridValues){ - if((tf.hasCustomSlcOptions && - tf.customSlcOptions.cols.indexOf(colIndex) != -1 && - fltArr.toString().indexOf(val) != -1) || - Arr.has(fltArr, - Str.matchCase(val, tf.matchCase), tf.matchCase)){ - li.check.checked = true; - this.setCheckListValues(li.check); - } - } + // if(tf.rememberGridValues){ + // if((tf.hasCustomSlcOptions && + // tf.customSlcOptions.cols.indexOf(colIndex) != -1 && + // fltArr.toString().indexOf(val) != -1) || + // Arr.has(fltArr, + // Str.matchCase(val, tf.matchCase), tf.matchCase)){ + // li.check.checked = true; + // this.setCheckListValues(li.check); + // } + // } } } diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index 5ea546c3..87f711ac 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -122,7 +122,7 @@ export class Dropdown extends Feature{ } /*** remember grid values ***/ - let fltsValues = [], fltArr = []; + // let fltsValues = [], fltArr = []; // if(tf.rememberGridValues){ // fltsValues = tf.feature('store').getFilterValues( // tf.fltsValuesCookie); @@ -258,7 +258,7 @@ export class Dropdown extends Feature{ //populates drop-down this.addOptions( - colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr); + colIndex, slc, isLinked, excludedOpts/*, fltsValues, fltArr*/); this.emitter.emit('after-populating-filter', tf, colIndex, slc); } @@ -272,7 +272,7 @@ export class Dropdown extends Feature{ * @param {Array} fltsValues Collection of persisted filter values * @param {Array} fltArr Collection of persisted filter values */ - addOptions(colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr){ + addOptions(colIndex, slc, isLinked, excludedOpts/*, fltsValues, fltArr*/){ let tf = this.tf, fillMethod = Str.lower(this.slcFillingMethod), slcValue = slc.value; @@ -311,24 +311,25 @@ export class Dropdown extends Feature{ tf.getFilterType(colIndex) === tf.fltTypeSlc){ opt = Dom.createOpt(lbl, val, true); } else { - if(tf.getFilterType(colIndex) !== tf.fltTypeMulti){ - opt = Dom.createOpt( - lbl, - val, - (fltsValues[colIndex]!==' ' && - val===fltsValues[colIndex]) ? true : false - ); - } else { - opt = Dom.createOpt( - lbl, - val, - (Arr.has(fltArr, - Str.matchCase(this.opts[y], tf.matchCase), - tf.matchCase) || - fltArr.toString().indexOf(val)!== -1) ? - true : false - ); - } + opt = Dom.createOpt(lbl, val, false); + // if(tf.getFilterType(colIndex) !== tf.fltTypeMulti){ + // opt = Dom.createOpt( + // lbl, + // val, + // (fltsValues[colIndex]!==' ' && + // val===fltsValues[colIndex]) ? true : false + // ); + // } else { + // opt = Dom.createOpt( + // lbl, + // val, + // (Arr.has(fltArr, + // Str.matchCase(this.opts[y], tf.matchCase), + // tf.matchCase) || + // fltArr.toString().indexOf(val)!== -1) ? + // true : false + // ); + // } } if(isDisabled){ opt.disabled = true; diff --git a/src/tablefilter.js b/src/tablefilter.js index de61661c..6f9d8f07 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -660,9 +660,9 @@ export class TableFilter { this.emitter.emit('before-filter-init', this, i); let fltcell = Dom.create(this.fltCellTag), - col = this.getFilterType(i), + col = this.getFilterType(i)/*, externalFltTgtId = this.isExternalFlt ? - this.externalFltTgtIds[i] : null; + this.externalFltTgtIds[i] : null*/; if(this.singleSearchFlt){ fltcell.colSpan = this.nbCells; @@ -808,19 +808,20 @@ export class TableFilter { } // this adds submit button if(i==n-1 && this.displayBtn){ - let btn = Dom.create(this.fltTypeInp, - ['id', this.prfxValButton+i+'_'+this.id], - ['type', 'button'], ['value', this.btnText]); - btn.className = this.btnCssClass; + this._buildSubmitButton(i, fltcell); + // let 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); - } + // //filter is appended in desired element + // if(externalFltTgtId){ + // Dom.id(externalFltTgtId).appendChild(btn); + // } else{ + // fltcell.appendChild(btn); + // } - Event.add(btn, 'click', ()=> this.filter()); + // Event.add(btn, 'click', ()=> this.filter()); }//if this.emitter.emit('after-filter-init', this, i); @@ -912,6 +913,9 @@ export class TableFilter { this.emitter.emit('initialized', this); } + /** + * Insert filters row at initialization + */ _insertFiltersRow() { if(this.gridLayout){ return; @@ -941,6 +945,9 @@ export class TableFilter { return fltrow; } + /** + * Initialize filtersless table + */ _initNoFilters(){ if(this.fltGrid){ return; @@ -954,6 +961,12 @@ export class TableFilter { this.nbRows = this.nbFilterableRows + this.refRow; } + /** + * Build input filter type + * @param {Number} colIndex Column index + * @param {String} cssClass Css class applied to filter + * @param {DOMElement} container Container DOM element + */ _buildInputFilter(colIndex, cssClass, container){ let col = this.getFilterType(colIndex); let externalFltTgtId = this.isExternalFlt ? @@ -995,6 +1008,29 @@ export class TableFilter { // } } + /** + * Build submit button + * @param {Number} colIndex Column index + * @param {DOMElement} container Container DOM element + */ + _buildSubmitButton(colIndex, container){ + let externalFltTgtId = this.isExternalFlt ? + this.externalFltTgtIds[colIndex] : null; + let btn = Dom.create(this.fltTypeInp, + ['id', this.prfxValButton+colIndex+'_'+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{ + container.appendChild(btn); + } + + Event.add(btn, 'click', ()=> this.filter()); + } + /** * Return a feature instance for a given name * @param {String} name Name of the feature @@ -1157,7 +1193,7 @@ export class TableFilter { let rows = this.tbl.rows, Mod = this.Mod; - this.clearFilters(); + // this.clearFilters(); if(this.isExternalFlt && !this.popupFilters){ this.removeExternalFlts(); diff --git a/static/templates/grouped-headers.html b/static/templates/grouped-headers.html index e644b7d5..8e482570 100644 --- a/static/templates/grouped-headers.html +++ b/static/templates/grouped-headers.html @@ -36,9 +36,10 @@ + + + +

+
+
+
+
+
+
+
+
+
diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index 33a22ff8..55732f83 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-09T08:13:41.119Z 
+ *	 build date: 2016-01-09T10:12:44.718Z 
  *	 MIT License  
  */ 
 span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
\ No newline at end of file
diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css
index bdafd3b4..3d8b01e5 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-09T08:13:41.119Z 
+ *	 build date: 2016-01-09T10:12:44.718Z 
  *	 MIT License  
  */ 
 span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
\ No newline at end of file
diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css
index 814e2e11..767a12f9 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-09T08:13:41.119Z 
+ *	 build date: 2016-01-09T10:12:44.718Z 
  *	 MIT License  
  */ 
 .activeHeader{background-color:#66afe9 !important;color:#fff !important}
diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css
index bc1ec960..7b2363d6 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-09T08:13:41.119Z 
+ *	 build date: 2016-01-09T10:12:44.718Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css
index 123154d6..0f3530fe 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-09T08:13:41.119Z 
+ *	 build date: 2016-01-09T10:12:44.718Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css
index 1bc72da4..7220bbc1 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-09T08:13:41.119Z 
+ *	 build date: 2016-01-09T10:12:44.718Z 
  *	 MIT License  
  */ 
 table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
index 837b6ecd..d49cc9d7 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -1,8027 +1,10 @@
-(function webpackUniversalModuleDefinition(root, factory) {
-	if(typeof exports === 'object' && typeof module === 'object')
-		module.exports = factory();
-	else if(typeof define === 'function' && define.amd)
-		define([], factory);
-	else {
-		var a = factory();
-		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
-	}
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ 	// install a JSONP callback for chunk loading
-/******/ 	var parentJsonpFunction = window["webpackJsonp"];
-/******/ 	window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
-/******/ 		// add "moreModules" to the modules object,
-/******/ 		// then flag all "chunkIds" as loaded and fire callback
-/******/ 		var moduleId, chunkId, i = 0, callbacks = [];
-/******/ 		for(;i < chunkIds.length; i++) {
-/******/ 			chunkId = chunkIds[i];
-/******/ 			if(installedChunks[chunkId])
-/******/ 				callbacks.push.apply(callbacks, installedChunks[chunkId]);
-/******/ 			installedChunks[chunkId] = 0;
-/******/ 		}
-/******/ 		for(moduleId in moreModules) {
-/******/ 			modules[moduleId] = moreModules[moduleId];
-/******/ 		}
-/******/ 		if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
-/******/ 		while(callbacks.length)
-/******/ 			callbacks.shift().call(null, __webpack_require__);
-/******/
-/******/ 	};
-/******/
-/******/ 	// The module cache
-/******/ 	var installedModules = {};
-/******/
-/******/ 	// object to store loaded and loading chunks
-/******/ 	// "0" means "already loaded"
-/******/ 	// Array means "loading", array contains callbacks
-/******/ 	var installedChunks = {
-/******/ 		0:0
-/******/ 	};
-/******/
-/******/ 	// The require function
-/******/ 	function __webpack_require__(moduleId) {
-/******/
-/******/ 		// Check if module is in cache
-/******/ 		if(installedModules[moduleId])
-/******/ 			return installedModules[moduleId].exports;
-/******/
-/******/ 		// Create a new module (and put it into the cache)
-/******/ 		var module = installedModules[moduleId] = {
-/******/ 			exports: {},
-/******/ 			id: moduleId,
-/******/ 			loaded: false
-/******/ 		};
-/******/
-/******/ 		// Execute the module function
-/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ 		// Flag the module as loaded
-/******/ 		module.loaded = true;
-/******/
-/******/ 		// Return the exports of the module
-/******/ 		return module.exports;
-/******/ 	}
-/******/
-/******/ 	// This file contains only the entry chunk.
-/******/ 	// The chunk loading function for additional chunks
-/******/ 	__webpack_require__.e = function requireEnsure(chunkId, callback) {
-/******/ 		// "0" is the signal for "already loaded"
-/******/ 		if(installedChunks[chunkId] === 0)
-/******/ 			return callback.call(null, __webpack_require__);
-/******/
-/******/ 		// an array means "currently loading".
-/******/ 		if(installedChunks[chunkId] !== undefined) {
-/******/ 			installedChunks[chunkId].push(callback);
-/******/ 		} else {
-/******/ 			// start chunk loading
-/******/ 			installedChunks[chunkId] = [callback];
-/******/ 			var head = document.getElementsByTagName('head')[0];
-/******/ 			var script = document.createElement('script');
-/******/ 			script.type = 'text/javascript';
-/******/ 			script.charset = 'utf-8';
-/******/ 			script.async = true;
-/******/
-/******/ 			script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js";
-/******/ 			head.appendChild(script);
-/******/ 		}
-/******/ 	};
-/******/
-/******/ 	// expose the modules object (__webpack_modules__)
-/******/ 	__webpack_require__.m = modules;
-/******/
-/******/ 	// expose the module cache
-/******/ 	__webpack_require__.c = installedModules;
-/******/
-/******/ 	// __webpack_public_path__
-/******/ 	__webpack_require__.p = "";
-/******/
-/******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
+/** 
+ *	 tablefilter v0.1.5 by Max Guglielmi
+ *	 build date: 2016-01-09T10:12:44.628Z 
+ *	 MIT License  
+ */ 
 
-	'use strict';
-	
-	var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-	
-	// Features
-	
-	Object.defineProperty(exports, "__esModule", {
-	    value: true
-	});
-	exports.TableFilter = undefined;
-	
-	var _event = __webpack_require__(1);
-	
-	var _event2 = _interopRequireDefault(_event);
-	
-	var _dom = __webpack_require__(2);
-	
-	var _dom2 = _interopRequireDefault(_dom);
-	
-	var _string = __webpack_require__(3);
-	
-	var _string2 = _interopRequireDefault(_string);
-	
-	var _cookie = __webpack_require__(4);
-	
-	var _cookie2 = _interopRequireDefault(_cookie);
-	
-	var _types = __webpack_require__(5);
-	
-	var _types2 = _interopRequireDefault(_types);
-	
-	var _array = __webpack_require__(6);
-	
-	var _array2 = _interopRequireDefault(_array);
-	
-	var _date = __webpack_require__(7);
-	
-	var _date2 = _interopRequireDefault(_date);
-	
-	var _helpers = __webpack_require__(8);
-	
-	var _helpers2 = _interopRequireDefault(_helpers);
-	
-	var _emitter = __webpack_require__(9);
-	
-	var _store = __webpack_require__(10);
-	
-	var _gridLayout = __webpack_require__(11);
-	
-	var _loader = __webpack_require__(13);
-	
-	var _highlightKeywords = __webpack_require__(14);
-	
-	var _popupFilter = __webpack_require__(15);
-	
-	var _dropdown = __webpack_require__(16);
-	
-	var _checkList = __webpack_require__(18);
-	
-	var _rowsCounter = __webpack_require__(19);
-	
-	var _statusBar = __webpack_require__(20);
-	
-	var _paging = __webpack_require__(21);
-	
-	var _clearButton = __webpack_require__(22);
-	
-	var _help = __webpack_require__(23);
-	
-	var _alternateRows = __webpack_require__(24);
-	
-	var _noResults = __webpack_require__(25);
-	
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-	
-	function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
-	
-	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-	
-	var global = window,
-	    doc = global.document;
-	
-	var TableFilter = exports.TableFilter = (function () {
-	
-	    /**
-	     * TableFilter object constructor
-	     * requires `table` or `id` arguments, `row` and `configuration` optional
-	     * @param {DOMElement} table Table DOM element
-	     * @param {String} id Table id
-	     * @param {Number} row index indicating the 1st row
-	     * @param {Object} configuration object
-	     */
-	
-	    function TableFilter() {
-	        var _this = this;
-	
-	        _classCallCheck(this, TableFilter);
-	
-	        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
-	            args[_key] = arguments[_key];
-	        }
-	
-	        if (args.length === 0) {
-	            return;
-	        }
-	
-	        this.id = null;
-	        this.version = '0.1.5';
-	        this.year = new Date().getFullYear();
-	        this.tbl = null;
-	        this.startRow = null;
-	        this.refRow = null;
-	        this.headersRow = null;
-	        this.cfg = {};
-	        this.nbFilterableRows = null;
-	        this.nbRows = null;
-	        this.nbCells = null;
-	        this._hasGrid = false;
-	
-	        // TODO: use for-of with babel plug-in
-	        args.forEach(function (arg) {
-	            // for (let arg of args) {
-	            var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg);
-	            if (argtype === 'object' && arg && arg.nodeName === 'TABLE') {
-	                _this.tbl = arg;
-	                _this.id = arg.id || 'tf_' + new Date().getTime() + '_';
-	            } else if (argtype === 'string') {
-	                _this.id = arg;
-	                _this.tbl = _dom2.default.id(arg);
-	            } else if (argtype === 'number') {
-	                _this.startRow = arg;
-	            } else if (argtype === 'object') {
-	                _this.cfg = arg;
-	            }
-	            // }
-	        });
-	
-	        if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) {
-	            throw new Error('Could not instantiate TableFilter: HTML table not found.');
-	        }
-	
-	        // configuration object
-	        var f = this.cfg;
-	
-	        this.emitter = new _emitter.Emitter();
-	
-	        //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 || 'tablefilter/';
-	
-	        /*** filter types ***/
-	        this.fltTypeInp = 'input';
-	        this.fltTypeSlc = 'select';
-	        this.fltTypeMulti = 'multiple';
-	        this.fltTypeCheckList = 'checklist';
-	        this.fltTypeNone = 'none';
-	
-	        /*** filters' grid properties ***/
-	
-	        //enables/disables filter grid
-	        this.fltGrid = f.grid === false ? false : true;
-	
-	        //enables/disables grid layout (fixed headers)
-	        this.gridLayout = Boolean(f.grid_layout);
-	
-	        this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index;
-	        this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index;
-	
-	        // 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 valid rows indexes (rows visible upon filtering)
-	        this.validRowsIndex = [];
-	        //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;
-	
-	        //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.stylePath = f.style_path || this.basePath + 'style/';
-	        this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows);
-	        //defines widths of columns
-	        this.hasColWidths = _types2.default.isArray(f.col_widths);
-	        this.colWidths = this.hasColWidths ? f.col_widths : null;
-	        //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';
-	
-	        /*** filters' grid behaviours ***/
-	        //enables/disables enter key
-	        this.enterKey = f.enter_key === false ? false : true;
-	        //calls function before filtering starts
-	        this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null;
-	        //calls function after filtering
-	        this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null;
-	        //enables/disables case sensitivity
-	        this.caseSensitive = Boolean(f.case_sensitive);
-	        //has exact match per column
-	        this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match);
-	        this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : [];
-	        //enables/disbles exact match for search
-	        this.exactMatch = Boolean(f.exact_match);
-	        //refreshes drop-down lists upon validation
-	        this.linkedFilters = Boolean(f.linked_filters);
-	        //wheter excluded options are disabled
-	        this.disableExcludedOptions = Boolean(f.disable_excluded_options);
-	        //stores active filter element
-	        this.activeFlt = null;
-	        //id of active filter
-	        this.activeFilterId = null;
-	        //enables always visible rows
-	        this.hasVisibleRows = Boolean(f.rows_always_visible);
-	        //array containing always visible rows
-	        this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : [];
-	        //enables/disables external filters generation
-	        this.isExternalFlt = Boolean(f.external_flt_grid);
-	        //array containing ids of external elements containing filters
-	        this.externalFltTgtIds = f.external_flt_grid_ids || [];
-	        //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null;
-	        //enables/disables single filter search
-	        this.singleSearchFlt = Boolean(f.single_filter);
-	        //calls function after row is validated
-	        this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null;
-	        //input watermark text array
-	        this.watermark = f.watermark || '';
-	        this.isWatermarkArray = _types2.default.isArray(this.watermark);
-	        //id of toolbar container element
-	        this.toolBarTgtId = f.toolbar_target_id || null;
-	        //enables/disables help div
-	        this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions);
-	        //popup filters
-	        this.popupFilters = Boolean(f.popup_filters);
-	        //active columns color
-	        this.markActiveColumns = Boolean(f.mark_active_columns);
-	        //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null;
-	        //calls function after active column header is marked
-	        this.onAfterActiveColumn = _types2.default.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 || 'Clear';
-	        //enables/disables empty option in combo-box filters
-	        this.enableEmptyOption = Boolean(f.enable_empty_option);
-	        //defines empty option text
-	        this.emptyText = f.empty_text || '(Empty)';
-	        //enables/disables non empty option in combo-box filters
-	        this.enableNonEmptyOption = Boolean(f.enable_non_empty_option);
-	        //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 = Boolean(f.sort_num_asc);
-	        this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null;
-	        //enables/disables descending numeric options sorting
-	        this.isSortNumDesc = Boolean(f.sort_num_desc);
-	        this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null;
-	        //Select filters are populated on demand
-	        this.loadFltOnDemand = Boolean(f.load_filters_on_demand);
-	        this.hasCustomOptions = _types2.default.isObj(f.custom_options);
-	        this.customOptions = f.custom_options;
-	
-	        /*** 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 || '^[¥£€$]';
-	        this.separator = f.separator || ',';
-	
-	        /*** rows counter ***/
-	        //show/hides rows counter
-	        this.rowsCounter = Boolean(f.rows_counter);
-	
-	        /*** status bar ***/
-	        //show/hides status bar
-	        this.statusBar = Boolean(f.status_bar);
-	
-	        /*** loader ***/
-	        //enables/disables loader/spinner indicator
-	        this.loader = Boolean(f.loader);
-	
-	        /*** validation - reset buttons/links ***/
-	        //show/hides filter's validation button
-	        this.displayBtn = Boolean(f.btn);
-	        //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 = Boolean(f.btn_reset);
-	        //defines css class for reset button
-	        this.btnResetCssClass = f.btn_reset_css_class || 'reset';
-	        //callback function before filters are cleared
-	        this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null;
-	        //callback function after filters are cleared
-	        this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null;
-	
-	        /*** paging ***/
-	        //enables/disables table paging
-	        this.paging = Boolean(f.paging);
-	        this.nbVisibleRows = 0; //nb visible rows
-	        this.nbHiddenRows = 0; //nb hidden rows
-	
-	        /*** autofilter on typing ***/
-	        //enables/disables auto filtering, table is filtered when user stops
-	        //typing
-	        this.autoFilter = Boolean(f.auto_filter);
-	        //onkeyup delay timer (msecs)
-	        this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900;
-	        //typing indicator
-	        this.isUserTyping = null;
-	        this.autoFilterTimer = null;
-	
-	        /*** keyword highlighting ***/
-	        //enables/disables keyword highlighting
-	        this.highlightKeywords = Boolean(f.highlight_keywords);
-	
-	        /*** No results feature ***/
-	        this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message);
-	
-	        /*** 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 = _types2.default.isArray(f.col_number_format);
-	        //array containing columns nb formats
-	        this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null;
-	        //enables date type per column
-	        this.hasColDateType = _types2.default.isArray(f.col_date_type);
-	        //array containing columns date type
-	        this.colDateType = this.hasColDateType ? f.col_date_type : null;
-	
-	        /*** 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_';
-	        //filter values cookie
-	        this.prfxCookieFltsValues = 'tf_flts_';
-	        //page nb cookie
-	        this.prfxCookiePageNb = 'tf_pgnb_';
-	        //page length cookie
-	        this.prfxCookiePageLen = 'tf_pglen_';
-	
-	        /*** cookies ***/
-	        this.hasStoredValues = false;
-	        //remembers filters values on page load
-	        this.rememberGridValues = Boolean(f.remember_grid_values);
-	        //cookie storing filter values
-	        this.fltsValuesCookie = this.prfxCookieFltsValues + this.id;
-	        //remembers page nb on page load
-	        this.rememberPageNb = this.paging && f.remember_page_number;
-	        //cookie storing page nb
-	        this.pgNbCookie = this.prfxCookiePageNb + this.id;
-	        //remembers page length on page load
-	        this.rememberPageLen = this.paging && f.remember_page_length;
-	        //cookie storing page length
-	        this.pgLenCookie = this.prfxCookiePageLen + this.id;
-	
-	        /*** extensions ***/
-	        //imports external script
-	        this.extensions = f.extensions;
-	        this.hasExtensions = _types2.default.isArray(this.extensions);
-	
-	        /*** themes ***/
-	        this.enableDefaultTheme = Boolean(f.enable_default_theme);
-	        //imports themes
-	        this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes);
-	        this.themes = f.themes || [];
-	        //themes path
-	        this.themesPath = f.themes_path || this.stylePath + 'themes/';
-	
-	        // Features registry
-	        this.Mod = {};
-	
-	        // Extensions registry
-	        this.ExtRegistry = {};
-	
-	        /*** TF events ***/
-	        this.Evt = {
-	            // Detect  key
-	
-	            detectKey: function detectKey(e) {
-	                if (!this.enterKey) {
-	                    return;
-	                }
-	                // let _ev = e || global.event;
-	                if (e) {
-	                    var key = _event2.default.keyCode(e);
-	                    if (key === 13) {
-	                        this.filter();
-	                        _event2.default.cancel(e);
-	                        _event2.default.stop(e);
-	                    } else {
-	                        this.isUserTyping = true;
-	                        global.clearInterval(this.autoFilterTimer);
-	                        this.autoFilterTimer = null;
-	                    }
-	                }
-	            },
-	
-	            // if auto-filter on, detect user is typing and filter columns
-	            onKeyUp: function onKeyUp(e) {
-	                if (!this.autoFilter) {
-	                    return;
-	                }
-	                // let _ev = e || global.event;
-	                var key = _event2.default.keyCode(e);
-	                this.isUserTyping = false;
-	
-	                function filter() {
-	                    /*jshint validthis:true */
-	                    global.clearInterval(this.autoFilterTimer);
-	                    this.autoFilterTimer = null;
-	                    if (!this.isUserTyping) {
-	                        this.filter();
-	                        this.isUserTyping = null;
-	                    }
-	                }
-	
-	                if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) {
-	                    if (this.autoFilterTimer === null) {
-	                        this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay);
-	                    }
-	                } else {
-	                    global.clearInterval(this.autoFilterTimer);
-	                    this.autoFilterTimer = null;
-	                }
-	            },
-	
-	            // if auto-filter on, detect user is typing
-	            onKeyDown: function onKeyDown() {
-	                if (!this.autoFilter) {
-	                    return;
-	                }
-	                this.isUserTyping = true;
-	            },
-	
-	            // if auto-filter on, clear interval on filter blur
-	            onInpBlur: function onInpBlur() {
-	                if (this.autoFilter) {
-	                    this.isUserTyping = false;
-	                    global.clearInterval(this.autoFilterTimer);
-	                }
-	                // TODO: hack to prevent ezEditTable enter key event hijaking.
-	                // Needs to be fixed in the vendor's library
-	                if (this.hasExtension('advancedGrid')) {
-	                    var advGrid = this.extension('advancedGrid');
-	                    var ezEditTable = advGrid._ezEditTable;
-	                    if (advGrid.cfg.editable) {
-	                        ezEditTable.Editable.Set();
-	                    }
-	                    if (advGrid.cfg.selection) {
-	                        ezEditTable.Selection.Set();
-	                    }
-	                }
-	            },
-	
-	            // set focused text-box filter as active
-	            onInpFocus: function onInpFocus(e) {
-	                // let _ev = e || global.event;
-	                var elm = _event2.default.target(e);
-	                this.activeFilterId = elm.getAttribute('id');
-	                this.activeFlt = _dom2.default.id(this.activeFilterId);
-	                if (this.popupFilters) {
-	                    _event2.default.cancel(e);
-	                    _event2.default.stop(e);
-	                }
-	                // TODO: hack to prevent ezEditTable enter key event hijaking.
-	                // Needs to be fixed in the vendor's library
-	                if (this.hasExtension('advancedGrid')) {
-	                    var advGrid = this.extension('advancedGrid');
-	                    var ezEditTable = advGrid._ezEditTable;
-	                    if (advGrid.cfg.editable) {
-	                        ezEditTable.Editable.Remove();
-	                    }
-	                    if (advGrid.cfg.selection) {
-	                        ezEditTable.Selection.Remove();
-	                    }
-	                }
-	            },
-	
-	            // set focused drop-down filter as active
-	            onSlcFocus: function onSlcFocus(e) {
-	                // let _ev = e || global.event;
-	                var elm = _event2.default.target(e);
-	                this.activeFilterId = elm.getAttribute('id');
-	                this.activeFlt = _dom2.default.id(this.activeFilterId);
-	                // select is populated when element has focus
-	                if (this.loadFltOnDemand && elm.getAttribute('filled') === '0') {
-	                    var ct = elm.getAttribute('ct');
-	                    this.Mod.dropdown.build(ct);
-	                }
-	                if (this.popupFilters) {
-	                    _event2.default.cancel(e);
-	                    _event2.default.stop(e);
-	                }
-	            },
-	
-	            // filter columns on drop-down filter change
-	            onSlcChange: function onSlcChange() /*e*/{
-	                if (!this.activeFlt) {
-	                    return;
-	                }
-	                // let _ev = e || global.event;
-	                // if(this.popupFilters){ Event.stop(e); }
-	                if (this.onSlcChange) {
-	                    this.filter();
-	                }
-	            } /*,
-	              // fill checklist filter on click if required
-	              onCheckListClick(e) {
-	                 let _ev = e || global.event;
-	                 let elm = Event.target(_ev);
-	                 if(this.loadFltOnDemand && elm.getAttribute('filled') === '0'){
-	                     let ct = elm.getAttribute('ct');
-	                     this.Mod.checkList.build(ct);
-	                     this.Mod.checkList.checkListDiv[ct].onclick = null;
-	                     this.Mod.checkList.checkListDiv[ct].title = '';
-	                 }
-	              }*/
-	
-	        };
-	    }
-	
-	    /**
-	     * Initialise filtering grid bar behaviours and layout
-	     *
-	     * TODO: decompose in smaller methods
-	     */
-	
-	    _createClass(TableFilter, [{
-	        key: 'init',
-	        value: function init() {
-	            var _this2 = this;
-	
-	            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 Mod = this.Mod;
-	            var n = this.singleSearchFlt ? 1 : this.nbCells,
-	                inpclass = undefined;
-	
-	            //loads stylesheet if not imported
-	            this.import(this.stylesheetId, this.stylesheet, null, 'link');
-	
-	            //loads theme
-	            if (this.hasThemes) {
-	                this.loadThemes();
-	            }
-	
-	            if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) {
-	                Mod.store = new _store.Store(this);
-	                Mod.store.init();
-	            }
-	
-	            if (this.gridLayout) {
-	                Mod.gridLayout = new _gridLayout.GridLayout(this);
-	                Mod.gridLayout.init();
-	            }
-	
-	            if (this.loader) {
-	                if (!Mod.loader) {
-	                    Mod.loader = new _loader.Loader(this);
-	                }
-	                Mod.loader.init();
-	            }
-	
-	            if (this.highlightKeywords) {
-	                Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this);
-	                Mod.highlightKeyword.init();
-	            }
-	
-	            if (this.popupFilters) {
-	                if (!Mod.popupFilter) {
-	                    Mod.popupFilter = new _popupFilter.PopupFilter(this);
-	                }
-	                Mod.popupFilter.init();
-	            }
-	
-	            //filters grid is not generated
-	            if (!this.fltGrid) {
-	                this._initNoFilters();
-	            } else {
-	                if (this.isFirstLoad) {
-	                    var fltrow = this._insertFiltersRow();
-	                    // if(!this.gridLayout){
-	                    //     let 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.popupFilters){
-	                    //         fltrow.style.display = 'none';
-	                    //     }
-	                    // }
-	
-	                    this.nbFilterableRows = this.getRowsNb();
-	                    this.nbVisibleRows = this.nbFilterableRows;
-	                    this.nbRows = this.tbl.rows.length;
-	
-	                    // Generate filters
-	                    for (var i = 0; i < n; i++) {
-	
-	                        // if(this.popupFilters){
-	                        //     Mod.popupFilter.build(i);
-	                        // }
-	                        this.emitter.emit('before-filter-init', this, i);
-	
-	                        var fltcell = _dom2.default.create(this.fltCellTag),
-	                            col = this.getFilterType(i) /*,
-	                                                        externalFltTgtId = this.isExternalFlt ?
-	                                                        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;
-	
-	                        //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 (!Mod.dropdown) {
-	                                Mod.dropdown = new _dropdown.Dropdown(this);
-	                            }
-	                            Mod.dropdown.init(i, this.isExternalFlt, fltcell);
-	                            // let dropdown = Mod.dropdown;
-	
-	                            // let 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;
-	
-	                            // //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.loadFltOnDemand){
-	                            //     dropdown.build(i);
-	                            // }
-	
-	                            // Event.add(slc, 'keypress',
-	                            //     this.Evt.detectKey.bind(this));
-	                            // Event.add(slc, 'change',
-	                            //     this.Evt.onSlcChange.bind(this));
-	                            // Event.add(slc, 'focus',
-	                            // this.Evt.onSlcFocus.bind(this));
-	
-	                            // 1st option is created here since dropdown.build isn't
-	                            // invoked
-	                            // if(this.loadFltOnDemand){
-	                            //    let opt0 = Dom.createOpt(this.displayAllText, '');
-	                            //     slc.appendChild(opt0);
-	                            // }
-	                        }
-	                        // checklist
-	                        else if (col === this.fltTypeCheckList) {
-	                                // let checkList;
-	                                // Mod.checkList = new CheckList(this);
-	                                // checkList = Mod.checkList;
-	                                if (!Mod.checkList) {
-	                                    Mod.checkList = new _checkList.CheckList(this);
-	                                }
-	                                Mod.checkList.init(i, this.isExternalFlt, fltcell);
-	
-	                                // let divCont = Dom.create('div',
-	                                //     ['id', checkList.prfxCheckListDiv+i+'_'+this.id],
-	                                //     ['ct', i], ['filled', '0']);
-	                                // divCont.className = checkList.checkListDivCssClass;
-	
-	                                // //filter is appended in desired element
-	                                // if(externalFltTgtId){
-	                                //     Dom.id(externalFltTgtId).appendChild(divCont);
-	                                //     this.externalFltEls.push(divCont);
-	                                // } else {
-	                                //     fltcell.appendChild(divCont);
-	                                // }
-	
-	                                // checkList.checkListDiv[i] = divCont;
-	                                // this.fltIds.push(this.prfxFlt+i+'_'+this.id);
-	                                // if(!this.loadFltOnDemand){
-	                                //     checkList.build(i);
-	                                // }
-	
-	                                // if(this.loadFltOnDemand){
-	                                //     Event.add(divCont, 'click',
-	                                //         this.Evt.onCheckListClick.bind(this));
-	                                //     divCont.appendChild(
-	                                //         Dom.text(checkList.activateCheckListTxt));
-	                                // }
-	                            } else {
-	                                    this._buildInputFilter(i, inpclass, fltcell);
-	                                    //show/hide input
-	                                    //let inptype = col===this.fltTypeInp ? 'text' :
-	                                    //'hidden';
-	                                    // let 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;
-	                                    //Event.add(inp, 'focus',
-	                                    //this.Evt.onInpFocus.bind(this));
-	
-	                                    // //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);
-	
-	                                    // Event.add(inp, 'keypress',
-	                                    //     this.Evt.detectKey.bind(this));
-	                                    // Event.add(inp, 'keydown',
-	                                    //     this.Evt.onKeyDown.bind(this));
-	                                    // Event.add(inp, 'keyup', this.Evt.onKeyUp.bind(this));
-	                                    //Event.add(inp, 'blur', this.Evt.onInpBlur.bind(this));
-	
-	                                    // if(this.rememberGridValues){
-	                                    //     let flts_values = this.Mod.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) {
-	                            this._buildSubmitButton(i, fltcell);
-	                            // let 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);
-	                            // }
-	
-	                            // Event.add(btn, 'click', ()=> this.filter());
-	                        } //if
-	
-	                        this.emitter.emit('after-filter-init', this, i);
-	                    } // for i
-	                } else {
-	                        this._resetGrid();
-	                    } //if isFirstLoad
-	            } //if this.fltGrid
-	
-	            /* Features */
-	            if (this.hasVisibleRows) {
-	                this.emitter.on(['after-filtering'], function () {
-	                    return _this2.enforceVisibility();
-	                });
-	                this.enforceVisibility();
-	            }
-	            if (this.rowsCounter) {
-	                Mod.rowsCounter = new _rowsCounter.RowsCounter(this);
-	                Mod.rowsCounter.init();
-	            }
-	            if (this.statusBar) {
-	                Mod.statusBar = new _statusBar.StatusBar(this);
-	                Mod.statusBar.init();
-	            }
-	            if (this.paging || Mod.paging) {
-	                if (!Mod.paging) {
-	                    Mod.paging = new _paging.Paging(this);
-	                    Mod.paging.init();
-	                }
-	                Mod.paging.reset();
-	            }
-	            if (this.btnReset) {
-	                Mod.clearButton = new _clearButton.ClearButton(this);
-	                Mod.clearButton.init();
-	            }
-	            if (this.help) {
-	                if (!Mod.help) {
-	                    Mod.help = new _help.Help(this);
-	                }
-	                Mod.help.init();
-	            }
-	            if (this.hasColWidths && !this.gridLayout) {
-	                this.setColWidths();
-	            }
-	            if (this.alternateRows) {
-	                Mod.alternateRows = new _alternateRows.AlternateRows(this);
-	                Mod.alternateRows.init();
-	            }
-	            if (this.noResults) {
-	                if (!Mod.noResults) {
-	                    Mod.noResults = new _noResults.NoResults(this);
-	                }
-	                Mod.noResults.init();
-	            }
-	
-	            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) {
-	                _dom2.default.addClass(this.tbl, this.prfxTf);
-	            }
-	
-	            /* Loads extensions */
-	            if (this.hasExtensions) {
-	                this.initExtensions();
-	            }
-	
-	            // Subscribe to events
-	            if (this.markActiveColumns) {
-	                this.emitter.on(['before-filtering'], function () {
-	                    return _this2.clearActiveColumns();
-	                });
-	                this.emitter.on(['cell-processed'], function (tf, colIndex) {
-	                    return _this2.markActiveColumn(colIndex);
-	                });
-	            }
-	            if (this.linkedFilters) {
-	                this.emitter.on(['after-filtering'], function () {
-	                    return _this2.linkFilters();
-	                });
-	            }
-	
-	            if (this.onFiltersLoaded) {
-	                this.onFiltersLoaded.call(null, this);
-	            }
-	
-	            this.emitter.emit('initialized', this);
-	        }
-	
-	        /**
-	         * Insert filters row at initialization
-	         */
-	
-	    }, {
-	        key: '_insertFiltersRow',
-	        value: function _insertFiltersRow() {
-	            if (this.gridLayout) {
-	                return;
-	            }
-	            var fltrow = undefined;
-	
-	            var thead = _dom2.default.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++;
-	                }
-	
-	            fltrow.className = this.fltsRowCssClass;
-	
-	            if (this.isExternalFlt) {
-	                fltrow.style.display = 'none';
-	            }
-	
-	            this.emitter.emit('filters-row-inserted', this, fltrow);
-	
-	            return fltrow;
-	        }
-	
-	        /**
-	         * Initialize filtersless table
-	         */
-	
-	    }, {
-	        key: '_initNoFilters',
-	        value: function _initNoFilters() {
-	            if (this.fltGrid) {
-	                return;
-	            }
-	            this.refRow = this.refRow > 0 ? this.refRow - 1 : 0;
-	            // if(this.gridLayout){
-	            //     this.refRow = 0;
-	            // }
-	            this.nbFilterableRows = this.getRowsNb();
-	            this.nbVisibleRows = this.nbFilterableRows;
-	            this.nbRows = this.nbFilterableRows + this.refRow;
-	        }
-	
-	        /**
-	         * Build input filter type
-	         * @param  {Number} colIndex      Column index
-	         * @param  {String} cssClass      Css class applied to filter
-	         * @param  {DOMElement} container Container DOM element
-	         */
-	
-	    }, {
-	        key: '_buildInputFilter',
-	        value: function _buildInputFilter(colIndex, cssClass, container) {
-	            var col = this.getFilterType(colIndex);
-	            var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null;
-	            var inptype = col === this.fltTypeInp ? 'text' : 'hidden';
-	            var inp = _dom2.default.create(this.fltTypeInp, ['id', this.prfxFlt + colIndex + '_' + this.id], ['type', inptype], ['ct', colIndex]);
-	            if (inptype !== 'hidden' && this.watermark) {
-	                inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark);
-	            }
-	            inp.className = cssClass || this.fltCssClass;
-	            _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this));
-	
-	            //filter is appended in desired element
-	            if (externalFltTgtId) {
-	                _dom2.default.id(externalFltTgtId).appendChild(inp);
-	                this.externalFltEls.push(inp);
-	            } else {
-	                container.appendChild(inp);
-	            }
-	
-	            this.fltIds.push( /*this.prfxFlt+i+'_'+this.id*/inp.id);
-	
-	            _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this));
-	            _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this));
-	            _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this));
-	            _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this));
-	
-	            // if(this.rememberGridValues){
-	            //     let fltValues = this.Mod.store.getFilterValues(
-	            //         this.fltsValuesCookie);
-	            //     if(fltValues[colIndex]!=' '){
-	            //         this.setFilterValue(colIndex, fltValues[colIndex], false);
-	            //     }
-	            // }
-	        }
-	
-	        /**
-	         * Build submit button
-	         * @param  {Number} colIndex      Column index
-	         * @param  {DOMElement} container Container DOM element
-	         */
-	
-	    }, {
-	        key: '_buildSubmitButton',
-	        value: function _buildSubmitButton(colIndex, container) {
-	            var _this3 = this;
-	
-	            var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null;
-	            var btn = _dom2.default.create(this.fltTypeInp, ['id', this.prfxValButton + colIndex + '_' + this.id], ['type', 'button'], ['value', this.btnText]);
-	            btn.className = this.btnCssClass;
-	
-	            //filter is appended in desired element
-	            if (externalFltTgtId) {
-	                _dom2.default.id(externalFltTgtId).appendChild(btn);
-	            } else {
-	                container.appendChild(btn);
-	            }
-	
-	            _event2.default.add(btn, 'click', function () {
-	                return _this3.filter();
-	            });
-	        }
-	
-	        /**
-	         * Return a feature instance for a given name
-	         * @param  {String} name Name of the feature
-	         * @return {Object}
-	         */
-	
-	    }, {
-	        key: 'feature',
-	        value: function feature(name) {
-	            return this.Mod[name];
-	        }
-	
-	        /**
-	         * Initialise all the extensions defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'initExtensions',
-	        value: function initExtensions() {
-	            var exts = this.extensions;
-	
-	            this.emitter.emit('before-loading-extensions', this);
-	            for (var i = 0, len = exts.length; i < len; i++) {
-	                var ext = exts[i];
-	                if (!this.ExtRegistry[ext.name]) {
-	                    this.loadExtension(ext);
-	                }
-	            }
-	            this.emitter.emit('after-loading-extensions', this);
-	        }
-	
-	        /**
-	         * Load an extension module
-	         * @param  {Object} ext Extension config object
-	         */
-	
-	    }, {
-	        key: 'loadExtension',
-	        value: function loadExtension(ext) {
-	            var _this4 = this;
-	
-	            if (!ext || !ext.name) {
-	                return;
-	            }
-	
-	            var name = ext.name;
-	            var path = ext.path;
-	            var modulePath = undefined;
-	
-	            if (name && path) {
-	                modulePath = ext.path + name;
-	            } else {
-	                name = name.replace('.js', '');
-	                modulePath = 'extensions/{}/{}'.replace(/{}/g, name);
-	            }
-	
-	            // Trick to set config's publicPath dynamically for Webpack...
-	            __webpack_require__.p = this.basePath;
-	
-	            __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) {
-	                var inst = new mod.default(_this4, ext);
-	                inst.init();
-	                _this4.ExtRegistry[name] = inst;
-	            }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});
-	        }
-	
-	        /**
-	         * Get an extension instance
-	         * @param  {String} name Name of the extension
-	         * @return {Object}      Extension instance
-	         */
-	
-	    }, {
-	        key: 'extension',
-	        value: function extension(name) {
-	            return this.ExtRegistry[name];
-	        }
-	
-	        /**
-	         * Check passed extension name exists
-	         * @param  {String}  name Name of the extension
-	         * @return {Boolean}
-	         */
-	
-	    }, {
-	        key: 'hasExtension',
-	        value: function hasExtension(name) {
-	            return !_types2.default.isEmpty(this.ExtRegistry[name]);
-	        }
-	
-	        /**
-	         * Destroy all the extensions defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'destroyExtensions',
-	        value: function destroyExtensions() {
-	            var exts = this.extensions;
-	
-	            for (var i = 0, len = exts.length; i < len; i++) {
-	                var ext = exts[i];
-	                var extInstance = this.ExtRegistry[ext.name];
-	                if (extInstance) {
-	                    extInstance.destroy();
-	                    this.ExtRegistry[ext.name] = null;
-	                }
-	            }
-	        }
-	
-	        /**
-	         * Load themes defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'loadThemes',
-	        value: function loadThemes() {
-	            var themes = this.themes;
-	            this.emitter.emit('before-loading-themes', this);
-	
-	            //Default theme config
-	            if (this.enableDefaultTheme) {
-	                var defaultTheme = { name: 'default' };
-	                this.themes.push(defaultTheme);
-	            }
-	            if (_types2.default.isArray(themes)) {
-	                for (var i = 0, len = themes.length; i < len; i++) {
-	                    var theme = themes[i];
-	                    var name = theme.name;
-	                    var path = theme.path;
-	                    var styleId = this.prfxTf + name;
-	                    if (name && !path) {
-	                        path = this.themesPath + name + '/' + name + '.css';
-	                    } else if (!name && theme.path) {
-	                        name = 'theme{0}'.replace('{0}', i);
-	                    }
-	
-	                    if (!this.isImported(path, 'link')) {
-	                        this.import(styleId, path, null, 'link');
-	                    }
-	                }
-	            }
-	
-	            //Some elements need to be overriden for default 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; - - this.emitter.emit('after-loading-themes', this); - } - - /** - * Return stylesheet DOM element for a given theme name - * @return {DOMElement} stylesheet element - */ - - }, { - key: 'getStylesheet', - value: function getStylesheet() { - var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; - - return _dom2.default.id(this.prfxTf + name); - } - - /** - * Destroy filter grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this5 = this; - - if (!this._hasGrid) { - return; - } - var rows = this.tbl.rows, - Mod = this.Mod; - - // this.clearFilters(); - - if (this.isExternalFlt && !this.popupFilters) { - this.removeExternalFlts(); - } - if (this.infDiv) { - this.removeToolbar(); - } - if (this.highlightKeywords) { - Mod.highlightKeyword.unhighlightAll(); - } - if (this.markActiveColumns) { - this.clearActiveColumns(); - this.emitter.off(['before-filtering'], function () { - return _this5.clearActiveColumns(); - }); - this.emitter.off(['cell-processed'], function (tf, colIndex) { - return _this5.markActiveColumn(colIndex); - }); - } - if (this.hasExtensions) { - this.destroyExtensions(); - } - - for (var j = this.refRow; j < this.nbRows; j++) { - // validate row - this.validateRow(j, true); - - //removes alternating colors - if (this.alternateRows) { - Mod.alternateRows.removeRowBg(j); - } - } //for j - - if (this.fltGrid && !this.gridLayout) { - this.fltGridEl = rows[this.filtersRowIndex]; - this.tbl.deleteRow(this.filtersRowIndex); - } - - // Destroy modules - Object.keys(Mod).forEach(function (key) { - var feature = Mod[key]; - if (feature && _types2.default.isFn(feature.destroy)) { - feature.destroy(); - } - }); - - // unsubscribe to events - if (this.hasVisibleRows) { - this.emitter.off(['after-filtering'], function () { - return _this5.enforceVisibility(); - }); - } - if (this.linkedFilters) { - this.emitter.off(['after-filtering'], function () { - return _this5.linkFilters(); - }); - } - - _dom2.default.removeClass(this.tbl, this.prfxTf); - this.nbHiddenRows = 0; - this.validRowsIndex = []; - this.activeFlt = null; - this._hasGrid = false; - // this.tbl = null; - } - - /** - * Generate container element for paging, reset button, rows counter etc. - */ - - }, { - key: 'setToolbar', - value: function setToolbar() { - if (this.infDiv) { - return; - } - - /*** container div ***/ - var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); - infdiv.className = this.infDivCssClass; - - //custom container - if (this.toolBarTgtId) { - _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); - } - //grid-layout - else if (this.gridLayout) { - var gridLayout = this.Mod.gridLayout; - gridLayout.tblMainCont.appendChild(infdiv); - infdiv.className = gridLayout.gridInfDivCssClass; - } - //default location: just above the table - else { - var cont = _dom2.default.create('caption'); - cont.appendChild(infdiv); - this.tbl.insertBefore(cont, this.tbl.firstChild); - } - this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); - - /*** left div containing rows # displayer ***/ - var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); - ldiv.className = this.lDivCssClass; - infdiv.appendChild(ldiv); - this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); - - /*** right div containing reset button - + nb results per page select ***/ - var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); - rdiv.className = this.rDivCssClass; - infdiv.appendChild(rdiv); - this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); - - /*** mid div containing paging elements ***/ - var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); - mdiv.className = this.mDivCssClass; - infdiv.appendChild(mdiv); - this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); - - // Enable help instructions by default if topbar is generated and not - // explicitely set to false - if (_types2.default.isUndef(this.help)) { - if (!this.Mod.help) { - this.Mod.help = new _help.Help(this); - } - this.Mod.help.init(); - this.help = true; - } - } - - /** - * Remove toolbar container element - */ - - }, { - key: 'removeToolbar', - value: function removeToolbar() { - if (!this.infDiv) { - return; - } - _dom2.default.remove(this.infDiv); - this.infDiv = null; - - var tbl = this.tbl; - var captions = _dom2.default.tag(tbl, 'caption'); - if (captions.length > 0) { - [].forEach.call(captions, function (elm) { - tbl.removeChild(elm); - }); - } - } - - /** - * Remove all the external column filters - */ - - }, { - key: 'removeExternalFlts', - value: function removeExternalFlts() { - if (!this.isExternalFlt) { - return; - } - var ids = this.externalFltTgtIds, - len = ids.length; - for (var ct = 0; ct < len; ct++) { - var externalFltTgtId = ids[ct], - externalFlt = _dom2.default.id(externalFltTgtId); - if (externalFlt) { - externalFlt.innerHTML = ''; - } - } - } - - /** - * Check if given column implements a filter with custom options - * @param {Number} colIndex Column's index - * @return {Boolean} - */ - - }, { - key: 'isCustomOptions', - value: function isCustomOptions(colIndex) { - return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; - } - - /** - * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the - * custom options values and texts - * @param {Number} colIndex Column's index - * @return {Array} - */ - - }, { - key: 'getCustomOptions', - value: function getCustomOptions(colIndex) { - if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { - return; - } - - var customOptions = this.customOptions; - var cols = customOptions.cols; - var optTxt = [], - optArray = []; - var index = cols.indexOf(colIndex); - var slcValues = customOptions.values[index]; - var slcTexts = customOptions.texts[index]; - var slcSort = customOptions.sorts[index]; - - for (var r = 0, len = slcValues.length; r < len; r++) { - optArray.push(slcValues[r]); - if (slcTexts[r]) { - optTxt.push(slcTexts[r]); - } else { - optTxt.push(slcValues[r]); - } - } - if (slcSort) { - optArray.sort(); - optTxt.sort(); - } - return [optArray, optTxt]; - } - - /** - * Reset persisted filter values - */ - - }, { - key: 'resetValues', - value: function resetValues() { - var _this6 = this; - - //only loadFltOnDemand - if (this.rememberGridValues) { - if (this.loadFltOnDemand) { - this._resetGridValues(this.fltsValuesCookie); - } else { - var fltValues = this.Mod.store.getFilterValues(this.fltsValuesCookie); - fltValues.forEach(function (val, idx) { - if (val !== ' ') { - _this6.setFilterValue(idx, val); - } - }); - } - } - this.filter(); - } - - /** - * Reset persisted filter values when load filters on demand feature is - * enabled - * @param {String} name cookie name storing filter values - */ - - }, { - key: '_resetGridValues', - value: function _resetGridValues(name) { - if (!this.loadFltOnDemand) { - return; - } - var fltsValues = this.Mod.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 = undefined, - opt = undefined; - var fltType = this.getFilterType(i); - // if loadFltOnDemand, drop-down needs to contain stored - // value(s) for filtering - if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { - var slc = _dom2.default.id(this.fltIds[i]); - slc.options[0].selected = false; - - //selects - if (slcFltsIndex.indexOf(i) != -1) { - opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - //multiple select - if (multiFltsIndex.indexOf(i) != -1) { - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - opt = _dom2.default.createOpt(s[j], s[j], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - } // if multiFltsIndex - } else if (fltType === this.fltTypeCheckList) { - var checkList = this.Mod.checkList; - var divChk = checkList.checkListDiv[i]; - divChk.title = divChk.innerHTML; - divChk.innerHTML = ''; - - var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); - ul.className = checkList.checkListCssClass; - - var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); - li0.className = checkList.checkListItemCssClass; - ul.appendChild(li0); - - divChk.appendChild(ul); - - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - var li = _dom2.default.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; - } - } else if (fltType === this.fltTypeInp) { - this.setFilterValue(i, fltsValues[i]); - } - } //end for - - if (!this.hasStoredValues && this.paging) { - this.Mod.paging.setPagingInfo(); - } - } //end if - } - - /** - * Filter the table by retrieving the data from each cell in every single - * row and comparing it to the search term for current column. A row is - * hidden when all the search terms are not found in inspected row. - * - * TODO: Reduce complexity of this massive method - */ - - }, { - key: 'filter', - value: function filter() { - if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { - return; - } - //invoke onbefore callback - if (this.onBeforeFilter) { - this.onBeforeFilter.call(null, this); - } - this.emitter.emit('before-filtering', this); - - var row = this.tbl.rows, - Mod = this.Mod, - hiddenrows = 0; - - this.validRowsIndex = []; - // search args re-init - this.searchArgs = this.getFiltersValue(); - - var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); - - //keyword highlighting - function highlight(str, ok, cell) { - /*jshint validthis:true */ - if (this.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 = _dom2.default.getText(cell); - } - if (w !== '') { - Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); - } - } - } - - //looks for search argument in current row - function hasArg(sA, cellData, j) { - /*jshint validthis:true */ - var occurence = undefined, - removeNbFormat = _helpers2.default.removeNbFormat; - - //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); - var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); - var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); - var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); - var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); - var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); - - var dte1 = undefined, - dte2 = undefined; - //dates - if (_date2.default.isValid(cellData, dtType)) { - dte1 = _date2.default.format(cellData, dtType); - // lower date - if (isLDate) { - dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); - occurence = dte1 < dte2; - } - // lower equal date - else if (isLEDate) { - dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); - occurence = dte1 <= dte2; - } - // greater equal date - else if (isGEDate) { - dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); - occurence = dte1 >= dte2; - } - // greater date - else if (isGDate) { - dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); - occurence = dte1 > dte2; - } - // different date - else if (isDFDate) { - dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); - occurence = dte1.toString() != dte2.toString(); - } - // equal date - else if (isEQDate) { - dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } else if (_date2.default.isValid(sA, dtType)) { - dte2 = _date2.default.format(sA, dtType); - occurence = dte1.toString() === dte2.toString(); - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } else { - //first numbers need to be formated - if (this.hasColNbFormat && this.colNbFormat[j]) { - numCellData = removeNbFormat(cellData, this.colNbFormat[j]); - nbFormat = this.colNbFormat[j]; - } else { - if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { - numCellData = removeNbFormat(cellData, 'us'); - nbFormat = 'us'; - } else { - numCellData = removeNbFormat(cellData, 'eu'); - nbFormat = 'eu'; - } - } - - // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, - // rgx:) - // lower equal - if (hasLE) { - occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); - } - //greater equal - else if (hasGE) { - occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); - } - //lower - else if (hasLO) { - occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); - } - //greater - else if (hasGR) { - occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); - } - //different - else if (hasDF) { - occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; - } - //like - else if (hasLK) { - occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } - //equal - else if (hasEQ) { - occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); - } - //starts with - else if (hasST) { - occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; - } - //ends with - else if (hasEN) { - var searchArg = sA.replace(re_en, ''); - occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } - //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(cellData); - } catch (e) { - occurence = false; - } - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } //else - return occurence; - } //fn - - for (var k = this.refRow; k < this.nbRows; k++) { - /*** if table already filtered some rows are not visible ***/ - if (this.getRowDisplay(row[k]) === '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 = true, - - //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]; - var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; - if (sA === '') { - continue; - } - - var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); - - //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 = undefined, - occur = false, - s = hasMultiOrSA ? sAOrSplit : sAAndSplit; - for (var w = 0, len = s.length; w < len; w++) { - cS = _string2.default.trim(s[w]); - occur = hasArg.call(this, cS, cellData, j); - highlight.call(this, cS, occur, cell[j]); - if (hasMultiOrSA && occur) { - break; - } - if (hasMultiAndSA && !occur) { - break; - } - } - occurence[j] = occur; - } - //single search parameter - else { - occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); - highlight.call(this, sA, occurence[j], cell[j]); - } //else single param - - if (!occurence[j]) { - isRowValid = false; - } - if (this.singleSearchFlt && occurence[j]) { - singleFltRowValid = true; - } - - this.emitter.emit('cell-processed', this, j, cell[j]); - } //for j - - if (this.singleSearchFlt && singleFltRowValid) { - isRowValid = true; - } - - if (!isRowValid) { - this.validateRow(k, false); - hiddenrows++; - } else { - this.validateRow(k, true); - } - - this.emitter.emit('row-processed', this, k, this.validRowsIndex.length, isRowValid); - } // for k - - this.nbVisibleRows = this.validRowsIndex.length; - this.nbHiddenRows = hiddenrows; - - //invokes onafterfilter callback - if (this.onAfterFilter) { - this.onAfterFilter.call(null, this); - } - - this.emitter.emit('after-filtering', this); - } - - /** - * Return the data of a specified colum - * @param {Number} colIndex Column index - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} num Optional: return unformatted number - * @param {Array} exclude Optional: list of row indexes to be excluded - * @return {Array} Flat list of data for a column - */ - - }, { - key: 'getColValues', - value: function getColValues(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; - - if (!this.fltGrid) { - return; - } - var row = this.tbl.rows, - colValues = []; - - if (includeHeaders) { - colValues.push(this.getHeadersText()[colIndex]); - } - - for (var i = this.refRow; i < this.nbRows; i++) { - var isExludedRow = false; - // checks if current row index appears in exclude array - if (exclude.length > 0) { - isExludedRow = exclude.indexOf(i) != -1; - } - 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 !== '') { - continue; - } - var cellData = this.getCellData(cell[j]), - nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, - data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; - colValues.push(data); - } - } - } - return colValues; - } - - /** - * Return the filter's value of a specified column - * @param {Number} index Column index - * @return {String} Filter value - */ - - }, { - key: 'getFilterValue', - value: function getFilterValue(index) { - if (!this.fltGrid) { - return; - } - var fltValue = undefined, - flt = this.getFilterElement(index); - if (!flt) { - return ''; - } - - var fltColType = this.getFilterType(index); - if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { - fltValue = flt.value; - } - //mutiple select - else if (fltColType === this.fltTypeMulti) { - fltValue = ''; - for (var j = 0, len = flt.options.length; j < len; 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; - } - - /** - * Return the filters' values - * @return {Array} List of filters' values - */ - - }, { - key: 'getFiltersValue', - value: function getFiltersValue() { - if (!this.fltGrid) { - return; - } - var searchArgs = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); - } - return searchArgs; - } - - /** - * Return the ID of the filter of a specified column - * @param {Number} index Column's index - * @return {String} ID of the filter element - */ - - }, { - key: 'getFilterId', - value: function getFilterId(index) { - if (!this.fltGrid) { - return; - } - return this.fltIds[index]; - } - - /** - * Return the list of ids of filters matching a specified type. - * Note: hidden filters are also returned - * - * @param {String} type Filter type string ('input', 'select', 'multiple', - * 'checklist') - * @param {Boolean} bool If true returns columns indexes instead of IDs - * @return {[type]} List of element IDs or column indexes - */ - - }, { - key: 'getFiltersByType', - value: function getFiltersByType(type, bool) { - if (!this.fltGrid) { - return; - } - var arr = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - var fltType = this.getFilterType(i); - if (fltType === _string2.default.lower(type)) { - var a = bool ? i : this.fltIds[i]; - arr.push(a); - } - } - return arr; - } - - /** - * Return the filter's DOM element for a given column - * @param {Number} index Column's index - * @return {DOMElement} - */ - - }, { - key: 'getFilterElement', - value: function getFilterElement(index) { - var fltId = this.fltIds[index]; - return _dom2.default.id(fltId); - } - - /** - * Return the number of cells for a given row index - * @param {Number} rowIndex Index of the row - * @return {Number} Number of cells - */ - - }, { - key: 'getCellsNb', - value: function getCellsNb() { - var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; - - var tr = this.tbl.rows[rowIndex]; - return tr.cells.length; - } - - /** - * Return the number of filterable rows starting from reference row if - * defined - * @param {Boolean} includeHeaders Include the headers row - * @return {Number} Number of filterable rows - */ - - }, { - key: 'getRowsNb', - value: function getRowsNb(includeHeaders) { - var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, - ntrs = this.tbl.rows.length; - if (includeHeaders) { - s = 0; - } - return parseInt(ntrs - s, 10); - } - - /** - * Return the data of a given cell - * @param {DOMElement} cell Cell's DOM object - * @return {String} - */ - - }, { - key: 'getCellData', - value: function getCellData(cell) { - var idx = cell.cellIndex; - //Check for customCellData callback - if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { - return this.customCellData.call(null, this, cell, idx); - } else { - return _dom2.default.getText(cell); - } - } - - /** - * Return the table data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getTableData', - value: function getTableData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - var rows = this.tbl.rows; - var tblData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - tblData.push([this.getHeadersRowIndex(), headers]); - } - for (var k = this.refRow; k < this.nbRows; k++) { - var rowData = [k, []]; - var cells = rows[k].cells; - for (var j = 0, len = cells.length; j < len; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var cellData = this.getCellData(cells[j]); - rowData[1].push(cellData); - } - tblData.push(rowData); - } - return tblData; - } - - /** - * Return the filtered data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredData', - value: function getFilteredData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (!this.validRowsIndex) { - return []; - } - var rows = this.tbl.rows, - filteredData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - filteredData.push([this.getHeadersRowIndex(), headers]); - } - - var validRows = this.getValidRows(true); - for (var i = 0; i < validRows.length; i++) { - var rData = [this.validRowsIndex[i], []], - cells = rows[this.validRowsIndex[i]].cells; - for (var k = 0; k < cells.length; k++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(k)) { - continue; - } - } - var cellData = this.getCellData(cells[k]); - rData[1].push(cellData); - } - filteredData.push(rData); - } - return filteredData; - } - - /** - * Return the filtered data for a given column index - * @param {Number} colIndex Colmun's index - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} Flat list of values ['val0','val1','val2'...] - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredDataCol', - value: function getFilteredDataCol(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (_types2.default.isUndef(colIndex)) { - return []; - } - var data = this.getFilteredData(), - colData = []; - if (includeHeaders) { - colData.push(this.getHeadersText()[colIndex]); - } - for (var i = 0, len = data.length; i < len; 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; - } - - /** - * Get the display value of a row - * @param {RowElement} DOM element of the row - * @return {String} Usually 'none' or '' - */ - - }, { - key: 'getRowDisplay', - value: function getRowDisplay(row) { - if (!_types2.default.isObj(row)) { - return null; - } - return row.style.display; - } - - /** - * Validate/invalidate row by setting the 'validRow' attribute on the row - * @param {Number} rowIndex Index of the row - * @param {Boolean} isValid - */ - - }, { - key: 'validateRow', - value: function validateRow(rowIndex, isValid) { - var row = this.tbl.rows[rowIndex]; - if (!row || typeof isValid !== 'boolean') { - return; - } - - // always visible rows are valid - if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { - isValid = true; - } - - var displayFlag = isValid ? '' : 'none', - validFlag = isValid ? 'true' : 'false'; - row.style.display = displayFlag; - - if (this.paging) { - row.setAttribute('validRow', validFlag); - } - - if (isValid) { - if (this.validRowsIndex.indexOf(rowIndex) === -1) { - this.validRowsIndex.push(rowIndex); - } - - if (this.onRowValidated) { - this.onRowValidated.call(null, this, rowIndex); - } - - this.emitter.emit('row-validated', this, rowIndex); - } - } - - /** - * Validate all filterable rows - */ - - }, { - key: 'validateAllRows', - value: function validateAllRows() { - if (!this._hasGrid) { - return; - } - this.validRowsIndex = []; - for (var k = this.refRow; k < this.nbFilterableRows; k++) { - this.validateRow(k, true); - } - } - - /** - * Set search value to a given filter - * @param {Number} index Column's index - * @param {String} searcharg Search term - */ - - }, { - key: 'setFilterValue', - value: function setFilterValue(index) { - var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; - - if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { - return; - } - var slc = this.getFilterElement(index), - fltColType = this.getFilterType(index); - - if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { - slc.value = searcharg; - } - //multiple selects - else if (fltColType === this.fltTypeMulti) { - var s = searcharg.split(' ' + this.orOperator + ' '); - // let ct = 0; //keywords counter - for (var j = 0, len = slc.options.length; j < len; j++) { - var option = slc.options[j]; - if (s === '' || s[0] === '') { - option.selected = false; - } - if (option.value === '') { - option.selected = false; - } - if (option.value !== '' && _array2.default.has(s, option.value, true)) { - option.selected = true; - } //if - } //for j - } - //checklist - else if (fltColType === this.fltTypeCheckList) { - searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); - var sarg = searcharg.split(' ' + this.orOperator + ' '); - var lisNb = _dom2.default.tag(slc, 'li').length; - - slc.setAttribute('value', ''); - slc.setAttribute('indexes', ''); - - for (var k = 0; k < lisNb; k++) { - var li = _dom2.default.tag(slc, 'li')[k], - lbl = _dom2.default.tag(li, 'label')[0], - chk = _dom2.default.tag(li, 'input')[0], - lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); - if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { - chk.checked = true; - this.Mod.checkList.setCheckListValues(chk); - } else { - chk.checked = false; - this.Mod.checkList.setCheckListValues(chk); - } - } - } - } - - /** - * Set them columns' widths as per configuration - * @param {Number} rowIndex Optional row index to apply the widths to - * @param {Element} tbl DOM element - */ - - }, { - key: 'setColWidths', - value: function setColWidths(rowIndex, tbl) { - if (!this.fltGrid || !this.hasColWidths) { - return; - } - tbl = tbl || this.tbl; - var rIndex = undefined; - if (rowIndex === undefined) { - rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; - } else { - rIndex = rowIndex; - } - - setWidths.call(this); - - function setWidths() { - /*jshint validthis:true */ - var nbCols = this.nbCells; - var colWidths = this.colWidths; - var colTags = _dom2.default.tag(tbl, 'col'); - var tblHasColTag = colTags.length > 0; - var frag = !tblHasColTag ? doc.createDocumentFragment() : null; - for (var k = 0; k < nbCols; k++) { - var col = undefined; - if (tblHasColTag) { - col = colTags[k]; - } else { - col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); - frag.appendChild(col); - } - col.style.width = colWidths[k]; - } - if (!tblHasColTag) { - tbl.insertBefore(frag, tbl.firstChild); - } - } - } - - /** - * Makes defined rows always visible - */ - - }, { - key: 'enforceVisibility', - value: function enforceVisibility() { - if (!this.hasVisibleRows) { - return; - } - for (var i = 0, len = this.visibleRows.length; i < len; i++) { - var row = this.visibleRows[i]; - //row index cannot be > nrows - if (row <= this.nbRows) { - this.validateRow(row, true); - } - } - } - - /** - * Clear all the filters' values - */ - - }, { - key: 'clearFilters', - value: function clearFilters() { - if (!this.fltGrid) { - return; - } - - this.emitter.emit('before-clearing-filters', this); - - if (this.onBeforeReset) { - this.onBeforeReset.call(null, this, this.getFiltersValue()); - } - for (var i = 0, len = this.fltIds.length; i < len; i++) { - this.setFilterValue(i, ''); - } - // if(this.linkedFilters){ - // this.linkFilters(); - // } - if (this.rememberPageLen) { - _cookie2.default.remove(this.pgLenCookie); - } - if (this.rememberPageNb) { - _cookie2.default.remove(this.pgNbCookie); - } - if (this.onAfterReset) { - this.onAfterReset.call(null, this); - } - - this.filter(); - - this.emitter.emit('after-clearing-filters', this); - } - - /** - * Clears filtered columns visual indicator (background color) - */ - - }, { - key: 'clearActiveColumns', - value: function clearActiveColumns() { - for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { - _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); - } - } - - /** - * Mark currently filtered column - * @param {Number} colIndex Column index - */ - - }, { - key: 'markActiveColumn', - value: function markActiveColumn(colIndex) { - var header = this.getHeaderElement(colIndex); - if (_dom2.default.hasClass(header, this.activeColumnsCssClass)) { - return; - } - if (this.onBeforeActiveColumn) { - this.onBeforeActiveColumn.call(null, this, colIndex); - } - _dom2.default.addClass(header, this.activeColumnsCssClass); - if (this.onAfterActiveColumn) { - this.onAfterActiveColumn.call(null, this, colIndex); - } - } - - /** - * Refresh the filters subject to linking ('select', 'multiple', - * 'checklist' type) - */ - - }, { - key: 'linkFilters', - value: function linkFilters() { - if (!this.linkedFilters || !this.activeFilterId) { - return; - } - 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); - - var activeFlt = this.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(this.prfxFlt)[1]; - var slcSelectedValue = undefined; - for (var i = 0, len = slcIndex.length; i < len; i++) { - var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); - slcSelectedValue = this.getFilterValue(slcIndex[i]); - - // Welcome to cyclomatic complexity hell :) - // TODO: simplify/refactor if statement - if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; - } else { - curSlc.innerHTML = ''; - } - - //1st option needs to be inserted - if (this.loadFltOnDemand) { - var opt0 = _dom2.default.createOpt(this.displayAllText, ''); - if (curSlc) { - curSlc.appendChild(opt0); - } - } - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.build(slcIndex[i]); - } else { - this.Mod.dropdown.build(slcIndex[i], true); - } - - this.setFilterValue(slcIndex[i], slcSelectedValue); - } - } // for i - } - - /** - * Re-generate the filters grid bar when previously removed - */ - - }, { - key: '_resetGrid', - value: function _resetGrid() { - if (this.isFirstLoad) { - return; - } - - var Mod = this.Mod; - var tbl = this.tbl; - var rows = tbl.rows; - var filtersRowIndex = this.filtersRowIndex; - var filtersRow = rows[filtersRowIndex]; - - // grid was removed, grid row element is stored in fltGridEl property - if (!this.gridLayout) { - // If table has a thead ensure the filters row is appended in the - // thead element - if (tbl.tHead) { - var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); - tbl.tHead.replaceChild(this.fltGridEl, tempRow); - } else { - filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); - } - - _dom2.default.addClass(tbl, this.prfxTf); - } - - // filters are appended in external placeholders elements - if (this.isExternalFlt) { - var externalFltTgtIds = this.externalFltTgtIds; - for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { - var extFlt = _dom2.default.id(externalFltTgtIds[ct]); - - if (!extFlt) { - continue; - } - - var externalFltEl = this.externalFltEls[ct]; - extFlt.appendChild(externalFltEl); - var colFltType = this.getFilterType(ct); - //IE special treatment for gridLayout, appended filters are - //empty - if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { - if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { - Mod.dropdown.build(ct); - } - if (colFltType === this.fltTypeCheckList) { - Mod.checkList.build(ct); - } - } - } - } - - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = rows.length; - - if (this.popupFilters) { - this.headersRow++; - Mod.popupFilter.reset(); - } - - this._hasGrid = true; - } - - /** - * Determines if passed filter column implements exact query match - * @param {Number} colIndex [description] - * @return {Boolean} [description] - */ - - }, { - key: 'isExactMatch', - value: function isExactMatch(colIndex) { - var fltType = this.getFilterType(colIndex); - return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; - } - - /** - * Check if passed script or stylesheet is already imported - * @param {String} filePath Ressource path - * @param {String} type Possible values: 'script' or 'link' - * @return {Boolean} - */ - - }, { - key: 'isImported', - value: function isImported(filePath, type) { - var imported = false, - importType = !type ? 'script' : type, - attr = importType == 'script' ? 'src' : 'href', - files = _dom2.default.tag(doc, importType); - for (var i = 0, len = files.length; i < len; i++) { - if (files[i][attr] === undefined) { - continue; - } - if (files[i][attr].match(filePath)) { - imported = true; - break; - } - } - return imported; - } - - /** - * Import script or stylesheet - * @param {String} fileId Ressource ID - * @param {String} filePath Ressource path - * @param {Function} callback Callback - * @param {String} type Possible values: 'script' or 'link' - */ - - }, { - key: 'import', - value: function _import(fileId, filePath, callback, type) { - var ftype = !type ? 'script' : type, - imported = this.isImported(filePath, ftype); - if (imported) { - return; - } - var o = this, - isLoaded = false, - file = undefined, - head = _dom2.default.tag(doc, 'head')[0]; - - if (_string2.default.lower(ftype) === 'link') { - file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); - } else { - file = _dom2.default.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: ' + filePath); - }; - head.appendChild(file); - } - - /** - * Check if table has filters grid - * @return {Boolean} - */ - - }, { - key: 'hasGrid', - value: function hasGrid() { - return this._hasGrid; - } - - /** - * Get list of filter IDs - * @return {[type]} [description] - */ - - }, { - key: 'getFiltersId', - value: function getFiltersId() { - return this.fltIds || []; - } - - /** - * Get filtered (valid) rows indexes - * @param {Boolean} reCalc Force calculation of filtered rows list - * @return {Array} List of row indexes - */ - - }, { - key: 'getValidRows', - value: function getValidRows(reCalc) { - 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; - } - - /** - * Get the index of the row containing the filters - * @return {Number} - */ - - }, { - key: 'getFiltersRowIndex', - value: function getFiltersRowIndex() { - return this.filtersRowIndex; - } - - /** - * Get the index of the headers row - * @return {Number} - */ - - }, { - key: 'getHeadersRowIndex', - value: function getHeadersRowIndex() { - return this.headersRow; - } - - /** - * Get the row index from where the filtering process start (1st filterable - * row) - * @return {Number} - */ - - }, { - key: 'getStartRowIndex', - value: function getStartRowIndex() { - return this.refRow; - } - - /** - * Get the index of the last row - * @return {Number} - */ - - }, { - key: 'getLastRowIndex', - value: function getLastRowIndex() { - if (!this._hasGrid) { - return; - } - return this.nbRows - 1; - } - - /** - * Get the header DOM element for a given column index - * @param {Number} colIndex Column index - * @return {Object} - */ - - }, { - key: 'getHeaderElement', - value: function getHeaderElement(colIndex) { - var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; - var tHead = _dom2.default.tag(table, 'thead'); - var headersRow = this.headersRow; - var header = undefined; - for (var i = 0; i < this.nbCells; i++) { - if (i !== colIndex) { - continue; - } - if (tHead.length === 0) { - header = table.rows[headersRow].cells[i]; - } - if (tHead.length === 1) { - header = tHead[0].rows[headersRow].cells[i]; - } - break; - } - return header; - } - - /** - * Return the list of headers' text - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} list of headers' text - */ - - }, { - key: 'getHeadersText', - value: function getHeadersText() { - var excludeHiddenCols = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var headers = []; - for (var j = 0; j < this.nbCells; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var header = this.getHeaderElement(j); - var headerText = _dom2.default.getText(header); - headers.push(headerText); - } - return headers; - } - - /** - * Return the filter type for a specified column - * @param {Number} colIndex Column's index - * @return {String} - */ - - }, { - key: 'getFilterType', - value: function getFilterType(colIndex) { - var colType = this.cfg['col_' + colIndex]; - return !colType ? this.fltTypeInp : _string2.default.lower(colType); - } - - /** - * Get the total number of filterable rows - * @return {Number} - */ - - }, { - key: 'getFilterableRowsNb', - value: function getFilterableRowsNb() { - return this.getRowsNb(false); - } - - /** - * Get the configuration object (literal object) - * @return {Object} - */ - - }, { - key: 'config', - value: function config() { - return this.cfg; - } - }]); - - return TableFilter; - })(); - -/***/ }, -/* 1 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * DOM event utilities - */ - - exports.default = { - 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; - } - }, - target: function target(evt) { - return evt && evt.target || window.event && window.event.srcElement; - }, - keyCode: function keyCode(evt) { - return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; - } - }; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * DOM utilities - */ - - exports.default = { - - /** - * Returns text + text of children of given node - * @param {NodeElement} node - * @return {String} - */ - - getText: function getText(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 - */ - create: function create(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]); - } - } - } - return el; - }, - - /** - * Removes passed node from DOM - * @param {DOMElement} node - * @return {DOMElement} old node reference - */ - remove: function remove(node) { - return node.parentNode.removeChild(node); - }, - - /** - * Returns a text node with given text - * @param {String} txt - * @return {Object} - */ - text: function text(txt) { - return document.createTextNode(txt); - }, - hasClass: function hasClass(ele, cls) { - if (!ele) { - return false; - } - - if (supportsClassList()) { - return ele.classList.contains(cls); - } - return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); - }, - addClass: function addClass(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; - } - }, - removeClass: function removeClass(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 - */ - createOpt: function createOpt(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 - */ - createCheckItem: function createCheckItem(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; - }, - id: function id(key) { - return document.getElementById(key); - }, - tag: function tag(o, tagname) { - return o.getElementsByTagName(tagname); - } - }; - - // HTML5 classList API - - function supportsClassList() { - return document.documentElement.classList; - } - -/***/ }, -/* 3 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * String utilities - */ - - exports.default = { - lower: function lower(text) { - return text.toLowerCase(); - }, - upper: function upper(text) { - return text.toUpperCase(); - }, - trim: function trim(text) { - if (text.trim) { - return text.trim(); - } - return text.replace(/^\s*|\s*$/g, ''); - }, - isEmpty: function isEmpty(text) { - return this.trim(text) === ''; - }, - rgxEsc: function rgxEsc(text) { - var chars = /[-\/\\^$*+?.()|[\]{}]/g; - var escMatch = '\\$&'; - return String(text).replace(chars, escMatch); - }, - matchCase: function matchCase(text, caseSensitive) { - if (!caseSensitive) { - return this.lower(text); - } - return text; - }, - - /** - * Checks if passed data contains the searched term - * @param {String} term Searched term - * @param {String} data Data string - * @param {Boolean} exactMatch Exact match - * @param {Boolean} caseSensitive Case sensitive - * @return {Boolean} - */ - contains: function contains(term, data) { - var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; - - // Improved by Cedric Wartel (cwl) automatic exact match for selects and - // special characters are now filtered - var regexp = undefined, - modifier = caseSensitive ? 'g' : 'gi'; - if (exactMatch) { - regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); - } else { - regexp = new RegExp(this.rgxEsc(term), modifier); - } - return regexp.test(data); - } - }; - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Cookie utilities - */ - - exports.default = { - write: function write(name, value, hours) { - var expire = ''; - if (hours) { - expire = new Date(new Date().getTime() + hours * 3600000); - expire = '; expires=' + expire.toGMTString(); - } - document.cookie = name + '=' + escape(value) + expire; - }, - read: function read(name) { - var cookieValue = '', - search = name + '='; - if (document.cookie.length > 0) { - var cookie = document.cookie, - offset = cookie.indexOf(search); - if (offset !== -1) { - offset += search.length; - var end = cookie.indexOf(';', offset); - if (end === -1) { - end = cookie.length; - } - cookieValue = unescape(cookie.substring(offset, end)); - } - } - return cookieValue; - }, - remove: function remove(name) { - this.write(name, '', -1); - }, - valueToArray: function valueToArray(name, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.read(name); - //creates an array with filters' values - var arr = val.split(separator); - return arr; - }, - getValueByIndex: function getValueByIndex(name, index, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.valueToArray(name, separator); - return val[index]; - } - }; - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * Types utilities - */ - - var UNDEFINED = void 0; - - exports.default = { - /** - * Check if argument is an object or a global object - * @param {String or Object} v - * @return {Boolean} - */ - - isObj: function isObj(v) { - var isO = false; - if (typeof v === 'string') { - if (window[v] && _typeof(window[v]) === 'object') { - isO = true; - } - } else { - if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { - isO = true; - } - } - return isO; - }, - - /** - * Check if argument is a function - * @param {Function} fn - * @return {Boolean} - */ - isFn: function isFn(fn) { - return fn && fn.constructor == Function; - }, - - /** - * Check if argument is an array - * @param {Array} obj - * @return {Boolean} - */ - isArray: function isArray(obj) { - return obj && obj.constructor == Array; - }, - - /** - * Determine if argument is undefined - * @param {Any} o - * @return {Boolean} - */ - isUndef: function isUndef(o) { - return o === UNDEFINED; - }, - - /** - * Determine if argument is null - * @param {Any} o - * @return {Boolean} - */ - isNull: function isNull(o) { - return o === null; - }, - - /** - * Determine if argument is empty (undefined, null or empty string) - * @param {Any} o - * @return {Boolean} - */ - isEmpty: function isEmpty(o) { - return this.isUndef(o) || this.isNull(o) || o.length === 0; - } - }; - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - has: function has(arr, val, caseSensitive) { - var sCase = caseSensitive === undefined ? false : caseSensitive; - for (var i = 0; i < arr.length; i++) { - if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { - return true; - } - } - return false; - } - }; /** - * Array utilities - */ - -/***/ }, -/* 7 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Date utilities - */ - - exports.default = { - 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 = undefined, - reg2 = undefined; - // 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 = undefined, - dd = undefined, - yy = undefined; - // 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(dateStr, formatStr) { - if (!formatStr) { - formatStr = 'DMY'; - } - if (!dateStr || dateStr === '') { - return new Date(1001, 0, 1); - } - var oDate = undefined; - var parts = undefined; - - switch (formatStr.toUpperCase()) { - case 'DDMMMYYYY': - parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); - oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); - break; - case 'DMY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'MDY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'YMD': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - default: - //in case format is not correct - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - } - return oDate; - } - }; - - function y2kDate(yr) { - if (yr === undefined) { - return 0; - } - if (yr.length > 2) { - return yr; - } - var y = undefined; - //>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; - } - - function mmm2mm(mmm) { - if (mmm === undefined) { - return 0; - } - var mondigit = undefined; - 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; - } - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - removeNbFormat: function removeNbFormat(data, format) { - if (!data) { - return; - } - if (!format) { - format = 'us'; - } - var n = data; - if (_string2.default.lower(format) === 'us') { - n = +n.replace(/[^\d\.-]/g, ''); - } else { - n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); - } - return n; - } - }; /** - * Misc helpers - */ - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - "use strict"; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /** - * Event emitter class - */ - - var Emitter = exports.Emitter = (function () { - function Emitter() { - _classCallCheck(this, Emitter); - - /** - * Events object - * @type {Object} - */ - this.events = {}; - } - - /** - * Subscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - _createClass(Emitter, [{ - key: "on", - value: function on(evts, fn) { - var _this = this; - - evts.forEach(function (evt) { - _this.events[evt] = _this.events[evt] || []; - _this.events[evt].push(fn); - }); - } - - /** - * Unsubscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - }, { - key: "off", - value: function off(evts, fn) { - var _this2 = this; - - evts.forEach(function (evt) { - if (evt in _this2.events) { - _this2.events[evt].splice(_this2.events[evt].indexOf(fn), 1); - } - }); - } - - /** - * Emit an event - * @param {String} evt Event name followed by any other argument passed to - * the invoked function - */ - - }, { - key: "emit", - value: function emit(evt /*, args...*/) { - if (evt in this.events) { - for (var i = 0; i < this.events[evt].length; i++) { - this.events[evt][i].apply(this, [].slice.call(arguments, 1)); - } - } - } - }]); - - return Emitter; - })(); - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Store = undefined; - - var _cookie = __webpack_require__(4); - - var _cookie2 = _interopRequireDefault(_cookie); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Store = exports.Store = (function () { - - /** - * Store, persistence manager - * @param {Object} tf TableFilter instance - * - * TODO: use localStorage and fallback to cookie persistence - */ - - function Store(tf) { - _classCallCheck(this, Store); - - var f = tf.config(); - - this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(Store, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on(['after-filtering'], function () { - return _this.saveFilterValues(_this.tf.fltsValuesCookie); - }); - } - - /** - * Store filters' values in cookie - * @param {String} cookie name - */ - - }, { - key: 'saveFilterValues', - value: function saveFilterValues(name) { - var tf = this.tf; - var fltValues = []; - - if (!tf.rememberGridValues) { - return; - } - - //store filters' values - for (var i = 0; i < tf.fltIds.length; i++) { - var value = tf.getFilterValue(i); - if (value === '') { - value = ' '; - } - fltValues.push(value); - } - //adds array size - fltValues.push(tf.fltIds.length); - - //writes cookie - _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); - } - - /** - * Retrieve filters' values from cookie - * @param {String} cookie name - * @return {Array} - */ - - }, { - key: 'getFilterValues', - value: function getFilterValues(name) { - var flts = _cookie2.default.read(name); - var rgx = new RegExp(this.tf.separator, 'g'); - // filters' values array - return flts.split(rgx); - } - - /** - * Store page number in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageNb', - value: function savePageNb(name) { - if (!this.tf.rememberPageNb) { - return; - } - _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); - } - - /** - * Retrieve page number from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageNb', - value: function getPageNb(name) { - return _cookie2.default.read(name); - } - - /** - * Store page length in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageLength', - value: function savePageLength(name) { - if (!this.tf.rememberPageLen) { - return; - } - _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); - } - - /** - * Retrieve page length from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageLength', - value: function getPageLength(name) { - return _cookie2.default.read(name); - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off(['after-filtering'], function () { - return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); - }); - } - }]); - - return Store; - })(); - -/***/ }, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.GridLayout = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var GridLayout = exports.GridLayout = (function (_Feature) { - _inherits(GridLayout, _Feature); - - /** - * Grid layout, table with fixed headers - * @param {Object} tf TableFilter instance - */ - - function GridLayout(tf) { - _classCallCheck(this, GridLayout); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); - - var f = _this.config; - - //defines grid width - _this.gridWidth = f.grid_width || null; - //defines grid height - _this.gridHeight = f.grid_height || null; - //defines css class for main container - _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; - //defines css class for div containing table - _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; - //defines css class for div containing headers' table - _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; - //defines css class for div containing rows counter, paging etc. - _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; - //defines which row contains column headers - _this.gridHeadRowIndex = f.grid_headers_row_index || 0; - //array of headers row indexes to be placed in header table - _this.gridHeadRows = f.grid_headers_rows || [0]; - //generate filters in table headers - _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; - //default col width - _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; - - _this.gridColElms = []; - - //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_'; - - _this.sourceTblHtml = tf.tbl.outerHTML; - return _this; - } - - /** - * Generates a grid with fixed headers - */ - - _createClass(GridLayout, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - var f = this.config; - var tbl = tf.tbl; - - if (this.initialized) { - return; - } - - // Override reference rows indexes - tf.refRow = _types2.default.isNull(tf.startRow) ? 0 : tf.startRow; - tf.headersRow = 0; - tf.filtersRowIndex = 1; - - tf.isExternalFlt = true; - - // default width of 100px if column widths not set - if (!tf.hasColWidths) { - tf.colWidths = []; - for (var k = 0; k < tf.nbCells; k++) { - var colW = undefined, - cell = tbl.rows[this.gridHeadRowIndex].cells[k]; - if (cell.width !== '') { - colW = cell.width; - } else if (cell.style.width !== '') { - colW = parseInt(cell.style.width, 10); - } else { - colW = this.gridDefaultColWidth; - } - tf.colWidths[k] = colW; - } - tf.hasColWidths = true; - } - tf.setColWidths(this.gridHeadRowIndex); - - var tblW = undefined; //initial table width - if (tbl.width !== '') { - tblW = tbl.width; - } else if (tbl.style.width !== '') { - tblW = parseInt(tbl.style.width, 10); - } else { - tblW = tbl.clientWidth; - } - - //Main container: it will contain all the elements - this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); - this.tblMainCont.className = this.gridMainContCssClass; - if (this.gridWidth) { - this.tblMainCont.style.width = this.gridWidth; - } - tbl.parentNode.insertBefore(this.tblMainCont, tbl); - - //Table container: div wrapping content table - this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); - this.tblCont.className = this.gridContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.tblCont.style.width = '100%'; - } else { - this.tblCont.style.width = this.gridWidth; - } - } - if (this.gridHeight) { - this.tblCont.style.height = this.gridHeight; - } - tbl.parentNode.insertBefore(this.tblCont, tbl); - var t = _dom2.default.remove(tbl); - this.tblCont.appendChild(t); - - //In case table width is expressed in % - if (tbl.style.width === '') { - tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; - } - - var d = _dom2.default.remove(this.tblCont); - this.tblMainCont.appendChild(d); - - //Headers table container: div wrapping headers table - this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); - this.headTblCont.className = this.gridHeadContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.headTblCont.style.width = '100%'; - } else { - this.headTblCont.style.width = this.gridWidth; - } - } - - //Headers table - this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); - var tH = _dom2.default.create('tHead'); - - //1st row should be headers row, ids are added if not set - //Those ids are used by the sort feature - var hRow = tbl.rows[this.gridHeadRowIndex]; - var sortTriggers = []; - for (var n = 0; n < tf.nbCells; n++) { - var c = hRow.cells[n]; - var thId = c.getAttribute('id'); - if (!thId || thId === '') { - thId = this.prfxGridTh + n + '_' + tf.id; - c.setAttribute('id', thId); - } - sortTriggers.push(thId); - } - - //Filters row is created - var filtersRow = _dom2.default.create('tr'); - if (this.gridEnableFilters && tf.fltGrid) { - tf.externalFltTgtIds = []; - for (var j = 0; j < tf.nbCells; j++) { - var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; - var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); - filtersRow.appendChild(cl); - tf.externalFltTgtIds[j] = fltTdId; - } - } - //Headers row are moved from content table to headers table - for (var i = 0; i < this.gridHeadRows.length; i++) { - var headRow = tbl.rows[this.gridHeadRows[0]]; - tH.appendChild(headRow); - } - this.headTbl.appendChild(tH); - if (tf.filtersRowIndex === 0) { - tH.insertBefore(filtersRow, hRow); - } else { - tH.appendChild(filtersRow); - } - - this.headTblCont.appendChild(this.headTbl); - this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); - - //THead needs to be removed in content table for sort feature - var thead = _dom2.default.tag(tbl, 'thead'); - if (thead.length > 0) { - tbl.removeChild(thead[0]); - } - - //Headers table style - this.headTbl.style.tableLayout = 'fixed'; - tbl.style.tableLayout = 'fixed'; - this.headTbl.cellPadding = tbl.cellPadding; - this.headTbl.cellSpacing = tbl.cellSpacing; - // this.headTbl.style.width = tbl.style.width; - - //content table without headers needs col widths to be reset - tf.setColWidths(0, this.headTbl); - - //Headers container width - // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; - - tbl.style.width = ''; - // - this.headTbl.style.width = tbl.clientWidth + 'px'; - // - - //scroll synchronisation - _event2.default.add(this.tblCont, 'scroll', function (evt) { - var elm = _event2.default.target(evt); - var scrollLeft = elm.scrollLeft; - _this2.headTblCont.scrollLeft = scrollLeft; - //New pointerX calc taking into account scrollLeft - // if(!o.isPointerXOverwritten){ - // try{ - // o.Evt.pointerX = function(evt){ - // let e = evt || global.event; - // let bdScrollLeft = tf_StandardBody().scrollLeft + - // scrollLeft; - // return (e.pageX + scrollLeft) || - // (e.clientX + bdScrollLeft); - // }; - // o.isPointerXOverwritten = true; - // } catch(err) { - // o.isPointerXOverwritten = false; - // } - // } - }); - - //Configure sort extension if any - var sort = (f.extensions || []).filter(function (itm) { - return itm.name === 'sort'; - }); - if (sort.length === 1) { - sort[0].async_sort = true; - sort[0].trigger_ids = sortTriggers; - } - - //Cols generation for all browsers excepted IE<=7 - this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; - - //Col elements are enough to keep column widths after sorting and - //filtering - var createColTags = function createColTags() { - for (var k = tf.nbCells - 1; k >= 0; k--) { - var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); - tbl.insertBefore(col, tbl.firstChild); - col.style.width = tf.colWidths[k]; - this.gridColElms[k] = col; - } - this.tblHasColTag = true; - }; - - if (!this.tblHasColTag) { - createColTags.call(this); - } else { - var cols = _dom2.default.tag(tbl, 'col'); - for (var ii = 0; ii < tf.nbCells; ii++) { - cols[ii].setAttribute('id', tf.id + '_col_' + ii); - cols[ii].style.width = tf.colWidths[ii]; - this.gridColElms.push(cols[ii]); - } - } - - var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; - f.on_after_col_resized = function (o, colIndex) { - if (!colIndex) { - return; - } - var w = o.crWColsRow.cells[colIndex].style.width; - var col = o.gridColElms[colIndex]; - col.style.width = w; - - var thCW = o.crWColsRow.cells[colIndex].clientWidth; - var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; - - if (thCW != tdCW) { - o.headTbl.style.width = tbl.clientWidth + 'px'; - } - - if (afterColResizedFn) { - afterColResizedFn.call(null, o, colIndex); - } - }; - - if (tf.popupFilters) { - filtersRow.style.display = 'none'; - } - - if (tbl.clientWidth !== this.headTbl.clientWidth) { - tbl.style.width = this.headTbl.clientWidth + 'px'; - } - - this.initialized = true; - } - - /** - * Removes the grid layout - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - var tbl = tf.tbl; - - if (!this.initialized) { - return; - } - var t = _dom2.default.remove(tbl); - this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); - _dom2.default.remove(this.tblMainCont); - - this.tblMainCont = null; - this.headTblCont = null; - this.headTbl = null; - this.tblCont = null; - - tbl.outerHTML = this.sourceTblHtml; - //needed to keep reference of table element for future usage - this.tf.tbl = t; - - this.initialized = false; - } - }]); - - return GridLayout; - })(_feature.Feature); - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var NOTIMPLEMENTED = 'Not implemented.'; - - var Feature = exports.Feature = (function () { - function Feature(tf, feature) { - _classCallCheck(this, Feature); - - this.tf = tf; - this.feature = feature; - this.enabled = tf[feature]; - this.config = tf.config(); - this.emitter = tf.emitter; - this.initialized = false; - } - - _createClass(Feature, [{ - key: 'init', - value: function init() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - } - }, { - key: 'destroy', - value: function destroy() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'enable', - value: function enable() { - this.enabled = true; - } - }, { - key: 'disable', - value: function disable() { - this.enabled = false; - } - }, { - key: 'isEnabled', - value: function isEnabled() { - return this.enabled; - } - }]); - - return Feature; - })(); - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Loader = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var Loader = exports.Loader = (function (_Feature) { - _inherits(Loader, _Feature); - - /** - * Loading message/spinner - * @param {Object} tf TableFilter instance - */ - - function Loader(tf) { - _classCallCheck(this, Loader); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); - - var f = _this.config; - - //id of container element - _this.loaderTgtId = f.loader_target_id || null; - //div containing loader - _this.loaderDiv = null; - //defines loader text - _this.loaderText = f.loader_text || 'Loading...'; - //defines loader innerHtml - _this.loaderHtml = f.loader_html || null; - //defines css class for loader div - _this.loaderCssClass = f.loader_css_class || 'loader'; - //delay for hiding loader - _this.loaderCloseDelay = 250; - //callback function before loader is displayed - _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; - //callback function after loader is closed - _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; - //loader div - _this.prfxLoader = 'load_'; - return _this; - } - - _createClass(Loader, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); - containerDiv.className = this.loaderCssClass; - - var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); - if (!this.loaderTgtId) { - targetEl.insertBefore(containerDiv, tf.tbl); - } else { - targetEl.appendChild(containerDiv); - } - this.loaderDiv = containerDiv; - if (!this.loaderHtml) { - this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); - } else { - this.loaderDiv.innerHTML = this.loaderHtml; - } - - this.show('none'); - - // Subscribe to events - emitter.on(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this2.show(''); - }); - emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.show('none'); - }); - - this.initialized = true; - } - }, { - key: 'show', - value: function show(p) { - var _this3 = this; - - if (!this.isEnabled() /*|| this.loaderDiv.style.display === p*/) { - return; - } - - var displayLoader = function displayLoader() { - if (!_this3.loaderDiv) { - return; - } - if (_this3.onShowLoader && p !== 'none') { - _this3.onShowLoader.call(null, _this3); - } - _this3.loaderDiv.style.display = p; - if (_this3.onHideLoader && p === 'none') { - _this3.onHideLoader.call(null, _this3); - } - }; - - var t = p === 'none' ? this.loaderCloseDelay : 1; - global.setTimeout(displayLoader, t); - } - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - _dom2.default.remove(this.loaderDiv); - this.loaderDiv = null; - - // Unsubscribe to events - emitter.off(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this4.show(''); - }); - emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.show('none'); - }); - - this.initialized = false; - } - }]); - - return Loader; - })(_feature.Feature); - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.HighlightKeyword = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var HighlightKeyword = exports.HighlightKeyword = (function () { - - /** - * HighlightKeyword, highlight matched keyword - * @param {Object} tf TableFilter instance - */ - - function HighlightKeyword(tf) { - _classCallCheck(this, HighlightKeyword); - - var f = tf.config(); - //defines css class for highlighting - this.highlightCssClass = f.highlight_css_class || 'keyword'; - this.highlightedNodes = []; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(HighlightKeyword, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on(['before-filtering'], function () { - return _this.unhighlightAll(); - }); - } - - /** - * highlight occurences of searched term in passed node - * @param {Node} node - * @param {String} word Searched term - * @param {String} cssClass Css class name - */ - - }, { - key: 'highlight', - value: function highlight(node, word, cssClass) { - // Iterate into this nodes childNodes - if (node.hasChildNodes) { - var children = node.childNodes; - for (var i = 0; i < children.length; i++) { - this.highlight(children[i], word, cssClass); - } - } - - if (node.nodeType === 3) { - var tempNodeVal = _string2.default.lower(node.nodeValue); - var tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) != -1) { - var pn = node.parentNode; - if (pn && pn.className != cssClass) { - // word not highlighted yet - var nv = node.nodeValue, - ni = tempNodeVal.indexOf(tempWordVal), - - // Create a load of replacement nodes - before = _dom2.default.text(nv.substr(0, ni)), - docWordVal = nv.substr(ni, word.length), - after = _dom2.default.text(nv.substr(ni + word.length)), - hiwordtext = _dom2.default.text(docWordVal), - hiword = _dom2.default.create('span'); - hiword.className = cssClass; - hiword.appendChild(hiwordtext); - pn.insertBefore(before, node); - pn.insertBefore(hiword, node); - pn.insertBefore(after, node); - pn.removeChild(node); - this.highlightedNodes.push(hiword.firstChild); - } - } - } - } - - /** - * Removes highlight to nodes matching passed string - * @param {String} word - * @param {String} cssClass Css class to remove - */ - - }, { - key: 'unhighlight', - value: function unhighlight(word, cssClass) { - var arrRemove = []; - var highlightedNodes = this.highlightedNodes; - for (var i = 0; i < highlightedNodes.length; i++) { - var n = highlightedNodes[i]; - if (!n) { - continue; - } - var tempNodeVal = _string2.default.lower(n.nodeValue), - tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) !== -1) { - var pn = n.parentNode; - if (pn && pn.className === cssClass) { - var prevSib = pn.previousSibling, - nextSib = pn.nextSibling; - if (!prevSib || !nextSib) { - continue; - } - nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; - prevSib.nodeValue = ''; - n.nodeValue = ''; - arrRemove.push(i); - } - } - } - for (var k = 0; k < arrRemove.length; k++) { - highlightedNodes.splice(arrRemove[k], 1); - } - } - - /** - * Clear all occurrences of highlighted nodes - */ - - }, { - key: 'unhighlightAll', - value: function unhighlightAll() { - if (!this.tf.highlightKeywords || !this.tf.searchArgs) { - return; - } - for (var y = 0; y < this.tf.searchArgs.length; y++) { - this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); - } - this.highlightedNodes = []; - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off(['before-filtering'], function () { - return _this2.unhighlightAll(); - }); - } - }]); - - return HighlightKeyword; - })(); - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.PopupFilter = undefined; - - var _feature = __webpack_require__(12); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var PopupFilter = exports.PopupFilter = (function (_Feature) { - _inherits(PopupFilter, _Feature); - - /** - * Pop-up filter component - * @param {Object} tf TableFilter instance - */ - - function PopupFilter(tf) { - _classCallCheck(this, PopupFilter); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); - - var f = _this.config; - - // Enable external filters - tf.isExternalFlt = true; - tf.externalFltTgtIds = []; - - //filter icon path - _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; - //active filter icon path - _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; - _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; - //defines css class for popup div containing filter - _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; - //callback function before popup filtes is opened - _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; - //callback function after popup filtes is opened - _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; - //callback function before popup filtes is closed - _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; - //callback function after popup filtes is closed - _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; - - //stores filters spans - _this.popUpFltSpans = []; - //stores filters icons - _this.popUpFltImgs = []; - //stores filters containers - _this.popUpFltElms = _this.popUpFltElmCache || []; - _this.popUpFltAdjustToContainer = true; - - //id prefix for pop-up filter span - _this.prfxPopUpSpan = 'popUpSpan_'; - //id prefix for pop-up div containing filter - _this.prfxPopUpDiv = 'popUpDiv_'; - return _this; - } - - _createClass(PopupFilter, [{ - key: 'onClick', - value: function onClick(e) { - var evt = e || global.event, - elm = evt.target.parentNode, - colIndex = parseInt(elm.getAttribute('ci'), 10); - - this.closeAll(colIndex); - this.toggle(colIndex); - - if (this.popUpFltAdjustToContainer) { - var popUpDiv = this.popUpFltElms[colIndex], - header = this.tf.getHeaderElement(colIndex), - headerWidth = header.clientWidth * 0.95; - popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; - } - _event2.default.cancel(evt); - _event2.default.stop(evt); - } - - /** - * Initialize DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - // Override headers row index if no grouped headers - if (tf.headersRow <= 1) { - tf.headersRow = 0; - } - - for (var i = 0; i < tf.nbCells; i++) { - if (tf.getFilterType(i) === tf.fltTypeNone) { - continue; - } - var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); - popUpSpan.innerHTML = this.popUpImgFltHtml; - var header = tf.getHeaderElement(i); - header.appendChild(popUpSpan); - _event2.default.add(popUpSpan, 'click', function (evt) { - _this2.onClick(evt); - }); - this.popUpFltSpans[i] = popUpSpan; - this.popUpFltImgs[i] = popUpSpan.firstChild; - } - - // subscribe to events - this.emitter.on(['before-filtering'], function () { - return _this2.buildIcons(); - }); - this.emitter.on(['after-filtering'], function () { - return _this2.closeAll(); - }); - this.emitter.on(['cell-processed'], function (tf, cellIndex) { - return _this2.buildIcon(cellIndex, true); - }); - this.emitter.on(['filters-row-inserted'], function () { - return _this2.tf.headersRow++; - }); - this.emitter.on(['before-filter-init'], function (tf, colIndex) { - return _this2.build(colIndex); - }); - - this.initialized = true; - } - - /** - * Reset previously destroyed feature - */ - - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - this.buildAll(); - } - - /** - * Build all pop-up filters elements - */ - - }, { - key: 'buildAll', - value: function buildAll() { - for (var i = 0; i < this.popUpFltElmCache.length; i++) { - this.build(i, this.popUpFltElmCache[i]); - } - } - - /** - * Build a specified pop-up filter elements - * @param {Number} colIndex Column index - * @param {Object} div Optional container DOM element - */ - - }, { - key: 'build', - value: function build(colIndex, div) { - var tf = this.tf; - var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; - popUpDiv.className = this.popUpDivCssClass; - tf.externalFltTgtIds.push(popUpDiv.id); - var header = tf.getHeaderElement(colIndex); - header.insertBefore(popUpDiv, header.firstChild); - _event2.default.add(popUpDiv, 'click', function (evt) { - _event2.default.stop(evt); - }); - this.popUpFltElms[colIndex] = popUpDiv; - } - - /** - * Toogle visibility of specified filter - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggle', - value: function toggle(colIndex) { - var tf = this.tf, - popUpFltElm = this.popUpFltElms[colIndex]; - - if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { - if (this.onBeforePopUpOpen) { - this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'block'; - if (tf.getFilterType(colIndex) === tf.fltTypeInp) { - var flt = tf.getFilterElement(colIndex); - if (flt) { - flt.focus(); - } - } - if (this.onAfterPopUpOpen) { - this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } else { - if (this.onBeforePopUpClose) { - this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'none'; - if (this.onAfterPopUpClose) { - this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } - } - - /** - * Close all filters excepted for the specified one if any - * @param {Number} exceptIdx Column index of the filter to not close - */ - - }, { - key: 'closeAll', - value: function closeAll(exceptIdx) { - for (var i = 0; i < this.popUpFltElms.length; i++) { - if (i === exceptIdx) { - continue; - } - var popUpFltElm = this.popUpFltElms[i]; - if (popUpFltElm) { - popUpFltElm.style.display = 'none'; - } - } - } - - /** - * Build all the icons representing the pop-up filters - */ - - }, { - key: 'buildIcons', - value: function buildIcons() { - for (var i = 0; i < this.popUpFltImgs.length; i++) { - this.buildIcon(i, false); - } - } - - /** - * Apply specified icon state - * @param {Number} colIndex Column index - * @param {Boolean} active Apply active state - */ - - }, { - key: 'buildIcon', - value: function buildIcon(colIndex, active) { - if (this.popUpFltImgs[colIndex]) { - this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; - } - } - - /** - * Remove pop-up filters - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - this.popUpFltElmCache = []; - for (var i = 0; i < this.popUpFltElms.length; i++) { - var popUpFltElm = this.popUpFltElms[i], - popUpFltSpan = this.popUpFltSpans[i], - popUpFltImg = this.popUpFltImgs[i]; - if (popUpFltElm) { - _dom2.default.remove(popUpFltElm); - this.popUpFltElmCache[i] = popUpFltElm; - } - popUpFltElm = null; - if (popUpFltSpan) { - _dom2.default.remove(popUpFltSpan); - } - popUpFltSpan = null; - if (popUpFltImg) { - _dom2.default.remove(popUpFltImg); - } - popUpFltImg = null; - } - this.popUpFltElms = []; - this.popUpFltSpans = []; - this.popUpFltImgs = []; - - // unsubscribe to events - this.emitter.off(['before-filtering'], function () { - return _this3.buildIcons(); - }); - this.emitter.off(['after-filtering'], function () { - return _this3.closeAll(); - }); - this.emitter.off(['cell-processed'], function (tf, cellIndex) { - return _this3.buildIcon(cellIndex, true); - }); - this.emitter.off(['filters-row-inserted'], function () { - return _this3.tf.headersRow++; - }); - this.emitter.off(['before-filter-init'], function (tf, colIndex) { - return _this3.build(colIndex); - }); - - this.initialized = false; - } - }]); - - return PopupFilter; - })(_feature.Feature); - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Dropdown = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Dropdown = exports.Dropdown = (function (_Feature) { - _inherits(Dropdown, _Feature); - - /** - * Dropdown UI component - * @param {Object} tf TableFilter instance - */ - - function Dropdown(tf) { - _classCallCheck(this, Dropdown); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Dropdown).call(this, tf, 'dropdown')); - - var f = tf.config(); - - _this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; - //defines empty option text - _this.nonEmptyText = f.non_empty_text || '(Non empty)'; - //sets select filling method: 'innerHTML' or 'createElement' - _this.slcFillingMethod = f.slc_filling_method || 'createElement'; - //IE only, tooltip text appearing on select before it is populated - _this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; - //tooltip text appearing on multiple select - _this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; - - _this.isCustom = null; - _this.opts = null; - _this.optsTxt = null; - _this.slcInnerHtml = null; - return _this; - } - - /** - * Initialize drop-down filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - _createClass(Dropdown, [{ - key: 'init', - value: function init(colIndex, isExternal, container) { - var tf = this.tf; - var col = tf.getFilterType(colIndex); - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var slc = _dom2.default.create(tf.fltTypeSlc, ['id', tf.prfxFlt + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - - if (col === tf.fltTypeMulti) { - slc.multiple = tf.fltTypeMulti; - slc.title = this.multipleSlcTooltip; - } - slc.className = _string2.default.lower(col) === tf.fltTypeSlc ? tf.fltCssClass : tf.fltMultiCssClass; - - //filter is appended in container element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(slc); - tf.externalFltEls.push(slc); - } else { - container.appendChild(slc); - } - - tf.fltIds.push( /*this.prfxFlt+i+'_'+this.id*/slc.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - //1st option is created here since build isn't invoked - var opt0 = _dom2.default.createOpt(tf.displayAllText, ''); - slc.appendChild(opt0); - } - - _event2.default.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); - _event2.default.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); - _event2.default.add(slc, 'focus', tf.Evt.onSlcFocus.bind(tf)); - - this.initialized = true; - } - - /** - * Build drop-down filter UI - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Boolean} isExternal Render in external container - * @param {String} extSlcId External container id - */ - - }, { - key: 'build', - value: function build(colIndex) { - var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - this.slcInnerHtml = ''; - - var slcId = tf.fltIds[colIndex]; - if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { - return; - } - var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), - rows = tf.tbl.rows, - matchCase = tf.matchCase; - - //custom select test - this.isCustom = tf.isCustomOptions(colIndex); - - //custom selects text - var activeFlt = undefined; - if (isLinked && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - /*** remember grid values ***/ - // let fltsValues = [], fltArr = []; - // if(tf.rememberGridValues){ - // fltsValues = tf.feature('store').getFilterValues( - // tf.fltsValuesCookie); - // if(fltsValues && !Str.isEmpty(fltsValues.toString())){ - // if(this.isCustom){ - // fltArr.push(fltsValues[colIndex]); - // } else { - // fltArr = fltsValues[colIndex].split(' '+tf.orOperator+' '); - // } - // } - // } - - var excludedOpts = null, - filteredDataCol = null; - if (isLinked && tf.disableExcludedOptions) { - excludedOpts = []; - filteredDataCol = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cell = rows[k].cells, - nchilds = cell.length; - - // checks if row has exact cell # - if (nchilds !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - // WTF: cyclomatic complexity hell - if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cell[j]), - - //Vary Peter's patch - cell_string = _string2.default.matchCase(cell_data, matchCase); - - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, matchCase)) { - this.opts.push(cell_data); - } - - if (isLinked && tf.disableExcludedOptions) { - var filteredCol = filteredDataCol[j]; - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { - excludedOpts.push(cell_data); - } - } - } //if colIndex==j - } //for j - } //for k - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (excludedOpts) { - excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - } - } - - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (excludedOpts) { - excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (excludedOpts) { - excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - //populates drop-down - this.addOptions(colIndex, slc, isLinked, excludedOpts /*, fltsValues, fltArr*/); - - this.emitter.emit('after-populating-filter', tf, colIndex, slc); - } - - /** - * Add drop-down options - * @param {Number} colIndex Column index - * @param {Object} slc Select Dom element - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Array} excludedOpts Array of excluded options - * @param {Array} fltsValues Collection of persisted filter values - * @param {Array} fltArr Collection of persisted filter values - */ - - }, { - key: 'addOptions', - value: function addOptions(colIndex, slc, isLinked, excludedOpts /*, fltsValues, fltArr*/) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod), - slcValue = slc.value; - - slc.innerHTML = ''; - slc = this.addFirstOption(slc); - - for (var y = 0; y < this.opts.length; y++) { - if (this.opts[y] === '') { - continue; - } - var val = this.opts[y]; //option value - var lbl = this.isCustom ? this.optsTxt[y] : val; //option text - var isDisabled = false; - if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - isDisabled = true; - } - - if (fillMethod === 'innerhtml') { - var slcAttr = ''; - if (tf.loadFltOnDemand && slcValue === this.opts[y]) { - slcAttr = 'selected="selected"'; - } - this.slcInnerHtml += ''; - } else { - var opt = undefined; - //fill select on demand - if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { - opt = _dom2.default.createOpt(lbl, val, true); - } else { - opt = _dom2.default.createOpt(lbl, val, false); - // if(tf.getFilterType(colIndex) !== tf.fltTypeMulti){ - // opt = Dom.createOpt( - // lbl, - // val, - // (fltsValues[colIndex]!==' ' && - // val===fltsValues[colIndex]) ? true : false - // ); - // } else { - // opt = Dom.createOpt( - // lbl, - // val, - // (Arr.has(fltArr, - // Str.matchCase(this.opts[y], tf.matchCase), - // tf.matchCase) || - // fltArr.toString().indexOf(val)!== -1) ? - // true : false - // ); - // } - } - if (isDisabled) { - opt.disabled = true; - } - slc.appendChild(opt); - } - } // for y - - if (fillMethod === 'innerhtml') { - slc.innerHTML += this.slcInnerHtml; - } - slc.setAttribute('filled', '1'); - } - - /** - * Add drop-down header option - * @param {Object} slc Select DOM element - */ - - }, { - key: 'addFirstOption', - value: function addFirstOption(slc) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod); - - if (fillMethod === 'innerhtml') { - this.slcInnerHtml += ''; - } else { - var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); - if (!this.enableSlcResetFilter) { - opt0.style.display = 'none'; - } - slc.appendChild(opt0); - if (tf.enableEmptyOption) { - var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); - slc.appendChild(opt1); - } - if (tf.enableNonEmptyOption) { - var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); - slc.appendChild(opt2); - } - } - return slc; - } - }, { - key: 'destroy', - value: function destroy() {} - }]); - - return Dropdown; - })(_feature.Feature); - -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - ignoreCase: function ignoreCase(a, b) { - var x = _string2.default.lower(a); - var y = _string2.default.lower(b); - return x < y ? -1 : x > y ? 1 : 0; - } - }; - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.CheckList = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var CheckList = exports.CheckList = (function (_Feature) { - _inherits(CheckList, _Feature); - - /** - * Checklist UI component - * @param {Object} tf TableFilter instance - */ - - function CheckList(tf) { - _classCallCheck(this, CheckList); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CheckList).call(this, tf, 'checkList')); - - var f = tf.config(); - - _this.checkListDiv = []; //checklist container div - //defines css class for div containing checklist filter - _this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; - //defines css class for checklist filters - _this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; - //defines css class for checklist item (li) - _this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; - //defines css class for selected checklist item (li) - _this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; - //Load on demand text - _this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; - //defines css class for checklist filters - _this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; - _this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; - //checklist filter container div - _this.prfxCheckListDiv = 'chkdiv_'; - - _this.isCustom = null; - _this.opts = null; - _this.optsTxt = null; - _this.excludedOpts = null; - return _this; - } - - // TODO: move event here - - _createClass(CheckList, [{ - key: 'onChange', - value: function onChange(evt) { - var elm = evt.target; - this.tf.activeFilterId = elm.getAttribute('id'); - this.tf.activeFlt = _dom2.default.id(this.tf.activeFilterId); - this.tf.Evt.onSlcChange.call(this.tf, evt); - } - }, { - key: 'optionClick', - value: function optionClick(evt) { - this.setCheckListValues(evt.target); - this.onChange(evt); - } - }, { - key: 'onCheckListClick', - value: function onCheckListClick(evt) { - var _this2 = this; - - var elm = _event2.default.target(evt); - if (this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - var div = this.checkListDiv[ct]; - this.build(ct); - _event2.default.remove(div, 'click', function (evt) { - return _this2.onCheckListClick(evt); - }); - } - } - - /** - * Initialize checklist filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - }, { - key: 'init', - value: function init(colIndex, isExternal, container) { - var _this3 = this; - - var tf = this.tf; - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var divCont = _dom2.default.create('div', ['id', this.prfxCheckListDiv + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - divCont.className = this.checkListDivCssClass; - - //filter is appended in desired element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(divCont); - tf.externalFltEls.push(divCont); - } else { - container.appendChild(divCont); - } - - this.checkListDiv[colIndex] = divCont; - tf.fltIds.push(tf.prfxFlt + colIndex + '_' + tf.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - _event2.default.add(divCont, 'click', function (evt) { - return _this3.onCheckListClick(evt); - }); - divCont.appendChild(_dom2.default.text(this.activateCheckListTxt)); - } - - this.initialized = true; - } - - /** - * Build checklist UI - * @param {Number} colIndex Column index - * @param {Boolean} isExternal Render in external container - * @param {String} extFltId External container id - */ - - }, { - key: 'build', - value: function build(colIndex) { - var _this4 = this; - - var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - - var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; - if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { - return; - } - - var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); - var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); - ul.className = this.checkListCssClass; - _event2.default.add(ul, 'change', function (evt) { - _this4.onChange(evt); - }); - - var rows = tf.tbl.rows; - this.isCustom = tf.isCustomOptions(colIndex); - - var activeFlt = undefined; - if (tf.linkedFilters && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - var filteredDataCol = []; - if (tf.linkedFilters && tf.disableExcludedOptions) { - this.excludedOpts = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cells = rows[k].cells; - var ncells = cells.length; - - // checks if row has exact cell # - if (ncells !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < ncells; j++) { - // WTF: cyclomatic complexity hell :) - if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cells[j]); - //Vary Peter's patch - var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { - this.opts.push(cell_data); - } - var filteredCol = filteredDataCol[j]; - if (tf.linkedFilters && tf.disableExcludedOptions) { - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { - this.excludedOpts.push(cell_data); - } - } - } - } - } - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!tf.matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (this.excludedOpts) { - this.excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - } - } - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - this.addChecks(colIndex, ul, tf.separator); - - if (tf.loadFltOnDemand) { - flt.innerHTML = ''; - } - flt.appendChild(ul); - flt.setAttribute('filled', '1'); - - this.emitter.emit('after-populating-filter', tf, colIndex, flt); - } - - /** - * Add checklist options - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addChecks', - value: function addChecks(colIndex, ul) { - var _this5 = this; - - var tf = this.tf; - var chkCt = this.addTChecks(colIndex, ul); - // let fltArr = []; //remember grid values - // let store = tf.feature('store'); - // let tmpVal = store ? - // store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null; - // if(tmpVal && Str.trim(tmpVal).length > 0){ - // if(tf.hasCustomSlcOptions && - // tf.customSlcOptions.cols.indexOf(colIndex) != -1){ - // fltArr.push(tmpVal); - // } else { - // fltArr = tmpVal.split(' '+tf.orOperator+' '); - // } - // } - - for (var y = 0; y < this.opts.length; y++) { - var val = this.opts[y]; //item value - var lbl = this.isCustom ? this.optsTxt[y] : val; //item text - var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); - li.className = this.checkListItemCssClass; - if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - _dom2.default.addClass(li, this.checkListItemDisabledCssClass); - li.check.disabled = true; - li.disabled = true; - } else { - _event2.default.add(li.check, 'click', function (evt) { - _this5.optionClick(evt); - }); - } - ul.appendChild(li); - - if (val === '') { - //item is hidden - li.style.display = 'none'; - } - - /*** remember grid values ***/ - // if(tf.rememberGridValues){ - // if((tf.hasCustomSlcOptions && - // tf.customSlcOptions.cols.indexOf(colIndex) != -1 && - // fltArr.toString().indexOf(val) != -1) || - // Arr.has(fltArr, - // Str.matchCase(val, tf.matchCase), tf.matchCase)){ - // li.check.checked = true; - // this.setCheckListValues(li.check); - // } - // } - } - } - - /** - * Add checklist header option - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addTChecks', - value: function addTChecks(colIndex, ul) { - var _this6 = this; - - var tf = this.tf; - var chkCt = 1; - var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); - li0.className = this.checkListItemCssClass; - ul.appendChild(li0); - - _event2.default.add(li0.check, 'click', function (evt) { - _this6.optionClick(evt); - }); - - if (!this.enableCheckListResetFilter) { - li0.style.display = 'none'; - } - - if (tf.enableEmptyOption) { - var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); - li1.className = this.checkListItemCssClass; - ul.appendChild(li1); - _event2.default.add(li1.check, 'click', function (evt) { - _this6.optionClick(evt); - }); - chkCt++; - } - - if (tf.enableNonEmptyOption) { - var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); - li2.className = this.checkListItemCssClass; - ul.appendChild(li2); - _event2.default.add(li2.check, 'click', function (evt) { - _this6.optionClick(evt); - }); - chkCt++; - } - return chkCt; - } - - /** - * Store checked options in DOM element attribute - * @param {Object} o checklist option DOM element - */ - - }, { - key: 'setCheckListValues', - value: function setCheckListValues(o) { - if (!o) { - return; - } - var tf = this.tf; - var chkValue = o.value; //checked item value - var chkIndex = parseInt(o.id.split('_')[2], 10); - var filterTag = 'ul', - itemTag = 'li'; - var n = o; - - //ul tag search - while (_string2.default.lower(n.nodeName) !== filterTag) { - n = n.parentNode; - } - - var li = n.childNodes[chkIndex]; - var colIndex = n.getAttribute('colIndex'); - var fltValue = n.getAttribute('value'); //filter value (ul tag) - var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) - - if (o.checked) { - //show all item - if (chkValue === '') { - if (fltIndexes && fltIndexes !== '') { - //items indexes - var indSplit = fltIndexes.split(tf.separator); - //checked items loop - for (var u = 0; u < indSplit.length; u++) { - //checked item - var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); - if (cChk) { - cChk.checked = false; - _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); - } - } - } - n.setAttribute('value', ''); - n.setAttribute('indexes', ''); - } else { - fltValue = fltValue ? fltValue : ''; - chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); - chkIndex = fltIndexes + chkIndex + tf.separator; - n.setAttribute('value', chkValue); - n.setAttribute('indexes', chkIndex); - //1st option unchecked - if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { - _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; - } - } - - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); - _dom2.default.addClass(li, this.checkListSlcItemCssClass); - } - } else { - //removes values and indexes - if (chkValue !== '') { - var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); - fltValue = fltValue.replace(replaceValue, ''); - n.setAttribute('value', _string2.default.trim(fltValue)); - - var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); - fltIndexes = fltIndexes.replace(replaceIndex, ''); - n.setAttribute('indexes', fltIndexes); - } - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(li, this.checkListSlcItemCssClass); - } - } - } - }, { - key: 'destroy', - value: function destroy() {} - }]); - - return CheckList; - })(_feature.Feature); - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.RowsCounter = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var RowsCounter = exports.RowsCounter = (function (_Feature) { - _inherits(RowsCounter, _Feature); - - /** - * Rows counter - * @param {Object} tf TableFilter instance - */ - - function RowsCounter(tf) { - _classCallCheck(this, RowsCounter); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); - - var f = _this.config; - - //id of custom container element - _this.rowsCounterTgtId = f.rows_counter_target_id || null; - //element containing tot nb rows - _this.rowsCounterDiv = null; - //element containing tot nb rows label - _this.rowsCounterSpan = null; - //defines rows counter text - _this.rowsCounterText = f.rows_counter_text || 'Rows: '; - _this.fromToTextSeparator = f.from_to_text_separator || '-'; - _this.overText = f.over_text || ' / '; - //defines css class rows counter - _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; - //rows counter div - _this.prfxCounter = 'counter_'; - //nb displayed rows label - _this.prfxTotRows = 'totrows_span_'; - //label preceding nb rows label - _this.prfxTotRowsTxt = 'totRowsTextSpan_'; - //callback raised before counter is refreshed - _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; - //callback raised after counter is refreshed - _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; - return _this; - } - - _createClass(RowsCounter, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - //rows counter container - var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); - countDiv.className = this.totRowsCssClass; - //rows counter label - var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); - var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); - countText.appendChild(_dom2.default.text(this.rowsCounterText)); - - // counter is added to defined element - if (!this.rowsCounterTgtId) { - tf.setToolbar(); - } - var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); - - //default container: 'lDiv' - if (!this.rowsCounterTgtId) { - countDiv.appendChild(countText); - countDiv.appendChild(countSpan); - targetEl.appendChild(countDiv); - } else { - //custom container, no need to append statusDiv - targetEl.appendChild(countText); - targetEl.appendChild(countSpan); - } - this.rowsCounterDiv = countDiv; - this.rowsCounterSpan = countSpan; - - // subscribe to events - this.emitter.on(['after-filtering', 'grouped-by-page'], function () { - return _this2.refresh(tf.nbVisibleRows); - }); - this.emitter.on(['rows-changed'], function () { - return _this2.refresh(); - }); - - this.initialized = true; - this.refresh(); - } - }, { - key: 'refresh', - value: function refresh(p) { - if (!this.initialized || !this.isEnabled()) { - return; - } - - var tf = this.tf; - - if (this.onBeforeRefreshCounter) { - this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); - } - - var totTxt; - if (!tf.paging) { - if (p && p !== '') { - totTxt = p; - } else { - totTxt = tf.nbFilterableRows - tf.nbHiddenRows; - } - } else { - var paging = tf.feature('paging'); - if (paging) { - //paging start row - var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); - var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; - totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; - } - } - - this.rowsCounterSpan.innerHTML = totTxt; - if (this.onAfterRefreshCounter) { - this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - if (!this.rowsCounterTgtId && this.rowsCounterDiv) { - _dom2.default.remove(this.rowsCounterDiv); - } else { - _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; - } - this.rowsCounterSpan = null; - this.rowsCounterDiv = null; - - // unsubscribe to events - this.emitter.off(['after-filtering', 'grouped-by-page'], function () { - return _this3.refresh(tf.nbVisibleRows); - }); - this.emitter.off(['rows-changed'], function () { - return _this3.refresh(); - }); - - this.initialized = false; - } - }]); - - return RowsCounter; - })(_feature.Feature); - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.StatusBar = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var StatusBar = exports.StatusBar = (function (_Feature) { - _inherits(StatusBar, _Feature); - - /** - * Status bar UI component - * @param {Object} tf TableFilter instance - */ - - function StatusBar(tf) { - _classCallCheck(this, StatusBar); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); - - var f = _this.config; - - //id of custom container element - _this.statusBarTgtId = f.status_bar_target_id || null; - //element containing status bar label - _this.statusBarDiv = null; - //status bar - _this.statusBarSpan = null; - //status bar label - _this.statusBarSpanText = null; - //defines status bar text - _this.statusBarText = f.status_bar_text || ''; - //defines css class status bar - _this.statusBarCssClass = f.status_bar_css_class || 'status'; - //delay for status bar clearing - _this.statusBarCloseDelay = 250; - - //calls function before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //calls function after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - - //status messages - _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 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)...'; - - // status bar div - _this.prfxStatus = 'status_'; - // status bar label - _this.prfxStatusSpan = 'statusSpan_'; - // text preceding status bar label - _this.prfxStatusTxt = 'statusText_'; - return _this; - } - - _createClass(StatusBar, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - //status bar container - var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); - statusDiv.className = this.statusBarCssClass; - - //status bar label - var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); - //preceding text - var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); - statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); - - // target element container - if (!this.statusBarTgtId) { - tf.setToolbar(); - } - var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); - - //default container: 'lDiv' - if (!this.statusBarTgtId) { - statusDiv.appendChild(statusSpanText); - statusDiv.appendChild(statusSpan); - targetEl.appendChild(statusDiv); - } else { - // custom container, no need to append statusDiv - targetEl.appendChild(statusSpanText); - targetEl.appendChild(statusSpan); - } - - this.statusBarDiv = statusDiv; - this.statusBarSpan = statusSpan; - this.statusBarSpanText = statusSpanText; - - // Subscribe to events - emitter.on(['before-filtering'], function () { - return _this2.message(_this2.msgFilter); - }); - emitter.on(['before-populating-filter'], function () { - return _this2.message(_this2.msgPopulate); - }); - emitter.on(['before-changing-page'], function () { - return _this2.message(_this2.msgChangePage); - }); - emitter.on(['before-clearing-filters'], function () { - return _this2.message(_this2.msgClear); - }); - emitter.on(['before-changing-results-per-page'], function () { - return _this2.message(_this2.msgChangeResults); - }); - emitter.on(['before-reset-page'], function () { - return _this2.message(_this2.msgResetPage); - }); - emitter.on(['before-reset-page-length'], function () { - return _this2.message(_this2.msgResetPageLength); - }); - emitter.on(['before-loading-extensions'], function () { - return _this2.message(_this2.msgLoadExtensions); - }); - emitter.on(['before-loading-themes'], function () { - return _this2.message(_this2.msgLoadThemes); - }); - - emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.message(''); - }); - - this.initialized = true; - } - }, { - key: 'message', - value: function message() { - var _this3 = this; - - var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; - - if (!this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, t); - } - - var d = t === '' ? this.statusBarCloseDelay : 1; - global.setTimeout(function () { - if (!_this3.initialized) { - return; - } - _this3.statusBarSpan.innerHTML = t; - if (_this3.onAfterShowMsg) { - _this3.onAfterShowMsg.call(null, _this3.tf, t); - } - }, d); - } - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - this.statusBarDiv.innerHTML = ''; - _dom2.default.remove(this.statusBarDiv); - this.statusBarSpan = null; - this.statusBarSpanText = null; - this.statusBarDiv = null; - - // Unsubscribe to events - emitter.off(['before-filtering'], function () { - return _this4.message(_this4.msgFilter); - }); - emitter.off(['before-populating-filter'], function () { - return _this4.message(_this4.msgPopulate); - }); - emitter.off(['before-changing-page'], function () { - return _this4.message(_this4.msgChangePage); - }); - emitter.off(['before-clearing-filters'], function () { - return _this4.message(_this4.msgClear); - }); - emitter.off(['before-changing-results-per-page'], function () { - return _this4.message(_this4.msgChangeResults); - }); - emitter.off(['before-reset-page'], function () { - return _this4.message(_this4.msgResetPage); - }); - emitter.off(['before-reset-page-length'], function () { - return _this4.message(_this4.msgResetPageLength); - }); - emitter.off(['before-loading-extensions'], function () { - return _this4.message(_this4.msgLoadExtensions); - }); - emitter.off(['before-loading-themes'], function () { - return _this4.message(_this4.msgLoadThemes); - }); - - emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.message(''); - }); - - this.initialized = false; - } - }]); - - return StatusBar; - })(_feature.Feature); - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Paging = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Paging = exports.Paging = (function (_Feature) { - _inherits(Paging, _Feature); - - /** - * Pagination component - * @param {Object} tf TableFilter instance - */ - - function Paging(tf) { - _classCallCheck(this, Paging); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); - - var f = _this.config; - - //css class for paging buttons (previous,next,etc.) - _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; - //stores paging select element - _this.pagingSlc = null; - //results per page select element - _this.resultsPerPageSlc = null; - //id of container element - _this.pagingTgtId = f.paging_target_id || null; - //defines table paging length - _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; - //id of container element - _this.resultsPerPageTgtId = f.results_per_page_target_id || null; - //css class for paging select element - _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; - //css class for paging input element - _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; - //stores results per page text and values - _this.resultsPerPage = f.results_per_page || null; - //enables/disables results per page drop-down - _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); - //defines css class for results per page select - _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; - //css class for label preceding results per page select - _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; - //1st row index of current page - _this.startPagingRow = 0; - //total nb of pages - _this.nbPages = 0; - //current page nb - _this.currentPageNb = 1; - //defines next page button text - _this.btnNextPageText = f.btn_next_page_text || '>'; - //defines previous page button text - _this.btnPrevPageText = f.btn_prev_page_text || '<'; - //defines last page button text - _this.btnLastPageText = f.btn_last_page_text || '>|'; - //defines first page button text - _this.btnFirstPageText = f.btn_first_page_text || '|<'; - //defines next page button html - _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); - //defines last page button html - _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); - //defines text preceeding page selector drop-down - _this.pageText = f.page_text || ' Page '; - //defines text after page selector drop-down - _this.ofText = f.of_text || ' of '; - //css class for span containing tot nb of pages - _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; - //enables/disables paging buttons - _this.hasPagingBtns = f.paging_btns === false ? false : true; - //defines previous page button html - _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; - //calls function before page is changed - _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; - //calls function before page is changed - _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; - - //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_'; - - var start_row = tf.refRow; - var nrows = tf.nbRows; - //calculates page nb - _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); - - //Paging elements events - var o = _this; - // Paging DOM events - _this.evt = { - slcIndex: function slcIndex() { - return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; - }, - nbOpts: function nbOpts() { - return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; - }, - next: function next() { - var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; - o.changePage(nextIndex); - }, - prev: function prev() { - var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); - o.changePage(prevIndex); - }, - last: function last() { - o.changePage(o.evt.nbOpts()); - }, - first: function first() { - o.changePage(0); - }, - _detectKey: function _detectKey(e) { - var key = _event2.default.keyCode(e); - if (key === 13) { - if (tf.sorted) { - tf.filter(); - o.changePage(o.evt.slcIndex()); - } else { - o.changePage(); - } - this.blur(); - } - }, - - slcPagesChange: null, - nextEvt: null, - prevEvt: null, - lastEvt: null, - firstEvt: null - }; - return _this; - } - - /** - * Initialize DOM elements - */ - - _createClass(Paging, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var slcPages; - var tf = this.tf; - var evt = this.evt; - - if (this.initialized) { - return; - } - - // Check resultsPerPage is in expected format and initialise the - // results per page component - if (this.hasResultsPerPage) { - if (this.resultsPerPage.length < 2) { - this.hasResultsPerPage = false; - } else { - this.pagingLength = this.resultsPerPage[1][0]; - this.setResultsPerPage(); - } - } - - evt.slcPagesChange = function (event) { - var slc = event.target; - _this2.changePage(slc.selectedIndex); - }; - - // Paging drop-down list selector - if (this.pageSelectorType === tf.fltTypeSlc) { - slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); - slcPages.className = this.pgSlcCssClass; - _event2.default.add(slcPages, 'change', evt.slcPagesChange); - } - - // Paging input selector - if (this.pageSelectorType === tf.fltTypeInp) { - slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); - slcPages.className = this.pgInpCssClass; - _event2.default.add(slcPages, 'keypress', evt._detectKey); - } - - // btns containers - var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); - var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); - var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); - var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); - - if (this.hasPagingBtns) { - // Next button - if (!this.btnNextPageHtml) { - var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); - btn_next.className = this.btnPageCssClass; - _event2.default.add(btn_next, 'click', evt.next); - btnNextSpan.appendChild(btn_next); - } else { - btnNextSpan.innerHTML = this.btnNextPageHtml; - _event2.default.add(btnNextSpan, 'click', evt.next); - } - // Previous button - if (!this.btnPrevPageHtml) { - var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); - btn_prev.className = this.btnPageCssClass; - _event2.default.add(btn_prev, 'click', evt.prev); - btnPrevSpan.appendChild(btn_prev); - } else { - btnPrevSpan.innerHTML = this.btnPrevPageHtml; - _event2.default.add(btnPrevSpan, 'click', evt.prev); - } - // Last button - if (!this.btnLastPageHtml) { - var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); - btn_last.className = this.btnPageCssClass; - _event2.default.add(btn_last, 'click', evt.last); - btnLastSpan.appendChild(btn_last); - } else { - btnLastSpan.innerHTML = this.btnLastPageHtml; - _event2.default.add(btnLastSpan, 'click', evt.last); - } - // First button - if (!this.btnFirstPageHtml) { - var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); - btn_first.className = this.btnPageCssClass; - _event2.default.add(btn_first, 'click', evt.first); - btnFirstSpan.appendChild(btn_first); - } else { - btnFirstSpan.innerHTML = this.btnFirstPageHtml; - _event2.default.add(btnFirstSpan, 'click', evt.first); - } - } - - // paging elements (buttons+drop-down list) are added to defined element - if (!this.pagingTgtId) { - tf.setToolbar(); - } - var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - targetEl.appendChild(btnFirstSpan); - targetEl.appendChild(btnPrevSpan); - - var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); - pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); - pgBeforeSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgBeforeSpan); - targetEl.appendChild(slcPages); - var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); - pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); - pgAfterSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgAfterSpan); - var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); - pgspan.className = this.nbPgSpanCssClass; - pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); - targetEl.appendChild(pgspan); - targetEl.appendChild(btnNextSpan); - targetEl.appendChild(btnLastSpan); - this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); - - if (!tf.rememberGridValues) { - this.setPagingInfo(); - } - if (!tf.fltGrid) { - tf.validateAllRows(); - this.setPagingInfo(tf.validRowsIndex); - } - - this.emitter.on(['after-filtering'], function () { - return _this2.resetPagingInfo(); - }); - this.emitter.on(['initialized'], function () { - return _this2.resetValues(); - }); - - this.initialized = true; - } - - /** - * Reset paging when filters are already instantiated - * @param {Boolean} filterTable Execute filtering once paging instanciated - */ - - }, { - key: 'reset', - value: function reset() { - var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var tf = this.tf; - if (!tf.hasGrid() || this.isEnabled()) { - return; - } - this.enable(); - this.init(); - tf.resetValues(); - if (filterTable) { - tf.filter(); - } - } - - /** - * Reset paging info from scratch after a filtering process - */ - - }, { - key: 'resetPagingInfo', - value: function resetPagingInfo() { - this.startPagingRow = 0; - this.currentPageNb = 1; - this.setPagingInfo(this.tf.validRowsIndex); - } - - /** - * Calculate number of pages based on valid rows - * Refresh paging select according to number of pages - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'setPagingInfo', - value: function setPagingInfo(validRows) { - var tf = this.tf; - var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - //store valid rows indexes - tf.validRowsIndex = validRows || tf.getValidRows(true); - - //calculate nb of pages - this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); - //refresh page nb span - pgspan.innerHTML = this.nbPages; - //select clearing shortcut - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.innerHTML = ''; - } - - if (this.nbPages > 0) { - mdiv.style.visibility = 'visible'; - if (this.pageSelectorType === tf.fltTypeSlc) { - for (var z = 0; z < this.nbPages; z++) { - var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); - this.pagingSlc.options[z] = opt; - } - } else { - //input type - this.pagingSlc.value = this.currentPageNb; - } - } else { - /*** if no results paging select and buttons are hidden ***/ - mdiv.style.visibility = 'hidden'; - } - this.groupByPage(tf.validRowsIndex); - } - - /** - * Group table rows by page and display valid rows - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'groupByPage', - value: function groupByPage(validRows) { - var tf = this.tf; - var rows = tf.tbl.rows; - var startPagingRow = parseInt(this.startPagingRow, 10); - var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); - - //store valid rows indexes - if (validRows) { - tf.validRowsIndex = validRows; - } - - //this loop shows valid rows of current page - for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { - var validRowIdx = tf.validRowsIndex[h]; - var r = rows[validRowIdx]; - var isRowValid = r.getAttribute('validRow'); - var rowDisplayed = false; - - if (h >= startPagingRow && h < endPagingRow) { - if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { - r.style.display = ''; - rowDisplayed = true; - } - } else { - r.style.display = 'none'; - } - this.emitter.emit('row-paged', tf, validRowIdx, h, rowDisplayed); - } - - tf.nbVisibleRows = tf.validRowsIndex.length; - - // broadcast grouping by page - this.emitter.emit('grouped-by-page', tf, this); - } - - /** - * Return the current page number - * @return {Number} Page number - */ - - }, { - key: 'getPage', - value: function getPage() { - return this.currentPageNb; - } - - /** - * Show page based on passed param value (string or number): - * @param {String} or {Number} cmd possible string values: 'next', - * 'previous', 'last', 'first' or page number as per param - */ - - }, { - key: 'setPage', - value: function setPage(cmd) { - var tf = this.tf; - if (!tf.hasGrid() || !this.isEnabled()) { - return; - } - var btnEvt = this.evt, - cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); - if (cmdtype === 'string') { - switch (_string2.default.lower(cmd)) { - case 'next': - btnEvt.next(); - break; - case 'previous': - btnEvt.prev(); - break; - case 'last': - btnEvt.last(); - break; - case 'first': - btnEvt.first(); - break; - default: - btnEvt.next(); - break; - } - } else if (cmdtype === 'number') { - this.changePage(cmd - 1); - } - } - - /** - * Generates UI elements for the number of results per page drop-down - */ - - }, { - key: 'setResultsPerPage', - value: function setResultsPerPage() { - var _this3 = this; - - var tf = this.tf; - var evt = this.evt; - - if (!tf.hasGrid() && !tf.isFirstLoad) { - return; - } - if (this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - - evt.slcResultsChange = function (ev) { - _this3.changeResultsPerPage(); - ev.target.blur(); - }; - - var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); - slcR.className = this.resultsSlcCssClass; - var slcRText = this.resultsPerPage[0], - slcROpts = this.resultsPerPage[1]; - var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); - slcRSpan.className = this.resultsSpanCssClass; - - // results per page select is added to external element - if (!this.resultsPerPageTgtId) { - tf.setToolbar(); - } - var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); - slcRSpan.appendChild(_dom2.default.text(slcRText)); - - var help = tf.feature('help'); - if (help && help.btn) { - help.btn.parentNode.insertBefore(slcRSpan, help.btn); - help.btn.parentNode.insertBefore(slcR, help.btn); - } else { - targetEl.appendChild(slcRSpan); - targetEl.appendChild(slcR); - } - - for (var r = 0; r < slcROpts.length; r++) { - var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); - slcR.options[r] = currOpt; - } - _event2.default.add(slcR, 'change', evt.slcResultsChange); - this.resultsPerPageSlc = slcR; - } - - /** - * Remove number of results per page UI elements - */ - - }, { - key: 'removeResultsPerPage', - value: function removeResultsPerPage() { - var tf = this.tf; - if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - var slcR = this.resultsPerPageSlc, - slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); - if (slcR) { - _dom2.default.remove(slcR); - } - if (slcRSpan) { - _dom2.default.remove(slcRSpan); - } - this.resultsPerPageSlc = null; - } - - /** - * Change the page according to passed index - * @param {Number} index Index of the page (0-n) - */ - - }, { - key: 'changePage', - value: function changePage(index) { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-changing-page', tf, index); - - if (index === null) { - index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; - } - if (index >= 0 && index <= this.nbPages - 1) { - if (this.onBeforeChangePage) { - this.onBeforeChangePage.call(null, this, index); - } - this.currentPageNb = parseInt(index, 10) + 1; - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.options[index].selected = true; - } else { - this.pagingSlc.value = this.currentPageNb; - } - - if (tf.rememberPageNb) { - tf.feature('store').savePageNb(tf.pgNbCookie); - } - this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; - - this.groupByPage(); - - if (this.onAfterChangePage) { - this.onAfterChangePage.call(null, this, index); - } - } - - this.emitter.emit('after-changing-page', tf, index); - } - - /** - * Change rows according to page results drop-down - * TODO: accept a parameter setting the results per page length - */ - - }, { - key: 'changeResultsPerPage', - value: function changeResultsPerPage() { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-changing-results-per-page', tf); - - var slcR = this.resultsPerPageSlc; - var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); - this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); - this.startPagingRow = this.pagingLength * slcPagesSelIndex; - - if (!isNaN(this.pagingLength)) { - if (this.startPagingRow >= tf.nbFilterableRows) { - this.startPagingRow = tf.nbFilterableRows - this.pagingLength; - } - this.setPagingInfo(); - - if (this.pageSelectorType === tf.fltTypeSlc) { - var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; - this.pagingSlc.options[slcIndex].selected = true; - } - if (tf.rememberPageLen) { - tf.feature('store').savePageLength(tf.pgLenCookie); - } - } - - this.emitter.emit('after-changing-results-per-page', tf); - } - - /** - * Re-set persisted pagination info - */ - - }, { - key: 'resetValues', - value: function resetValues() { - var tf = this.tf; - if (tf.rememberPageLen) { - this.resetPageLength(tf.pgLenCookie); - } - if (tf.rememberPageNb) { - this.resetPage(tf.pgNbCookie); - } - } - - /** - * Re-set page nb at page re-load - */ - - }, { - key: 'resetPage', - value: function resetPage(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page', tf); - var pgnb = tf.feature('store').getPageNb(name); - if (pgnb !== '') { - this.changePage(pgnb - 1); - } - this.emitter.emit('after-reset-page', tf, pgnb); - } - - /** - * Re-set page length value at page re-load - */ - - }, { - key: 'resetPageLength', - value: function resetPageLength(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page-length', tf); - var pglenIndex = tf.feature('store').getPageLength(name); - - if (pglenIndex !== '') { - this.resultsPerPageSlc.options[pglenIndex].selected = true; - this.changeResultsPerPage(); - } - this.emitter.emit('after-reset-page-length', tf, pglenIndex); - } - - /** - * Remove paging feature - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - var tf = this.tf; - - if (!this.initialized) { - return; - } - // btns containers - var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); - var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); - var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); - var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); - //span containing 'Page' text - var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); - //span containing 'of' text - var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); - //span containing nb of pages - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - var evt = this.evt; - - if (this.pagingSlc) { - if (this.pageSelectorType === tf.fltTypeSlc) { - _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); - } else if (this.pageSelectorType === tf.fltTypeInp) { - _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); - } - _dom2.default.remove(this.pagingSlc); - } - - if (btnNextSpan) { - _event2.default.remove(btnNextSpan, 'click', evt.next); - _dom2.default.remove(btnNextSpan); - } - - if (btnPrevSpan) { - _event2.default.remove(btnPrevSpan, 'click', evt.prev); - _dom2.default.remove(btnPrevSpan); - } - - if (btnLastSpan) { - _event2.default.remove(btnLastSpan, 'click', evt.last); - _dom2.default.remove(btnLastSpan); - } - - if (btnFirstSpan) { - _event2.default.remove(btnFirstSpan, 'click', evt.first); - _dom2.default.remove(btnFirstSpan); - } - - if (pgBeforeSpan) { - _dom2.default.remove(pgBeforeSpan); - } - - if (pgAfterSpan) { - _dom2.default.remove(pgAfterSpan); - } - - if (pgspan) { - _dom2.default.remove(pgspan); - } - - if (this.hasResultsPerPage) { - this.removeResultsPerPage(); - } - - this.emitter.off(['after-filtering'], function () { - return _this4.resetPagingInfo(); - }); - this.emitter.off(['initialized'], function () { - return _this4.resetValues(); - }); - - this.pagingSlc = null; - this.nbPages = 0; - this.disable(); - this.initialized = false; - } - }]); - - return Paging; - })(_feature.Feature); - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.ClearButton = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var ClearButton = exports.ClearButton = (function (_Feature) { - _inherits(ClearButton, _Feature); - - /** - * Clear button component - * @param {Object} tf TableFilter instance - */ - - function ClearButton(tf) { - _classCallCheck(this, ClearButton); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); - - var f = _this.config; - - //id of container element - _this.btnResetTgtId = f.btn_reset_target_id || null; - //reset button element - _this.btnResetEl = null; - //defines reset text - _this.btnResetText = f.btn_reset_text || 'Reset'; - //defines reset button tooltip - _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; - //defines reset button innerHtml - _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); - //span containing reset button - _this.prfxResetSpan = 'resetspan_'; - return _this; - } - - _createClass(ClearButton, [{ - key: 'onClick', - value: function onClick() { - if (!this.isEnabled()) { - return; - } - this.tf.clearFilters(); - } - - /** - * Build DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - - if (this.initialized) { - return; - } - - var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); - - // reset button is added to defined element - if (!this.btnResetTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); - targetEl.appendChild(resetspan); - - if (!this.btnResetHtml) { - var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); - fltreset.className = tf.btnResetCssClass; - fltreset.appendChild(_dom2.default.text(this.btnResetText)); - resetspan.appendChild(fltreset); - _event2.default.add(fltreset, 'click', function () { - _this2.onClick(); - }); - } else { - resetspan.innerHTML = this.btnResetHtml; - var resetEl = resetspan.firstChild; - _event2.default.add(resetEl, 'click', function () { - _this2.onClick(); - }); - } - this.btnResetEl = resetspan.firstChild; - - this.initialized = true; - } - - /** - * Remove clear button UI - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - - if (!this.initialized) { - return; - } - - var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); - if (resetspan) { - _dom2.default.remove(resetspan); - } - this.btnResetEl = null; - this.initialized = false; - } - }]); - - return ClearButton; - })(_feature.Feature); - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Help = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; - var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; - - var Help = exports.Help = (function (_Feature) { - _inherits(Help, _Feature); - - /** - * Help UI component - * @param {Object} tf TableFilter instance - */ - - function Help(tf) { - _classCallCheck(this, Help); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); - - var f = _this.config; - - //id of custom container element for instructions - _this.tgtId = f.help_instructions_target_id || null; - //id of custom container element for instructions - _this.contTgtId = f.help_instructions_container_target_id || null; - //defines help text - _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; - //defines help innerHtml - _this.instrHtml = f.help_instructions_html || null; - //defines reset button text - _this.btnText = f.help_instructions_btn_text || '?'; - //defines reset button innerHtml - _this.btnHtml = f.help_instructions_btn_html || null; - //defines css class for help button - _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; - //defines css class for help container - _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; - //help button element - _this.btn = null; - //help content div - _this.cont = null; - _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; - - //id prefix for help elements - _this.prfxHelpSpan = 'helpSpan_'; - //id prefix for help elements - _this.prfxHelpDiv = 'helpDiv_'; - return _this; - } - - _createClass(Help, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); - var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); - - //help button is added to defined element - if (!this.tgtId) { - tf.setToolbar(); - } - var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); - targetEl.appendChild(helpspan); - - var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); - - if (!this.btnHtml) { - divContainer.appendChild(helpdiv); - var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); - helplink.className = this.btnCssClass; - helplink.appendChild(_dom2.default.text(this.btnText)); - helpspan.appendChild(helplink); - _event2.default.add(helplink, 'click', function () { - _this2.toggle(); - }); - } else { - helpspan.innerHTML = this.btnHtml; - var helpEl = helpspan.firstChild; - _event2.default.add(helpEl, 'click', function () { - _this2.toggle(); - }); - divContainer.appendChild(helpdiv); - } - - if (!this.instrHtml) { - helpdiv.innerHTML = this.instrText; - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } else { - if (this.contTgtId) { - divContainer.appendChild(helpdiv); - } - helpdiv.innerHTML = this.instrHtml; - if (!this.contTgtId) { - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } - } - helpdiv.innerHTML += this.defaultHtml; - _event2.default.add(helpdiv, 'click', function () { - _this2.toggle(); - }); - - this.cont = helpdiv; - this.btn = helpspan; - this.initialized = true; - } - - /** - * Toggle help pop-up - */ - - }, { - key: 'toggle', - value: function toggle() { - // check only if explicitily set to false as in this case undefined - // signifies the help feature is enabled by default - if (this.enabled === false) { - return; - } - var divDisplay = this.cont.style.display; - if (divDisplay === '' || divDisplay === 'none') { - this.cont.style.display = 'inline'; - } else { - this.cont.style.display = 'none'; - } - } - - /** - * Remove help UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - _dom2.default.remove(this.btn); - this.btn = null; - if (!this.cont) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - this.initialized = false; - } - }]); - - return Help; - })(_feature.Feature); - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AlternateRows = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var AlternateRows = exports.AlternateRows = (function (_Feature) { - _inherits(AlternateRows, _Feature); - - /** - * Alternating rows color - * @param {Object} tf TableFilter instance - */ - - function AlternateRows(tf) { - _classCallCheck(this, AlternateRows); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); - - var config = _this.config; - //defines css class for even rows - _this.evenCss = config.even_row_css_class || 'even'; - //defines css class for odd rows - _this.oddCss = config.odd_row_css_class || 'odd'; - return _this; - } - - /** - * Sets alternating rows color - */ - - _createClass(AlternateRows, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - this.processAll(); - - // Subscribe to events - this.emitter.on(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this2.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.on(['column-sorted'], function () { - return _this2.processAll(); - }); - - this.initialized = true; - } - }, { - key: 'processAll', - value: function processAll() { - if (!this.isEnabled()) { - return; - } - var tf = this.tf; - var validRowsIndex = tf.getValidRows(true); - var noValidRowsIndex = validRowsIndex.length === 0; - //1st index - var beginIndex = noValidRowsIndex ? tf.refRow : 0; - // nb indexes - var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; - var idx = 0; - - //alternates bg color - for (var j = beginIndex; j < indexLen; j++) { - var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; - this.setRowBg(rowIdx, idx); - idx++; - } - } - - /** - * Set/remove row background based on row validation - * @param {Number} rowIdx Row index - * @param {Boolean} isValid Valid row flag - */ - - }, { - key: 'processRow', - value: function processRow(rowIdx, arrIdx, isValid) { - if (isValid) { - this.setRowBg(rowIdx, arrIdx); - } else { - this.removeRowBg(rowIdx); - } - } - - /** - * Sets row background color - * @param {Number} rowIdx Row index - * @param {Number} idx Valid rows collection index needed to calculate bg - * color - */ - - }, { - key: 'setRowBg', - value: function setRowBg(rowIdx, idx) { - if (!this.isEnabled() || isNaN(rowIdx)) { - return; - } - var rows = this.tf.tbl.rows; - var i = isNaN(idx) ? rowIdx : idx; - this.removeRowBg(rowIdx); - - _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); - } - - /** - * Removes row background color - * @param {Number} idx Row index - */ - - }, { - key: 'removeRowBg', - value: function removeRowBg(idx) { - if (isNaN(idx)) { - return; - } - var rows = this.tf.tbl.rows; - _dom2.default.removeClass(rows[idx], this.oddCss); - _dom2.default.removeClass(rows[idx], this.evenCss); - } - - /** - * Removes all alternating backgrounds - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { - this.removeRowBg(i); - } - - // Unsubscribe to events - this.emitter.off(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this3.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.off(['column-sorted'], function () { - return _this3.processAll(); - }); - - this.initialized = false; - } - }]); - - return AlternateRows; - })(_feature.Feature); - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.NoResults = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var NoResults = exports.NoResults = (function (_Feature) { - _inherits(NoResults, _Feature); - - /** - * No results message UI component - * @param {Object} tf TableFilter instance - */ - - function NoResults(tf) { - _classCallCheck(this, NoResults); - - //configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); - - var f = _this.config.no_results_message; - - _this.content = f.content || 'No results'; - _this.customContainer = f.custom_container || null; - _this.customContainerId = f.custom_container_id || null; - _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); - _this.cssClass = f.css_class || 'no-results'; - - _this.cont = null; - - //callback before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //callback after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - //callback before message is hidden - _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; - //callback after message is hidden - _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; - - _this.prfxNoResults = 'nores_'; - return _this; - } - - _createClass(NoResults, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - var tf = this.tf; - var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; - - //container - var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); - cont.className = this.cssClass; - cont.innerHTML = this.content; - - if (this.isExternal) { - target.appendChild(cont); - } else { - target.parentNode.insertBefore(cont, target.nextSibling); - } - - this.cont = cont; - - // subscribe to after-filtering event - this.emitter.on(['after-filtering'], function () { - return _this2.toggle(); - }); - - this.initialized = true; - this.hide(); - } - }, { - key: 'toggle', - value: function toggle() { - if (this.tf.nbVisibleRows > 0) { - this.hide(); - } else { - this.show(); - } - } - }, { - key: 'show', - value: function show() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, this); - } - - this.setWidth(); - this.cont.style.display = 'block'; - - if (this.onAfterShowMsg) { - this.onAfterShowMsg.call(null, this.tf, this); - } - } - }, { - key: 'hide', - value: function hide() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - - this.cont.style.display = 'none'; - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - } - }, { - key: 'setWidth', - value: function setWidth() { - if (!this.initialized || this.isExternal || !this.isEnabled()) { - return; - } - if (this.tf.gridLayout) { - var gridLayout = this.tf.feature('gridLayout'); - this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; - } else { - this.cont.style.width = this.tf.tbl.clientWidth + 'px'; - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - // unsubscribe to after-filtering event - this.emitter.off(['after-filtering'], function () { - return _this3.toggle(); - }); - - this.initialized = false; - } - }]); - - return NoResults; - })(_feature.Feature); - -/***/ } -/******/ ]) -}); -; -//# sourceMappingURL=tablefilter.js.map \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.5",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=o["default"].target(t);if(this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t)),this.hasExtension("advancedGrid")){var i=this.extension("advancedGrid"),s=i._ezEditTable;i.cfg.editable&&s.Editable.Remove(),i.cfg.selection&&s.Selection.Remove()}},onSlcFocus:function(t){var e=o["default"].target(t);if(this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===e.getAttribute("filled")){var i=e.getAttribute("ct");this.Mod.dropdown.build(i)}this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t))},onSlcChange:function(t){this.activeFlt&&(this.popupFilters&&o["default"].stop(t),this.onSlcChange&&this.filter())}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new S.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._resetGrid();else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;this.emitter.emit("before-loading-extensions",this);for(var e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),B=x&&_["default"].isValid(t.replace(r,""),O),M=T&&_["default"].isValid(t.replace(f,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=P&&_["default"].isValid(t.replace(c,""),O),j=R&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):B?(U=_["default"].format(t.replace(r,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):M?(U=_["default"].format(t.replace(f,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(S),E,I),t.call(this,S,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var a=this.externalFltTgtIds,r=0,o=a.length;o>r;r++){var h=u["default"].id(a[r]);if(h){var f=this.externalFltEls[r];h.appendChild(f);var d=this.getFilterType(r);this.gridLayout&&""===f.innerHTML&&d!==this.fltTypeInp&&((d===this.fltTypeSlc||d===this.fltTypeMulti)&&t.dropdown.build(r),d===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[], +e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||this.isFirstLoad||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]), +t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index a36acf80..70db2dbc 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,2185 +1,8 @@ -webpackJsonp([1],{ +/** + * tablefilter v0.1.5 by Max Guglielmi + * build date: 2016-01-09T10:12:44.628Z + * MIT License + */ -/***/ 26: -/***/ function(module, exports, __webpack_require__) { - - var map = { - "./array": 6, - "./array.js": 6, - "./cookie": 4, - "./cookie.js": 4, - "./date": 7, - "./date.js": 7, - "./dom": 2, - "./dom.js": 2, - "./emitter": 9, - "./emitter.js": 9, - "./event": 1, - "./event.js": 1, - "./extensions/advancedGrid/adapterEzEditTable": 27, - "./extensions/advancedGrid/adapterEzEditTable.js": 27, - "./extensions/advancedGrid/advancedGrid": 28, - "./extensions/advancedGrid/advancedGrid.js": 28, - "./extensions/colOps/colOps": 29, - "./extensions/colOps/colOps.js": 29, - "./extensions/colsVisibility/colsVisibility": 30, - "./extensions/colsVisibility/colsVisibility.js": 30, - "./extensions/filtersVisibility/filtersVisibility": 31, - "./extensions/filtersVisibility/filtersVisibility.js": 31, - "./extensions/sort/adapterSortabletable": 32, - "./extensions/sort/adapterSortabletable.js": 32, - "./extensions/sort/sort": 33, - "./extensions/sort/sort.js": 33, - "./helpers": 8, - "./helpers.js": 8, - "./modules/alternateRows": 24, - "./modules/alternateRows.js": 24, - "./modules/checkList": 18, - "./modules/checkList.js": 18, - "./modules/clearButton": 22, - "./modules/clearButton.js": 22, - "./modules/dropdown": 16, - "./modules/dropdown.js": 16, - "./modules/feature": 12, - "./modules/feature.js": 12, - "./modules/gridLayout": 11, - "./modules/gridLayout.js": 11, - "./modules/help": 23, - "./modules/help.js": 23, - "./modules/highlightKeywords": 14, - "./modules/highlightKeywords.js": 14, - "./modules/loader": 13, - "./modules/loader.js": 13, - "./modules/noResults": 25, - "./modules/noResults.js": 25, - "./modules/paging": 21, - "./modules/paging.js": 21, - "./modules/popupFilter": 15, - "./modules/popupFilter.js": 15, - "./modules/rowsCounter": 19, - "./modules/rowsCounter.js": 19, - "./modules/statusBar": 20, - "./modules/statusBar.js": 20, - "./modules/store": 10, - "./modules/store.js": 10, - "./sort": 17, - "./sort.js": 17, - "./string": 3, - "./string.js": 3, - "./types": 5, - "./types.js": 5 - }; - function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); - }; - function webpackContextResolve(req) { - return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); - }; - webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); - }; - webpackContext.resolve = webpackContextResolve; - module.exports = webpackContext; - webpackContext.id = 26; - - -/***/ }, - -/***/ 27: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterEzEditTable = (function () { - /** - * Adapter module for ezEditTable, an external library providing advanced - * grid features (selection and edition): - * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus - * - * @param {Object} tf TableFilter instance - */ - - function AdapterEzEditTable(tf, cfg) { - _classCallCheck(this, AdapterEzEditTable); - - // ezEditTable config - this.initialized = false; - this.desc = cfg.description || 'ezEditTable adapter'; - this.filename = cfg.filename || 'ezEditTable.js'; - this.vendorPath = cfg.vendor_path; - this.loadStylesheet = Boolean(cfg.load_stylesheet); - this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; - this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; - this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; - // Enable the ezEditTable's scroll into view behaviour if grid layout on - cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; - - this._ezEditTable = null; - this.cfg = cfg; - this.tf = tf; - } - - /** - * Conditionally load ezEditTable library and set advanced grid - * @return {[type]} [description] - */ - - _createClass(AdapterEzEditTable, [{ - key: 'init', - value: function init() { - var _this = this; - - var tf = this.tf; - if (window.EditTable) { - this._setAdvancedGrid(); - } else { - var path = this.vendorPath + this.filename; - tf.import(this.filename, path, function () { - _this._setAdvancedGrid(); - }); - } - if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { - tf.import(this.stylesheetName, this.stylesheet, null, 'link'); - } - } - - /** - * Instantiate ezEditTable component for advanced grid features - */ - - }, { - key: '_setAdvancedGrid', - value: function _setAdvancedGrid() { - var tf = this.tf; - - //start row for EditTable constructor needs to be calculated - var startRow, - cfg = this.cfg, - thead = _dom2.default.tag(tf.tbl, 'thead'); - - //if thead exists and startRow not specified, startRow is calculated - //automatically by EditTable - if (thead.length > 0 && !cfg.startRow) { - startRow = undefined; - } - //otherwise startRow config property if any or TableFilter refRow - else { - startRow = cfg.startRow || tf.refRow; - } - - cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; - var editable = cfg.editable; - var selectable = cfg.selection; - - if (selectable) { - cfg.default_selection = cfg.default_selection || 'row'; - } - //CSS Styles - cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; - - var _lastValidRowIndex = 0; - var _lastRowIndex = 0; - - if (selectable) { - //Row navigation needs to be calculated according to TableFilter's - //validRowsIndex array - var onAfterSelection = function onAfterSelection(et, selectedElm, e) { - var slc = et.Selection; - //Next valid filtered row needs to be selected - var doSelect = function doSelect(nextRowIndex) { - if (et.defaultSelection === 'row') { - slc.SelectRowByIndex(nextRowIndex); - } else { - et.ClearSelections(); - var cellIndex = selectedElm.cellIndex, - row = tf.tbl.rows[nextRowIndex]; - if (et.defaultSelection === 'both') { - slc.SelectRowByIndex(nextRowIndex); - } - if (row) { - slc.SelectCell(row.cells[cellIndex]); - } - } - //Table is filtered - if (tf.validRowsIndex.length !== tf.getRowsNb()) { - var r = tf.tbl.rows[nextRowIndex]; - if (r) { - r.scrollIntoView(false); - } - if (cell) { - if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { - tf.tblCont.scrollLeft = 100000000; - } else if (cell.cellIndex === 0 && tf.gridLayout) { - tf.tblCont.scrollLeft = 0; - } else { - cell.scrollIntoView(false); - } - } - } - }; - - //table is not filtered - if (!tf.validRowsIndex) { - return; - } - var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, - nextRowIndex, - paging = tf.feature('paging'), - - //pgup/pgdown keys - d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { - //last row - if (row.rowIndex >= validIndexes[validIdxLen - 1]) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - var calcRowIndex = _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[_lastValidRowIndex - d]; - nextRowIndex = v ? v : validIndexes[0]; - } - } - _lastRowIndex = row.rowIndex; - doSelect(nextRowIndex); - } else { - //If filtered row is valid, special calculation for - //pgup/pgdown keys - if (keyCode !== 34 && keyCode !== 33) { - _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); - _lastRowIndex = row.rowIndex; - } else { - if (keyCode === 34) { - //pgdown - //last row - if (_lastValidRowIndex + d <= validIdxLen - 1) { - nextRowIndex = validIndexes[_lastValidRowIndex + d]; - } else { - nextRowIndex = [validIdxLen - 1]; - } - } else { - //pgup - //first row - if (_lastValidRowIndex - d <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - nextRowIndex = validIndexes[_lastValidRowIndex - d]; - } - } - _lastRowIndex = nextRowIndex; - _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); - doSelect(nextRowIndex); - } - } - }; - - //Page navigation has to be enforced whenever selected row is out of - //the current page range - var onBeforeSelection = function onBeforeSelection(et, selectedElm) { - var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; - if (tf.paging) { - if (tf.feature('paging').nbPages > 1) { - var paging = tf.feature('paging'); - //page length is re-assigned in case it has changed - et.nbRowsPerPage = paging.pagingLength; - var validIndexes = tf.validRowsIndex, - validIdxLen = validIndexes.length, - pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); - var rowIndex = row.rowIndex; - - if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { - paging.setPage('last'); - } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { - paging.setPage('first'); - } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { - paging.setPage('next'); - } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { - paging.setPage('previous'); - } - } - } - }; - - //Selected row needs to be visible when paging is activated - if (tf.paging) { - tf.feature('paging').onAfterChangePage = function (paging) { - var advGrid = paging.tf.extension('advancedGrid'); - var et = advGrid._ezEditTable; - var slc = et.Selection; - var row = slc.GetActiveRow(); - if (row) { - row.scrollIntoView(false); - } - var cell = slc.GetActiveCell(); - if (cell) { - cell.scrollIntoView(false); - } - }; - } - - //Rows navigation when rows are filtered is performed with the - //EditTable row selection callback events - if (cfg.default_selection === 'row') { - var fnB = cfg.on_before_selected_row; - cfg.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 = cfg.on_after_selected_row; - cfg.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 = cfg.on_before_selected_cell; - cfg.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 = cfg.on_after_selected_cell; - cfg.on_after_selected_cell = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnC) { - fnC.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - } - } - if (editable) { - //Added or removed rows, TF rows number needs to be re-calculated - var fnE = cfg.on_added_dom_row; - cfg.on_added_dom_row = function () { - tf.nbFilterableRows++; - if (!tf.paging) { - tf.emitter.emit('rows-changed', tf, this); - //tf.feature('rowsCounter').refresh(); - } else { - tf.nbRows++; - tf.nbVisibleRows++; - tf.nbFilterableRows++; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnE) { - fnE.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - if (cfg.actions && cfg.actions['delete']) { - var fnF = cfg.actions['delete'].on_after_submit; - cfg.actions['delete'].on_after_submit = function () { - tf.nbFilterableRows--; - if (!tf.paging) { - // tf.feature('rowsCounter').refresh(); - tf.emitter.emit('rows-changed', tf, this); - } else { - tf.nbRows--; - tf.nbVisibleRows--; - tf.nbFilterableRows--; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(false); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnF) { - fnF.call(null, arguments[0], arguments[1]); - } - }; - } - } - - try { - this._ezEditTable = new EditTable(tf.id, cfg, startRow); - this._ezEditTable.Init(); - } catch (e) { - throw new Error(this.err); - } - - this.initialized = true; - } - - /** - * Reset advanced grid when previously removed - */ - - }, { - key: 'reset', - value: function reset() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.Set(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Set(); - } - } - } - - /** - * Remove advanced grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.ClearSelections(); - ezEditTable.Selection.Remove(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Remove(); - } - } - this.initialized = false; - } - }]); - - return AdapterEzEditTable; - })(); - - exports.default = AdapterEzEditTable; - -/***/ }, - -/***/ 28: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterEzEditTable = __webpack_require__(27); - - var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _adapterEzEditTable2.default; - -/***/ }, - -/***/ 29: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColOps = (function () { - - /** - * Column calculations - * @param {Object} tf TableFilter instance - */ - - function ColOps(tf, opts) { - _classCallCheck(this, ColOps); - - //calls function before col operation - this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; - //calls function after col operation - this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; - - this.opts = opts; - this.tf = tf; - } - - _createClass(ColOps, [{ - key: 'init', - value: function init() { - var _this = this; - - // subscribe to events - this.tf.emitter.on(['after-filtering'], function () { - return _this.calc(); - }); - - this.calc(); - } - - /** - * Calculates columns' values - * Configuration options are stored in 'opts' property - * - 'id' contains ids of elements showing result (array) - * - 'col' contains the columns' indexes (array) - * - 'operation' contains operation type (array, values: 'sum', 'mean', - * 'min', 'max', 'median', 'q1', 'q3') - * - 'write_method' array defines which method to use for displaying the - * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' - * - 'tot_row_index' defines in which row results are displayed - * (integers array) - * - * - changes made by Nuovella: - * (1) optimized the routine (now it will only process each column once), - * (2) added calculations for the median, lower and upper quartile. - */ - - }, { - key: 'calc', - value: function calc() { - var tf = this.tf; - if (!tf.isFirstLoad && !tf.hasGrid()) { - return; - } - - if (this.onBeforeOperation) { - this.onBeforeOperation.call(null, tf); - } - - var opts = this.opts, - labelId = opts.id, - colIndex = opts.col, - operation = opts.operation, - outputType = opts.write_method, - totRowIndex = opts.tot_row_index, - excludeRow = opts.exclude_row, - decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; - - //nuovella: determine unique list of columns to operate on - var ucolIndex = [], - ucolMax = 0; - ucolIndex[ucolMax] = colIndex[0]; - - for (var ii = 1; ii < colIndex.length; ii++) { - var saved = 0; - //see if colIndex[ii] is already in the list of unique indexes - for (var jj = 0; jj <= ucolMax; jj++) { - if (ucolIndex[jj] === colIndex[ii]) { - saved = 1; - } - } - //if not saved then, save the index; - if (saved === 0) { - ucolMax++; - ucolIndex[ucolMax] = colIndex[ii]; - } - } - - if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { - var rows = tf.tbl.rows, - colvalues = []; - - for (var ucol = 0; ucol <= ucolMax; ucol++) { - //this retrieves col values - //use ucolIndex because we only want to pass through this loop - //once for each column get the values in this unique column - colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); - - //next: calculate all operations for this column - 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; - - for (var k = 0; k < colIndex.length; k++) { - if (colIndex[k] === ucolIndex[ucol]) { - mThisCol++; - opsThisCol[mThisCol] = _string2.default.lower(operation[k]); - decThisCol[mThisCol] = decimalPrecision[k]; - labThisCol[mThisCol] = labelId[k]; - oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; - - switch (opsThisCol[mThisCol]) { - case 'mean': - meanFlag = 1; - break; - case 'sum': - sumFlag = 1; - break; - case 'min': - minFlag = 1; - break; - case 'max': - maxFlag = 1; - break; - case 'median': - medFlag = 1; - break; - case 'q1': - q1Flag = 1; - break; - case 'q3': - q3Flag = 1; - break; - } - } - } - - for (var j = 0; j < colvalues[ucol].length; j++) { - //sort the list for calculation of median and quartiles - if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { - if (j < colvalues[ucol].length - 1) { - for (k = j + 1; k < colvalues[ucol].length; k++) { - if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { - temp = colvalues[ucol][j]; - colvalues[ucol][j] = colvalues[ucol][k]; - colvalues[ucol][k] = temp; - } - } - } - } - var cvalue = parseFloat(colvalues[ucol][j]); - theList[j] = parseFloat(cvalue); - - if (!isNaN(cvalue)) { - nbvalues++; - if (sumFlag === 1 || meanFlag === 1) { - sumValue += parseFloat(cvalue); - } - if (minFlag === 1) { - if (minValue === null) { - minValue = parseFloat(cvalue); - } else { - minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; - } - } - if (maxFlag === 1) { - if (maxValue === null) { - maxValue = parseFloat(cvalue); - } else { - maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; - } - } - } - } //for j - if (meanFlag === 1) { - meanValue = sumValue / nbvalues; - } - if (medFlag === 1) { - var aux = 0; - if (nbvalues % 2 === 1) { - aux = Math.floor(nbvalues / 2); - medValue = theList[aux]; - } else { - medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; - } - } - var posa; - if (q1Flag === 1) { - posa = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa == nbvalues) { - q1Value = (theList[posa - 1] + theList[posa]) / 2; - } else { - q1Value = theList[posa]; - } - } - if (q3Flag === 1) { - posa = 0.0; - var posb = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa === nbvalues) { - posb = 3 * posa; - q3Value = (theList[posb] + theList[posb - 1]) / 2; - } else { - q3Value = theList[nbvalues - posa - 1]; - } - } - - for (var i = 0; i <= mThisCol; i++) { - switch (opsThisCol[i]) { - case 'mean': - result = meanValue; - break; - case 'sum': - result = sumValue; - break; - case 'min': - result = minValue; - break; - case 'max': - result = maxValue; - break; - case 'median': - result = medValue; - break; - case 'q1': - result = q1Value; - break; - case 'q3': - result = q3Value; - break; - } - - var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; - - //if outputType is defined - if (oTypeThisCol && result) { - result = result.toFixed(precision); - - if (_dom2.default.id(labThisCol[i])) { - switch (_string2.default.lower(oTypeThisCol)) { - case 'innerhtml': - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result; - } - break; - case 'setvalue': - _dom2.default.id(labThisCol[i]).value = result; - break; - case 'createtextnode': - var oldnode = _dom2.default.id(labThisCol[i]).firstChild; - var txtnode = _dom2.default.text(result); - _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); - break; - } //switch - } - } else { - try { - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); - } - } catch (e) {} //catch - } //else - } //for i - - // row(s) with result are always visible - var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; - if (totRow) { - totRow.style.display = ''; - } - } //for ucol - } //if typeof - - if (this.onAfterOperation) { - this.onAfterOperation.call(null, tf); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - // unsubscribe to events - this.tf.emitter.off(['after-filtering'], function () { - return _this2.calc(); - }); - } - }]); - - return ColOps; - })(); - - exports.default = ColOps; - -/***/ }, - -/***/ 30: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColsVisibility = (function () { - - /** - * Columns Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function ColsVisibility(tf, f) { - _classCallCheck(this, ColsVisibility); - - // Configuration object - var cfg = tf.config(); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Columns visibility manager'; - - //show/hide cols span element - this.spanEl = null; - //show/hide cols button element - this.btnEl = null; - //show/hide cols container div element - this.contEl = null; - - //tick to hide or show column - this.tickToHide = f.tick_to_hide === false ? false : true; - //enables/disables cols manager generation - this.manager = f.manager === false ? false : true; - //only if external headers - this.headersTbl = f.headers_table || false; - //only if external headers - this.headersIndex = f.headers_index || 1; - //id of container element - this.contElTgtId = f.container_target_id || null; - //alternative headers text - this.headersText = f.headers_text || null; - //id of button container element - this.btnTgtId = f.btn_target_id || null; - //defines show/hide cols text - this.btnText = f.btn_text || 'Columns▼'; - //defines show/hide cols button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for show/hide cols button - this.btnCssClass = f.btn_css_class || 'colVis'; - //defines close link text - this.btnCloseText = f.btn_close_text || 'Close'; - //defines close button innerHtml - this.btnCloseHtml = f.btn_close_html || null; - //defines css class for close button - this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; - this.stylesheet = f.stylesheet || 'colsVisibility.css'; - //span containing show/hide cols button - this.prfx = 'colVis_'; - //defines css class span containing show/hide cols - this.spanCssClass = f.span_css_class || 'colVisSpan'; - this.prfxCont = this.prfx + 'Cont_'; - //defines css class div containing show/hide cols - this.contCssClass = f.cont_css_class || 'colVisCont'; - //defines css class for cols list (ul) - this.listCssClass = cfg.list_css_class || 'cols_checklist'; - //defines css class for list item (li) - this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; - //defines css class for selected list item (li) - this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; - //text preceding columns list - this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); - this.atStart = f.at_start || null; - this.enableHover = Boolean(f.enable_hover); - //enables select all option - this.enableTickAll = Boolean(f.enable_tick_all); - //text preceding columns list - this.tickAllText = f.tick_all_text || 'Select all:'; - - //array containing hidden columns indexes - this.hiddenCols = []; - this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; - - //callback invoked just after cols manager is loaded - this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; - //calls function before cols manager is opened - this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; - //calls function after cols manager is opened - this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; - //calls function before cols manager is closed - this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; - //calls function after cols manager is closed - this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; - - //callback before col is hidden - this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; - //callback after col is hidden - this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; - //callback before col is displayed - this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; - //callback after col is displayed - this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; - - //Grid layout compatibility - if (tf.gridLayout) { - this.headersTbl = tf.feature('gridLayout').headTbl; //headers table - this.headersIndex = 0; //headers index - this.onAfterColDisplayed = function () {}; - this.onAfterColHidden = function () {}; - } - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - _createClass(ColsVisibility, [{ - key: 'toggle', - value: function toggle() { - var contDisplay = this.contEl.style.display; - var onBeforeOpen = this.onBeforeOpen; - var onBeforeClose = this.onBeforeClose; - var onAfterOpen = this.onAfterOpen; - var onAfterClose = this.onAfterClose; - - if (onBeforeOpen && contDisplay !== 'inline') { - onBeforeOpen.call(null, this); - } - if (onBeforeClose && contDisplay === 'inline') { - onBeforeClose.call(null, this); - } - - this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; - - if (onAfterOpen && contDisplay !== 'inline') { - onAfterOpen.call(null, this); - } - if (onAfterClose && contDisplay === 'inline') { - onAfterClose.call(null, this); - } - } - }, { - key: 'checkItem', - value: function checkItem(lbl) { - var li = lbl.parentNode; - if (!li || !lbl) { - return; - } - var isChecked = lbl.firstChild.checked; - var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; - colIndex = parseInt(colIndex, 10); - if (isChecked) { - _dom2.default.addClass(li, this.listSlcItemCssClass); - } else { - _dom2.default.removeClass(li, this.listSlcItemCssClass); - } - - var hide = false; - if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { - hide = true; - } - this.setHidden(colIndex, hide); - } - }, { - key: 'init', - value: function init() { - if (!this.manager) { - return; - } - this.buildBtn(); - this.buildManager(); - - this.initialized = true; - } - - /** - * Build main button UI - */ - - }, { - key: 'buildBtn', - value: function buildBtn() { - var _this = this; - - if (this.btnEl) { - return; - } - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.spanCssClass; - - //Container element (rdiv or custom element) - if (!this.btnTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); - - if (!this.btnTgtId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - if (!this.btnHtml) { - var btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCssClass; - btn.title = this.desc; - - btn.innerHTML = this.btnText; - span.appendChild(btn); - if (!this.enableHover) { - _event2.default.add(btn, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(btn, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } else { - //Custom html - span.innerHTML = this.btnHtml; - var colVisEl = span.firstChild; - if (!this.enableHover) { - _event2.default.add(colVisEl, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(colVisEl, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } - - this.spanEl = span; - this.btnEl = this.spanEl.firstChild; - - if (this.onLoaded) { - this.onLoaded.call(null, this); - } - } - - /** - * Build columns manager UI - */ - - }, { - key: 'buildManager', - value: function buildManager() { - var _this2 = this; - - var tf = this.tf; - - var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); - container.className = this.contCssClass; - - //Extension description - var extNameLabel = _dom2.default.create('p'); - extNameLabel.innerHTML = this.text; - container.appendChild(extNameLabel); - - //Headers list - var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); - ul.className = this.listCssClass; - - var tbl = this.headersTbl ? this.headersTbl : tf.tbl; - var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); - var headerRow = tbl.rows[headerIndex]; - - //Tick all option - if (this.enableTickAll) { - var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); - _dom2.default.addClass(li, this.listItemCssClass); - ul.appendChild(li); - li.check.checked = !this.tickToHide; - - _event2.default.add(li.check, 'click', function () { - for (var h = 0; h < headerRow.cells.length; h++) { - var itm = _dom2.default.id('col_' + h + '_' + tf.id); - if (itm && li.check.checked !== itm.checked) { - itm.click(); - itm.checked = li.check.checked; - } - } - }); - } - - for (var i = 0; i < headerRow.cells.length; i++) { - var cell = headerRow.cells[i]; - var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); - var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); - _dom2.default.addClass(liElm, this.listItemCssClass); - if (!this.tickToHide) { - _dom2.default.addClass(liElm, this.listSlcItemCssClass); - } - ul.appendChild(liElm); - if (!this.tickToHide) { - liElm.check.checked = true; - } - - _event2.default.add(liElm.check, 'click', function (evt) { - var elm = _event2.default.target(evt); - var lbl = elm.parentNode; - _this2.checkItem(lbl); - }); - } - - //separator - var p = _dom2.default.create('p', ['align', 'center']); - var btn; - //Close link - if (!this.btnCloseHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCloseCssClass; - btn.innerHTML = this.btnCloseText; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - p.appendChild(btn); - } else { - p.innerHTML = this.btnCloseHtml; - btn = p.firstChild; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - } - - container.appendChild(ul); - container.appendChild(p); - - this.btnEl.parentNode.insertBefore(container, this.btnEl); - this.contEl = container; - - if (this.atStart) { - var a = this.atStart; - for (var k = 0; k < a.length; k++) { - var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); - if (itm) { - itm.click(); - } - } - } - } - - /** - * Hide or show specified columns - * @param {Numner} colIndex Column index - * @param {Boolean} hide hide column if true or show if false - */ - - }, { - key: 'setHidden', - value: function setHidden(colIndex, hide) { - var tf = this.tf; - var tbl = tf.tbl; - - if (this.onBeforeColHidden && hide) { - this.onBeforeColHidden.call(null, this, colIndex); - } - if (this.onBeforeColDisplayed && !hide) { - this.onBeforeColDisplayed.call(null, this, colIndex); - } - - this._hideCells(tbl, colIndex, hide); - if (this.headersTbl) { - this._hideCells(this.headersTbl, colIndex, hide); - } - - var hiddenCols = this.hiddenCols; - var itemIndex = hiddenCols.indexOf(colIndex); - if (hide) { - if (itemIndex === -1) { - this.hiddenCols.push(colIndex); - } - } else { - if (itemIndex !== -1) { - this.hiddenCols.splice(itemIndex, 1); - } - } - - var gridLayout; - var headTbl; - var gridColElms; - if (this.onAfterColHidden && hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); - - var headTblW = parseInt(headTbl.style.width, 10); - headTbl.style.width = headTblW - hiddenWidth + 'px'; - tbl.style.width = headTbl.style.width; - } - this.onAfterColHidden.call(null, this, colIndex); - } - - if (this.onAfterColDisplayed && !hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var width = parseInt(gridColElms[colIndex].style.width, 10); - headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; - tf.tbl.style.width = headTbl.style.width; - } - this.onAfterColDisplayed.call(null, this, colIndex); - } - } - - /** - * Show specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'showCol', - value: function showCol(colIndex) { - if (colIndex === undefined || !this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, false); - } - } - - /** - * Hide specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'hideCol', - value: function hideCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, true); - } - } - - /** - * Determine if specified column is hidden - * @param {Number} colIndex Column index - */ - - }, { - key: 'isColHidden', - value: function isColHidden(colIndex) { - if (this.hiddenCols.indexOf(colIndex) !== -1) { - return true; - } - return false; - } - - /** - * Toggle visibility of specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggleCol', - value: function toggleCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - this.showCol(colIndex); - } else { - this.hideCol(colIndex); - } - } - - /** - * Returns the indexes of the columns currently hidden - * @return {Array} column indexes - */ - - }, { - key: 'getHiddenCols', - value: function getHiddenCols() { - return this.hiddenCols; - } - - /** - * Remove the columns manager - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - if (_dom2.default.id(this.contElTgtId)) { - _dom2.default.id(this.contElTgtId).innerHTML = ''; - } else { - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - } - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - this.initialized = false; - } - }, { - key: '_getHeaderText', - value: function _getHeaderText(cell) { - if (!cell.hasChildNodes) { - return ''; - } - - for (var i = 0; i < cell.childNodes.length; i++) { - var n = cell.childNodes[i]; - if (n.nodeType === 3) { - return n.nodeValue; - } else if (n.nodeType === 1) { - if (n.id && n.id.indexOf('popUp') !== -1) { - continue; - } else { - return _dom2.default.getText(n); - } - } - continue; - } - return ''; - } - }, { - key: '_hideCells', - value: function _hideCells(tbl, colIndex, hide) { - for (var i = 0; i < tbl.rows.length; i++) { - var row = tbl.rows[i]; - var cell = row.cells[colIndex]; - if (cell) { - cell.style.display = hide ? 'none' : ''; - } - } - } - }]); - - return ColsVisibility; - })(); - - exports.default = ColsVisibility; - -/***/ }, - -/***/ 31: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var FiltersVisibility = (function () { - - /** - * Filters Row Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function FiltersVisibility(tf, f) { - _classCallCheck(this, FiltersVisibility); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Filters row visibility manager'; - - // Path and image filenames - this.stylesheet = f.stylesheet || 'filtersVisibility.css'; - this.icnExpand = f.expand_icon_name || 'icn_exp.png'; - this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; - - //expand/collapse filters span element - this.contEl = null; - //expand/collapse filters btn element - this.btnEl = null; - - this.icnExpandHtml = 'Expand filters'; - this.icnCollapseHtml = 'Collapse filters'; - this.defaultText = 'Toggle filters'; - - //id of container element - this.targetId = f.target_id || null; - //enables/disables expand/collapse icon - this.enableIcon = f.enable_icon === false ? false : true; - this.btnText = f.btn_text || ''; - - //defines expand/collapse filters text - this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; - this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; - - //defines expand/collapse filters button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for expand/collapse filters button - this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; - //defines css class span containing expand/collapse filters - this.contCssClass = f.cont_css_class || 'expClpFlt'; - this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); - - this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; - - // Prefix - this.prfx = 'fltsVis_'; - - //callback before filters row is shown - this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; - //callback after filters row is shown - this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; - //callback before filters row is hidden - this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; - //callback after filters row is hidden - this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - /** - * Initialise extension - */ - - _createClass(FiltersVisibility, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - this.buildUI(); - this.initialized = true; - } - - /** - * Build UI elements - */ - - }, { - key: 'buildUI', - value: function buildUI() { - var _this = this; - - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.contCssClass; - - //Container element (rdiv or custom element) - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); - - if (!this.targetId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - var btn = undefined; - if (!this.btnHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); - btn.className = this.btnCssClass; - btn.title = this.btnText || this.defaultText; - btn.innerHTML = this.collapseBtnHtml; - span.appendChild(btn); - } else { - //Custom html - span.innerHTML = this.btnHtml; - btn = span.firstChild; - } - - _event2.default.add(btn, 'click', function () { - return _this.toggle(); - }); - - this.contEl = span; - this.btnEl = btn; - - if (!this.visibleAtStart) { - this.toggle(); - } - } - - /** - * Toggle filters visibility - */ - - }, { - key: 'toggle', - value: function toggle() { - var tf = this.tf; - var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; - var fltRow = tbl.rows[this.filtersRowIndex]; - var fltRowDisplay = fltRow.style.display; - - if (this.onBeforeShow && fltRowDisplay !== '') { - this.onBeforeShow.call(this, this); - } - if (this.onBeforeHide && fltRowDisplay === '') { - this.onBeforeHide.call(null, this); - } - - fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; - if (this.enableIcon && !this.btnHtml) { - this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; - } - - if (this.onAfterShow && fltRowDisplay !== '') { - this.onAfterShow.call(null, this); - } - if (this.onAfterHide && fltRowDisplay === '') { - this.onAfterHide.call(null, this); - } - } - - /** - * Destroy the UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - this.initialized = false; - } - }]); - - return FiltersVisibility; - })(); - - exports.default = FiltersVisibility; - -/***/ }, - -/***/ 32: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _date = __webpack_require__(7); - - var _date2 = _interopRequireDefault(_date); - - var _helpers = __webpack_require__(8); - - var _helpers2 = _interopRequireDefault(_helpers); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterSortableTable = (function () { - - /** - * SortableTable Adapter module - * @param {Object} tf TableFilter instance - */ - - function AdapterSortableTable(tf, opts) { - _classCallCheck(this, AdapterSortableTable); - - this.initialized = false; - this.name = opts.name; - this.desc = opts.description || 'Sortable table'; - - //indicates if tables was sorted - this.sorted = false; - - this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; - this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; - this.asyncSort = Boolean(opts.async_sort); - this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; - - // edit .sort-arrow.descending / .sort-arrow.ascending in - // tablefilter.css to reflect any path change - this.imgPath = opts.images_path || tf.themesPath; - this.imgBlank = opts.image_blank || 'blank.png'; - this.imgClassName = opts.image_class_name || 'sort-arrow'; - this.imgAscClassName = opts.image_asc_class_name || 'ascending'; - this.imgDescClassName = opts.image_desc_class_name || 'descending'; - //cell attribute storing custom key - this.customKey = opts.custom_key || 'data-tf-sortKey'; - - // callback invoked after sort is loaded and instanciated - this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; - // callback invoked before table is sorted - this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; - // callback invoked after table is sorted - this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(AdapterSortableTable, [{ - key: 'init', - value: function init() { - var tf = this.tf; - var adpt = this; - - // SortableTable class sanity check (sortabletable.js) - if (_types2.default.isUndef(SortableTable)) { - throw new Error('SortableTable class not found.'); - } - - this.overrideSortableTable(); - this.setSortTypes(); - - //Column sort at start - var sortColAtStart = adpt.sortColAtStart; - if (sortColAtStart) { - this.stt.sort(sortColAtStart[0], sortColAtStart[1]); - } - - if (this.onSortLoaded) { - this.onSortLoaded.call(null, tf, this); - } - - /*** SortableTable callbacks ***/ - this.stt.onbeforesort = function () { - if (adpt.onBeforeSort) { - adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); - } - - /*** sort behaviour for paging ***/ - if (tf.paging) { - tf.feature('paging').disable(); - } - }; - - this.stt.onsort = function () { - adpt.sorted = true; - - //sort behaviour for paging - if (tf.paging) { - var paginator = tf.feature('paging'); - // recalculate valid rows index as sorting may have change it - tf.getValidRows(true); - paginator.enable(); - paginator.setPage(paginator.getPage()); - } - - if (adpt.onAfterSort) { - adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); - } - - adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn); - }; - - this.initialized = true; - } - - /** - * Sort specified column - * @param {Number} colIdx Column index - * @param {Boolean} desc Optional: descending manner - */ - - }, { - key: 'sortByColumnIndex', - value: function sortByColumnIndex(colIdx, desc) { - this.stt.sort(colIdx, desc); - } - }, { - key: 'overrideSortableTable', - value: function overrideSortableTable() { - var adpt = this, - tf = this.tf; - - /** - * Overrides headerOnclick method in order to handle th event - * @param {Object} e [description] - */ - SortableTable.prototype.headerOnclick = function (evt) { - if (!adpt.initialized) { - return; - } - - // find Header element - var el = evt.target || evt.srcElement; - - while (el.tagName !== 'TD' && el.tagName !== 'TH') { - el = el.parentNode; - } - - this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); - }; - - /** - * Overrides getCellIndex IE returns wrong cellIndex when columns are - * hidden - * @param {Object} oTd TD element - * @return {Number} Cell index - */ - SortableTable.getCellIndex = function (oTd) { - var cells = oTd.parentNode.cells, - l = cells.length, - i = undefined; - for (i = 0; cells[i] != oTd && i < l; i++) {} - return i; - }; - - /** - * Overrides initHeader in order to handle filters row position - * @param {Array} oSortTypes - */ - SortableTable.prototype.initHeader = function (oSortTypes) { - var stt = this; - if (!stt.tHead) { - if (tf.gridLayout) { - stt.tHead = tf.feature('gridLayout').headTbl.tHead; - } else { - return; - } - } - - stt.headersRow = tf.headersRow; - var cells = stt.tHead.rows[stt.headersRow].cells; - stt.sortTypes = oSortTypes || []; - var l = cells.length; - var img = undefined, - c = undefined; - - for (var i = 0; i < l; i++) { - c = cells[i]; - if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { - c.style.cursor = 'pointer'; - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - c.appendChild(img); - if (stt.sortTypes[i] !== null) { - c.setAttribute('_sortType', stt.sortTypes[i]); - } - _event2.default.add(c, 'click', stt._headerOnclick); - } else { - c.setAttribute('_sortType', oSortTypes[i]); - c._sortType = 'None'; - } - } - stt.updateHeaderArrows(); - }; - - /** - * Overrides updateHeaderArrows in order to handle arrows indicators - */ - SortableTable.prototype.updateHeaderArrows = function () { - var stt = this; - var cells = undefined, - l = undefined, - img = undefined; - - // external headers - if (adpt.asyncSort && adpt.triggerIds.length > 0) { - var triggers = adpt.triggerIds; - cells = []; - l = triggers.length; - for (var j = 0; j < triggers.length; j++) { - cells.push(_dom2.default.id(triggers[j])); - } - } else { - if (!this.tHead) { - return; - } - cells = stt.tHead.rows[stt.headersRow].cells; - l = cells.length; - } - for (var i = 0; i < l; i++) { - var cellAttr = cells[i].getAttribute('_sortType'); - if (cellAttr !== null && cellAttr !== 'None') { - img = cells[i].lastChild || cells[i]; - if (img.nodeName.toLowerCase() !== 'img') { - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - cells[i].appendChild(img); - } - if (i === stt.sortColumn) { - img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); - } else { - img.className = adpt.imgClassName; - } - } - } - }; - - /** - * Overrides getRowValue for custom key value feature - * @param {Object} oRow Row element - * @param {String} sType - * @param {Number} nColumn - * @return {String} - */ - SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { - var stt = this; - // if we have defined a custom getRowValue use that - var sortTypeInfo = stt._sortTypeInfo[sType]; - if (sortTypeInfo && sortTypeInfo.getRowValue) { - return sortTypeInfo.getRowValue(oRow, nColumn); - } - var c = oRow.cells[nColumn]; - var s = SortableTable.getInnerText(c); - return stt.getValueFromString(s, sType); - }; - - /** - * Overrides getInnerText in order to avoid Firefox unexpected sorting - * behaviour with untrimmed text elements - * @param {Object} oNode DOM element - * @return {String} DOM element inner text - */ - SortableTable.getInnerText = function (oNode) { - if (!oNode) { - return; - } - if (oNode.getAttribute(adpt.customKey)) { - return oNode.getAttribute(adpt.customKey); - } else { - return _dom2.default.getText(oNode); - } - }; - } - }, { - key: 'addSortType', - value: function addSortType() { - var args = arguments; - SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); - } - }, { - key: 'setSortTypes', - value: function setSortTypes() { - var _this = this; - - var tf = this.tf, - sortTypes = this.sortTypes, - _sortTypes = []; - - for (var i = 0; i < tf.nbCells; i++) { - var colType = undefined; - - if (sortTypes[i]) { - colType = sortTypes[i].toLowerCase(); - if (colType === 'none') { - colType = 'None'; - } - } else { - // resolve column types - if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { - colType = tf.colNbFormat[i].toLowerCase(); - } else if (tf.hasColDateType && tf.colDateType[i] !== null) { - colType = tf.colDateType[i].toLowerCase() + 'date'; - } else { - colType = 'String'; - } - } - _sortTypes.push(colType); - } - - //Public TF method to add sort type - - //Custom sort types - this.addSortType('number', Number); - this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); - this.addSortType('date', SortableTable.toDate); - this.addSortType('string'); - this.addSortType('us', usNumberConverter); - this.addSortType('eu', euNumberConverter); - this.addSortType('dmydate', dmyDateConverter); - this.addSortType('ymddate', ymdDateConverter); - this.addSortType('mdydate', mdyDateConverter); - this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); - this.addSortType('ipaddress', ipAddress, sortIP); - - this.stt = new SortableTable(tf.tbl, _sortTypes); - - /*** external table headers adapter ***/ - if (this.asyncSort && this.triggerIds.length > 0) { - (function () { - var triggers = _this.triggerIds; - for (var j = 0; j < triggers.length; j++) { - if (triggers[j] === null) { - continue; - } - var trigger = _dom2.default.id(triggers[j]); - if (trigger) { - trigger.style.cursor = 'pointer'; - - _event2.default.add(trigger, 'click', function (evt) { - var elm = evt.target; - if (!_this.tf.sort) { - return; - } - _this.stt.asyncSort(triggers.indexOf(elm.id)); - }); - trigger.setAttribute('_sortType', _sortTypes[j]); - } - } - })(); - } - } - - /** - * Destroy sort - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - this.sorted = false; - this.initialized = false; - this.stt.destroy(); - - var ids = tf.getFiltersId(); - for (var idx = 0; idx < ids.length; idx++) { - var header = tf.getHeaderElement(idx); - var img = _dom2.default.tag(header, 'img'); - - if (img.length === 1) { - header.removeChild(img[0]); - } - } - } - }]); - - return AdapterSortableTable; - })(); - - //Converters - - exports.default = AdapterSortableTable; - function usNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'us'); - } - function euNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'eu'); - } - function dateConverter(s, format) { - return _date2.default.format(s, format); - } - function dmyDateConverter(s) { - return dateConverter(s, 'DMY'); - } - function mdyDateConverter(s) { - return dateConverter(s, 'MDY'); - } - function ymdDateConverter(s) { - return dateConverter(s, 'YMD'); - } - function ddmmmyyyyDateConverter(s) { - return dateConverter(s, 'DDMMMYYYY'); - } - - function ipAddress(value) { - var vals = value.split('.'); - for (var x in vals) { - var val = vals[x]; - while (3 > val.length) { - val = '0' + val; - } - vals[x] = val; - } - return vals.join('.'); - } - - function sortIP(a, b) { - var aa = ipAddress(a.value.toLowerCase()); - var bb = ipAddress(b.value.toLowerCase()); - if (aa == bb) { - return 0; - } else if (aa < bb) { - return -1; - } else { - return 1; - } - } - -/***/ }, - -/***/ 33: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterSortabletable = __webpack_require__(32); - - var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - if (!window.SortableTable) { - __webpack_require__(34); - } // import 'script!sortabletable'; - - exports.default = _adapterSortabletable2.default; - -/***/ }, - -/***/ 34: -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") - -/***/ }, - -/***/ 35: -/***/ function(module, exports) { - - /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra - */ - module.exports = function(src) { - if (typeof execScript === "function") - execScript(src); - else - eval.call(null, src); - } - -/***/ }, - -/***/ 36: -/***/ function(module, exports) { - - module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" - -/***/ } - -}); -//# sourceMappingURL=tf-1.js.map \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/src/tablefilter.js b/src/tablefilter.js index 0ba2e0b2..2d47d0f5 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -536,10 +536,10 @@ export class TableFilter { } }, // filter columns on drop-down filter change - onSlcChange(/*e*/) { + onSlcChange(e) { if(!this.activeFlt){ return; } // let _ev = e || global.event; - // if(this.popupFilters){ Event.stop(e); } + if(this.popupFilters){ Event.stop(e); } if(this.onSlcChange){ this.filter(); } }/*, // fill checklist filter on click if required From 8427f58b2fbc455b1c3d9ded3c8c9cf63b5df0f2 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Mon, 11 Jan 2016 12:41:25 +1100 Subject: [PATCH 23/41] Added watermark tests, removed commented out code --- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 6 +- dist/tablefilter/tf-1.js | 2 +- src/modules/checkList.js | 37 +-- src/modules/dropdown.js | 37 +-- src/tablefilter.js | 226 +----------------- test/test-watermark.html | 80 +++++++ test/test-watermark.js | 81 +++++++ 13 files changed, 189 insertions(+), 292 deletions(-) create mode 100644 test/test-watermark.html create mode 100644 test/test-watermark.js diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 55732f83..11ffb1f4 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-09T10:12:44.718Z + * build date: 2016-01-11T01:32:31.472Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 3d8b01e5..72840350 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-09T10:12:44.718Z + * build date: 2016-01-11T01:32:31.472Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 767a12f9..c792ad86 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-09T10:12:44.718Z + * build date: 2016-01-11T01:32:31.472Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 7b2363d6..ab75df90 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-09T10:12:44.718Z + * build date: 2016-01-11T01:32:31.472Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 0f3530fe..b6f3d4e8 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-09T10:12:44.718Z + * build date: 2016-01-11T01:32:31.472Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 7220bbc1..1227aa12 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-09T10:12:44.718Z + * build date: 2016-01-11T01:32:31.472Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index d49cc9d7..01f07393 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,10 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-09T10:12:44.628Z + * build date: 2016-01-11T01:32:31.388Z * MIT License */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.5",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=o["default"].target(t);if(this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t)),this.hasExtension("advancedGrid")){var i=this.extension("advancedGrid"),s=i._ezEditTable;i.cfg.editable&&s.Editable.Remove(),i.cfg.selection&&s.Selection.Remove()}},onSlcFocus:function(t){var e=o["default"].target(t);if(this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===e.getAttribute("filled")){var i=e.getAttribute("ct");this.Mod.dropdown.build(i)}this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t))},onSlcChange:function(t){this.activeFlt&&(this.popupFilters&&o["default"].stop(t),this.onSlcChange&&this.filter())}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new S.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._resetGrid();else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;this.emitter.emit("before-loading-extensions",this);for(var e=0,i=t.length;i>e;e++){var s=t[e];this.ExtRegistry[s.name]||this.loadExtension(s)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.p=this.basePath,i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),B=x&&_["default"].isValid(t.replace(r,""),O),M=T&&_["default"].isValid(t.replace(f,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=P&&_["default"].isValid(t.replace(c,""),O),j=R&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):B?(U=_["default"].format(t.replace(r,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):M?(U=_["default"].format(t.replace(f,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(S),E,I),t.call(this,S,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;ta;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.5",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=o["default"].target(t);if(this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t)),this.hasExtension("advancedGrid")){var i=this.extension("advancedGrid"),s=i._ezEditTable;i.cfg.editable&&s.Editable.Remove(),i.cfg.selection&&s.Selection.Remove()}},onSlcFocus:function(t){var e=o["default"].target(t);if(this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===e.getAttribute("filled")){var i=e.getAttribute("ct");this.Mod.dropdown.build(i)}this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t))},onSlcChange:function(t){this.activeFlt&&(this.popupFilters&&o["default"].stop(t),this.onSlcChange&&this.filter())}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new S.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._resetGrid();else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,s=t.length;s>e;e++){var n=t[e];this.ExtRegistry[n.name]||this.loadExtension(n)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),B=x&&_["default"].isValid(t.replace(r,""),O),M=T&&_["default"].isValid(t.replace(f,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=P&&_["default"].isValid(t.replace(c,""),O),j=R&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):B?(U=_["default"].format(t.replace(r,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):M?(U=_["default"].format(t.replace(f,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(S),E,I),t.call(this,S,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var a=this.externalFltTgtIds,r=0,o=a.length;o>r;r++){var h=u["default"].id(a[r]);if(h){var f=this.externalFltEls[r];h.appendChild(f);var d=this.getFilterType(r);this.gridLayout&&""===f.innerHTML&&d!==this.fltTypeInp&&((d===this.fltTypeSlc||d===this.fltTypeMulti)&&t.dropdown.build(r),d===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[], -e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||this.isFirstLoad||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]), +e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||this.isFirstLoad||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]), t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 70db2dbc..e7f0ad1e 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,6 +1,6 @@ /** * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-09T10:12:44.628Z + * build date: 2016-01-11T01:32:31.388Z * MIT License */ diff --git a/src/modules/checkList.js b/src/modules/checkList.js index 5622e1ee..81f65156 100644 --- a/src/modules/checkList.js +++ b/src/modules/checkList.js @@ -132,7 +132,7 @@ export class CheckList extends Feature{ let ul = Dom.create( 'ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); ul.className = this.checkListCssClass; - Event.add(ul, 'change', (evt) => { this.onChange(evt); }); + Event.add(ul, 'change', (evt) => this.onChange(evt)); let rows = tf.tbl.rows; this.isCustom = tf.isCustomOptions(colIndex); @@ -275,18 +275,6 @@ export class CheckList extends Feature{ addChecks(colIndex, ul){ let tf = this.tf; let chkCt = this.addTChecks(colIndex, ul); - // let fltArr = []; //remember grid values - // let store = tf.feature('store'); - // let tmpVal = store ? - // store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null; - // if(tmpVal && Str.trim(tmpVal).length > 0){ - // if(tf.hasCustomSlcOptions && - // tf.customSlcOptions.cols.indexOf(colIndex) != -1){ - // fltArr.push(tmpVal); - // } else { - // fltArr = tmpVal.split(' '+tf.orOperator+' '); - // } - // } for(let y=0; y { this.optionClick(evt); }); + Event.add(li.check, 'click', (evt) => this.optionClick(evt)); } ul.appendChild(li); @@ -310,18 +297,6 @@ export class CheckList extends Feature{ //item is hidden li.style.display = 'none'; } - - /*** remember grid values ***/ - // if(tf.rememberGridValues){ - // if((tf.hasCustomSlcOptions && - // tf.customSlcOptions.cols.indexOf(colIndex) != -1 && - // fltArr.toString().indexOf(val) != -1) || - // Arr.has(fltArr, - // Str.matchCase(val, tf.matchCase), tf.matchCase)){ - // li.check.checked = true; - // this.setCheckListValues(li.check); - // } - // } } } @@ -351,9 +326,7 @@ export class CheckList extends Feature{ tf.fltIds[colIndex]+'_1', tf.emOperator, tf.emptyText); li1.className = this.checkListItemCssClass; ul.appendChild(li1); - Event.add(li1.check, 'click', (evt) => { - this.optionClick(evt); - }); + Event.add(li1.check, 'click', (evt) => this.optionClick(evt)); chkCt++; } @@ -365,9 +338,7 @@ export class CheckList extends Feature{ ); li2.className = this.checkListItemCssClass; ul.appendChild(li2); - Event.add(li2.check, 'click', (evt) => { - this.optionClick(evt); - }); + Event.add(li2.check, 'click', (evt) => this.optionClick(evt)); chkCt++; } return chkCt; diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index 87f711ac..faf099f9 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -68,7 +68,7 @@ export class Dropdown extends Feature{ container.appendChild(slc); } - tf.fltIds.push(/*this.prfxFlt+i+'_'+this.id*/slc.id); + tf.fltIds.push(slc.id); if(!tf.loadFltOnDemand){ this.build(colIndex); @@ -121,20 +121,6 @@ export class Dropdown extends Feature{ activeFlt = activeFlt.split(tf.prfxFlt)[1]; } - /*** remember grid values ***/ - // let fltsValues = [], fltArr = []; - // if(tf.rememberGridValues){ - // fltsValues = tf.feature('store').getFilterValues( - // tf.fltsValuesCookie); - // if(fltsValues && !Str.isEmpty(fltsValues.toString())){ - // if(this.isCustom){ - // fltArr.push(fltsValues[colIndex]); - // } else { - // fltArr = fltsValues[colIndex].split(' '+tf.orOperator+' '); - // } - // } - // } - let excludedOpts = null, filteredDataCol = null; if(isLinked && tf.disableExcludedOptions){ @@ -257,8 +243,7 @@ export class Dropdown extends Feature{ } //populates drop-down - this.addOptions( - colIndex, slc, isLinked, excludedOpts/*, fltsValues, fltArr*/); + this.addOptions(colIndex, slc, isLinked, excludedOpts); this.emitter.emit('after-populating-filter', tf, colIndex, slc); } @@ -312,24 +297,6 @@ export class Dropdown extends Feature{ opt = Dom.createOpt(lbl, val, true); } else { opt = Dom.createOpt(lbl, val, false); - // if(tf.getFilterType(colIndex) !== tf.fltTypeMulti){ - // opt = Dom.createOpt( - // lbl, - // val, - // (fltsValues[colIndex]!==' ' && - // val===fltsValues[colIndex]) ? true : false - // ); - // } else { - // opt = Dom.createOpt( - // lbl, - // val, - // (Arr.has(fltArr, - // Str.matchCase(this.opts[y], tf.matchCase), - // tf.matchCase) || - // fltArr.toString().indexOf(val)!== -1) ? - // true : false - // ); - // } } if(isDisabled){ opt.disabled = true; diff --git a/src/tablefilter.js b/src/tablefilter.js index 2d47d0f5..2257f790 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -109,15 +109,6 @@ export class TableFilter { this.headersRow = isNaN(f.headers_row_index) ? (this.filtersRowIndex === 0 ? 1 : 0) : f.headers_row_index; - // 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; @@ -429,7 +420,6 @@ export class TableFilter { // Detect key detectKey(e) { if(!this.enterKey){ return; } - // let _ev = e || global.event; if(e){ let key = Event.keyCode(e); if(key===13){ @@ -448,7 +438,6 @@ export class TableFilter { if(!this.autoFilter){ return; } - // let _ev = e || global.event; let key = Event.keyCode(e); this.isUserTyping = false; @@ -498,7 +487,6 @@ export class TableFilter { }, // set focused text-box filter as active onInpFocus(e) { - // let _ev = e || global.event; let elm = Event.target(e); this.activeFilterId = elm.getAttribute('id'); this.activeFlt = Dom.id(this.activeFilterId); @@ -538,21 +526,9 @@ export class TableFilter { // filter columns on drop-down filter change onSlcChange(e) { if(!this.activeFlt){ return; } - // let _ev = e || global.event; if(this.popupFilters){ Event.stop(e); } if(this.onSlcChange){ this.filter(); } - }/*, - // fill checklist filter on click if required - onCheckListClick(e) { - let _ev = e || global.event; - let elm = Event.target(_ev); - if(this.loadFltOnDemand && elm.getAttribute('filled') === '0'){ - let ct = elm.getAttribute('ct'); - this.Mod.checkList.build(ct); - this.Mod.checkList.checkListDiv[ct].onclick = null; - this.Mod.checkList.checkListDiv[ct].title = ''; - } - }*/ + } }; } @@ -565,17 +541,6 @@ export class TableFilter { 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; - // } let Mod = this.Mod; let n = this.singleSearchFlt ? 1 : this.nbCells, @@ -623,29 +588,6 @@ export class TableFilter { } else { if(this.isFirstLoad){ let fltrow = this._insertFiltersRow(); - // if(!this.gridLayout){ - // let 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.popupFilters){ - // fltrow.style.display = 'none'; - // } - // } this.nbFilterableRows = this.getRowsNb(); this.nbVisibleRows = this.nbFilterableRows; @@ -653,16 +595,10 @@ export class TableFilter { // Generate filters for(let i=0; i this.filter()); - }//if + } this.emitter.emit('after-filter-init', this, i); }// for i @@ -929,8 +742,7 @@ export class TableFilter { fltrow = this.tbl.insertRow(this.filtersRowIndex); } - if(this.headersRow > 1 && this.filtersRowIndex <= this.headersRow /*&& - !this.popupFilters*/){ + if(this.headersRow > 1 && this.filtersRowIndex <= this.headersRow){ this.headersRow++; } @@ -941,7 +753,6 @@ export class TableFilter { } this.emitter.emit('filters-row-inserted', this, fltrow); - return fltrow; } @@ -953,9 +764,6 @@ export class TableFilter { return; } this.refRow = this.refRow > 0 ? this.refRow-1 : 0; - // if(this.gridLayout){ - // this.refRow = 0; - // } this.nbFilterableRows = this.getRowsNb(); this.nbVisibleRows = this.nbFilterableRows; this.nbRows = this.nbFilterableRows + this.refRow; @@ -975,6 +783,7 @@ export class TableFilter { let inp = Dom.create(this.fltTypeInp, ['id', this.prfxFlt+colIndex+'_'+this.id], ['type', inptype], ['ct', colIndex]); + if(inptype !== 'hidden' && this.watermark){ inp.setAttribute('placeholder', this.isWatermarkArray ? (this.watermark[colIndex] || '') : @@ -984,7 +793,7 @@ export class TableFilter { inp.className = cssClass || this.fltCssClass; Event.add(inp, 'focus', this.Evt.onInpFocus.bind(this)); - //filter is appended in desired element + //filter is appended in custom element if(externalFltTgtId){ Dom.id(externalFltTgtId).appendChild(inp); this.externalFltEls.push(inp); @@ -992,20 +801,12 @@ export class TableFilter { container.appendChild(inp); } - this.fltIds.push(/*this.prfxFlt+i+'_'+this.id*/inp.id); + this.fltIds.push(inp.id); Event.add(inp, 'keypress', this.Evt.detectKey.bind(this)); Event.add(inp, 'keydown', this.Evt.onKeyDown.bind(this)); Event.add(inp, 'keyup', this.Evt.onKeyUp.bind(this)); Event.add(inp, 'blur', this.Evt.onInpBlur.bind(this)); - - // if(this.rememberGridValues){ - // let fltValues = this.Mod.store.getFilterValues( - // this.fltsValuesCookie); - // if(fltValues[colIndex]!=' '){ - // this.setFilterValue(colIndex, fltValues[colIndex], false); - // } - // } } /** @@ -1021,7 +822,7 @@ export class TableFilter { ['type', 'button'], ['value', this.btnText]); btn.className = this.btnCssClass; - //filter is appended in desired element + //filter is appended in custom element if(externalFltTgtId){ Dom.id(externalFltTgtId).appendChild(btn); } else{ @@ -1045,6 +846,8 @@ export class TableFilter { */ initExtensions(){ let exts = this.extensions; + // Set config's publicPath dynamically for Webpack... + __webpack_public_path__ = this.basePath; this.emitter.emit('before-loading-extensions', this); for(let i=0, len=exts.length; i { let inst = new mod.default(this, ext); inst.init(); @@ -1193,8 +994,6 @@ export class TableFilter { let rows = this.tbl.rows, Mod = this.Mod; - // this.clearFilters(); - if(this.isExternalFlt && !this.popupFilters){ this.removeExternalFlts(); } @@ -1253,7 +1052,6 @@ export class TableFilter { this.validRowsIndex = []; this.activeFlt = null; this._hasGrid = false; - // this.tbl = null; } /** diff --git a/test/test-watermark.html b/test/test-watermark.html new file mode 100644 index 00000000..f08d3bec --- /dev/null +++ b/test/test-watermark.html @@ -0,0 +1,80 @@ + + + + + TableFilter watermark tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FromDestinationRoad Distance (km)By Air (hrs)By Rail (hrs)
SydneyAdelaide14121.425.3
SydneyBrisbane9821.516
SydneyCanberra286.64.3
SydneyMelbourne8721.110.5
AdelaidePerth27813.138
AdelaideAlice Springs1533220.25
AdelaideBrisbane20452.1540
+ + + + +
+
+ + diff --git a/test/test-watermark.js b/test/test-watermark.js new file mode 100644 index 00000000..780a996c --- /dev/null +++ b/test/test-watermark.js @@ -0,0 +1,81 @@ +(function(win, TableFilter){ + + var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + watermark: 'foobar' + }); + tf.init(); + + module('Sanity checks'); + test('Watermark properties', function() { + deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated'); + deepEqual(tf.watermark, 'foobar', 'Property value'); + deepEqual(tf.isWatermarkArray, false, + 'Type: same watermark for all filters'); + }); + + test('DOM element', function(){ + var flt0 = tf.getFilterElement(0); + var flt1 = tf.getFilterElement(3); + deepEqual(flt0.placeholder, 'foobar', 'filter`s placeholder value'); + deepEqual(flt1.placeholder, 'foobar', 'filter`s placeholder value'); + }); + + module('Per column watermark'); + test('Sanity checks', function() { + tf.destroy(); + tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + watermark: ['City', 'City', 'Distance', 'Time', 'Time'] + }); + tf.init(); + + deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated'); + deepEqual(tf.isWatermarkArray, true, 'Type: watermark array'); + deepEqual( + tf.watermark, + ['City', 'City', 'Distance', 'Time', 'Time'], + 'Property value' + ); + }); + + test('DOM element', function(){ + deepEqual( + tf.getFilterElement(0).placeholder, + 'City', + 'filter`s placeholder value' + ); + deepEqual( + tf.getFilterElement(1).placeholder, + 'City', + 'filter`s placeholder value' + ); + deepEqual( + tf.getFilterElement(2).placeholder, + 'Distance', + 'filter`s placeholder value' + ); + deepEqual( + tf.getFilterElement(3).placeholder, + 'Time', + 'filter`s placeholder value' + ); + deepEqual( + tf.getFilterElement(4).placeholder, + 'Time', + 'filter`s placeholder value' + ); + }); + + module('Tear-down'); + test('TableFilter removed', function() { + tf.destroy(); + deepEqual(tf.hasGrid(), false, 'Filters removed'); + deepEqual( + tf.watermark, + ['City', 'City', 'Distance', 'Time', 'Time'], + 'Property value' + ); + }); + +})(window, TableFilter); From 5568663f46d6bccdd81cc520593ad0caf41a8b82 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Mon, 11 Jan 2016 18:35:21 +1100 Subject: [PATCH 24/41] initial commit --- dist/starter.html | 514 -- dist/tablefilter/style/colsVisibility.css | 4 +- dist/tablefilter/style/filtersVisibility.css | 4 +- dist/tablefilter/style/tablefilter.css | 4 +- .../style/themes/default/default.css | 4 +- .../style/themes/mytheme/mytheme.css | 4 +- .../style/themes/skyblue/skyblue.css | 4 +- dist/tablefilter/tablefilter.js | 7779 ++++++++++++++++- dist/tablefilter/tf-1.js | 2224 ++++- package.json | 2 +- .../advancedGrid/adapterEzEditTable.js | 24 + src/modules/dropdown.js | 19 +- src/tablefilter.js | 57 +- test/test-popup-filter.js | 16 +- 14 files changed, 10068 insertions(+), 591 deletions(-) delete mode 100644 dist/starter.html diff --git a/dist/starter.html b/dist/starter.html deleted file mode 100644 index b59dfa1e..00000000 --- a/dist/starter.html +++ /dev/null @@ -1,514 +0,0 @@ - - - - tablefilter v0.1.5 - Starter - - -

tablefilter v0.1.5

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
countryisoyearPOPXRATPPPcgdpccci
BeninBEN19985950.33589.9517822190.951178.4690.987.55
BeninBEN19996109.53615.6990967200.191174.9092.617.86
BeninBEN20006272.00711.9763184200.611224.7492.278.25
Burkina FasoBFA19949755.03555.2047119125.76838.7679.816.57
Burkina FasoBFA19959988.00499.148407136.65860.8980.419.29
Burkina FasoBFA199610225.00511.5523987144.18881.1180.4012.12
Burkina FasoBFA199710473.53583.6693726141.78899.0176.9414.94
RussiaRUS1998146899.019.7050828932.647086.3967.739.20
RussiaRUS1999146308.9924.61993984.038074.7057.358.81
RussiaRUS2000145555.0128.129169464.859995.9154.748.79
RwandaRWA19946230.00194.51750.39529.48132.164.48
RwandaRWA19956400.00262.197509870.67746.3492.773.08
RwandaRWA19966727.00306.820007377.90823.2589.713.21
RwandaRWA19977895.18301.529785284.13847.7991.443.72
RwandaRWA19988105.00312.314086985.32914.2289.344.22
El SalvadorSLV19955669.008.7545833593.544143.5989.3110.35
El SalvadorSLV19965798.008.7550001143.694235.7988.777.79
El SalvadorSLV19975911.008.7562503813.744408.4187.057.90
Slovak RepublicSVK20005401.0046.035213.0212618.5352.2224.78
SloveniaSVN19941988.90128.808593879.9711662.1253.2119.87
SloveniaSVN19951990.00118.518501389.0312574.9654.4623.11
SloveniaSVN19961991.00135.364303697.2713151.5154.3223.23
SloveniaSVN19971985.96159.6882935103.9614143.0253.2424.14
SloveniaSVN19981982.60166.134201108.9315067.3452.8225.35
ZambiaZMB19948740.72669.3706055307.48834.1975.439.86
ZambiaZMB19958980.00864.1192017402.40829.3776.5510.31
ZambiaZMB19969214.401207.900024515.01838.0578.7410.99
ZambiaZMB19979443.211314.498047596.97851.4777.5912.15
ZambiaZMB19989665.711862.06897744.91800.6985.1213.75
ZambiaZMB19999881.212388.019043941.87765.2491.8215.30
ZambiaZMB200010089.003110.8439941157.63840.9786.3315.38
ZimbabweZWE199410775.358.1515388492.012586.8460.1018.53
ZimbabweZWE199511011.008.665375712.152603.3766.8915.03
ZimbabweZWE199611242.1610.002349852.642860.2372.0611.32
ZimbabweZWE199711923.5212.111289983.172727.0682.8211.01
ZimbabweZWE199812153.8523.679109574.062799.8577.6610.75
ZimbabweZWE199912388.3238.301200876.122770.4876.8910.73
ZimbabweZWE200012627.0044.417919169.482607.0369.238.62
- - - - - - -

-
-
-
-
-
-
-
-
-
diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index 11ffb1f4..71d1f540 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-11T01:32:31.472Z 
+ *	 tablefilter v0.1.6 by Max Guglielmi 
+ *	 build date: 2016-01-11T07:16:04.434Z 
  *	 MIT License  
  */ 
 span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
\ No newline at end of file
diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css
index 72840350..a7b18d42 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-11T01:32:31.472Z 
+ *	 tablefilter v0.1.6 by Max Guglielmi 
+ *	 build date: 2016-01-11T07:16:04.434Z 
  *	 MIT License  
  */ 
 span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
\ No newline at end of file
diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css
index c792ad86..02a4ac92 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-11T01:32:31.472Z 
+ *	 tablefilter v0.1.6 by Max Guglielmi 
+ *	 build date: 2016-01-11T07:16:04.434Z 
  *	 MIT License  
  */ 
 .activeHeader{background-color:#66afe9 !important;color:#fff !important}
diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css
index ab75df90..36d63a83 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-11T01:32:31.472Z 
+ *	 tablefilter v0.1.6 by Max Guglielmi 
+ *	 build date: 2016-01-11T07:16:04.434Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css
index b6f3d4e8..e9855df8 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-11T01:32:31.472Z 
+ *	 tablefilter v0.1.6 by Max Guglielmi 
+ *	 build date: 2016-01-11T07:16:04.434Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css
index 1227aa12..4d20e53f 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
 /** 
- *	 tablefilter v0.1.5 by Max Guglielmi 
- *	 build date: 2016-01-11T01:32:31.472Z 
+ *	 tablefilter v0.1.6 by Max Guglielmi 
+ *	 build date: 2016-01-11T07:16:04.434Z 
  *	 MIT License  
  */ 
 table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
index 01f07393..e46f89bf 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -1,10 +1,7771 @@
-/** 
- *	 tablefilter v0.1.5 by Max Guglielmi
- *	 build date: 2016-01-11T01:32:31.388Z 
- *	 MIT License  
- */ 
+(function webpackUniversalModuleDefinition(root, factory) {
+	if(typeof exports === 'object' && typeof module === 'object')
+		module.exports = factory();
+	else if(typeof define === 'function' && define.amd)
+		define([], factory);
+	else {
+		var a = factory();
+		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
+	}
+})(this, function() {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ 	// install a JSONP callback for chunk loading
+/******/ 	var parentJsonpFunction = window["webpackJsonp"];
+/******/ 	window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
+/******/ 		// add "moreModules" to the modules object,
+/******/ 		// then flag all "chunkIds" as loaded and fire callback
+/******/ 		var moduleId, chunkId, i = 0, callbacks = [];
+/******/ 		for(;i < chunkIds.length; i++) {
+/******/ 			chunkId = chunkIds[i];
+/******/ 			if(installedChunks[chunkId])
+/******/ 				callbacks.push.apply(callbacks, installedChunks[chunkId]);
+/******/ 			installedChunks[chunkId] = 0;
+/******/ 		}
+/******/ 		for(moduleId in moreModules) {
+/******/ 			modules[moduleId] = moreModules[moduleId];
+/******/ 		}
+/******/ 		if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
+/******/ 		while(callbacks.length)
+/******/ 			callbacks.shift().call(null, __webpack_require__);
+/******/
+/******/ 	};
+/******/
+/******/ 	// The module cache
+/******/ 	var installedModules = {};
+/******/
+/******/ 	// object to store loaded and loading chunks
+/******/ 	// "0" means "already loaded"
+/******/ 	// Array means "loading", array contains callbacks
+/******/ 	var installedChunks = {
+/******/ 		0:0
+/******/ 	};
+/******/
+/******/ 	// The require function
+/******/ 	function __webpack_require__(moduleId) {
+/******/
+/******/ 		// Check if module is in cache
+/******/ 		if(installedModules[moduleId])
+/******/ 			return installedModules[moduleId].exports;
+/******/
+/******/ 		// Create a new module (and put it into the cache)
+/******/ 		var module = installedModules[moduleId] = {
+/******/ 			exports: {},
+/******/ 			id: moduleId,
+/******/ 			loaded: false
+/******/ 		};
+/******/
+/******/ 		// Execute the module function
+/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ 		// Flag the module as loaded
+/******/ 		module.loaded = true;
+/******/
+/******/ 		// Return the exports of the module
+/******/ 		return module.exports;
+/******/ 	}
+/******/
+/******/ 	// This file contains only the entry chunk.
+/******/ 	// The chunk loading function for additional chunks
+/******/ 	__webpack_require__.e = function requireEnsure(chunkId, callback) {
+/******/ 		// "0" is the signal for "already loaded"
+/******/ 		if(installedChunks[chunkId] === 0)
+/******/ 			return callback.call(null, __webpack_require__);
+/******/
+/******/ 		// an array means "currently loading".
+/******/ 		if(installedChunks[chunkId] !== undefined) {
+/******/ 			installedChunks[chunkId].push(callback);
+/******/ 		} else {
+/******/ 			// start chunk loading
+/******/ 			installedChunks[chunkId] = [callback];
+/******/ 			var head = document.getElementsByTagName('head')[0];
+/******/ 			var script = document.createElement('script');
+/******/ 			script.type = 'text/javascript';
+/******/ 			script.charset = 'utf-8';
+/******/ 			script.async = true;
+/******/
+/******/ 			script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js";
+/******/ 			head.appendChild(script);
+/******/ 		}
+/******/ 	};
+/******/
+/******/ 	// expose the modules object (__webpack_modules__)
+/******/ 	__webpack_require__.m = modules;
+/******/
+/******/ 	// expose the module cache
+/******/ 	__webpack_require__.c = installedModules;
+/******/
+/******/ 	// __webpack_public_path__
+/******/ 	__webpack_require__.p = "";
+/******/
+/******/ 	// Load entry module and return exports
+/******/ 	return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
 
-!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.5",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){if(this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.hasExtension("advancedGrid")){var t=this.extension("advancedGrid"),e=t._ezEditTable;t.cfg.editable&&e.Editable.Set(),t.cfg.selection&&e.Selection.Set()}},onInpFocus:function(t){var e=o["default"].target(t);if(this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t)),this.hasExtension("advancedGrid")){var i=this.extension("advancedGrid"),s=i._ezEditTable;i.cfg.editable&&s.Editable.Remove(),i.cfg.selection&&s.Selection.Remove()}},onSlcFocus:function(t){var e=o["default"].target(t);if(this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.loadFltOnDemand&&"0"===e.getAttribute("filled")){var i=e.getAttribute("ct");this.Mod.dropdown.build(i)}this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t))},onSlcChange:function(t){this.activeFlt&&(this.popupFilters&&o["default"].stop(t),this.onSlcChange&&this.filter())}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new S.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._resetGrid();else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new O.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,s=t.length;s>e;e++){var n=t[e];this.ExtRegistry[n.name]||this.loadExtension(n)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),S=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),O),B=x&&_["default"].isValid(t.replace(r,""),O),M=T&&_["default"].isValid(t.replace(f,""),O),A=k&&_["default"].isValid(t.replace(o,""),O),H=P&&_["default"].isValid(t.replace(c,""),O),j=R&&_["default"].isValid(t.replace(g,""),O),V=void 0,U=void 0;if(_["default"].isValid(e,O))V=_["default"].format(e,O),D?(U=_["default"].format(t.replace(h,""),O),s=U>V):B?(U=_["default"].format(t.replace(r,""),O),s=U>=V):A?(U=_["default"].format(t.replace(o,""),O),s=V>=U):M?(U=_["default"].format(t.replace(f,""),O),s=V>U):H?(U=_["default"].format(t.replace(c,""),O),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),O),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,O)?(U=_["default"].format(t,O),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(S){var G=t.replace(b,"");s=e.lastIndexOf(G,e.length-1)===e.length-1-(G.length-1)&&e.lastIndexOf(G,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var z=t.replace(C,""),W=new RegExp(z);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var S=this.searchArgs[this.singleSearchFlt?0:I],O=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==S){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=S.split(this.orOperator),N=L.length>1?!0:!1,D=S.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(S),E,I),t.call(this,S,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var a=this.externalFltTgtIds,r=0,o=a.length;o>r;r++){var h=u["default"].id(a[r]);if(h){var f=this.externalFltEls[r];h.appendChild(f);var d=this.getFilterType(r);this.gridLayout&&""===f.innerHTML&&d!==this.fltTypeInp&&((d===this.fltTypeSlc||d===this.fltTypeMulti)&&t.dropdown.build(r),d===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),S=0;S',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[], -e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||this.isFirstLoad||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]), -t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + // Features + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.TableFilter = undefined; + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + var _emitter = __webpack_require__(9); + + var _store = __webpack_require__(10); + + var _gridLayout = __webpack_require__(11); + + var _loader = __webpack_require__(13); + + var _highlightKeywords = __webpack_require__(14); + + var _popupFilter = __webpack_require__(15); + + var _dropdown = __webpack_require__(16); + + var _checkList = __webpack_require__(18); + + var _rowsCounter = __webpack_require__(19); + + var _statusBar = __webpack_require__(20); + + var _paging = __webpack_require__(21); + + var _clearButton = __webpack_require__(22); + + var _help = __webpack_require__(23); + + var _alternateRows = __webpack_require__(24); + + var _noResults = __webpack_require__(25); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var global = window, + doc = global.document; + + var TableFilter = exports.TableFilter = (function () { + + /** + * TableFilter object constructor + * requires `table` or `id` arguments, `row` and `configuration` optional + * @param {DOMElement} table Table DOM element + * @param {String} id Table id + * @param {Number} row index indicating the 1st row + * @param {Object} configuration object + */ + + function TableFilter() { + var _this = this; + + _classCallCheck(this, TableFilter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (args.length === 0) { + return; + } + + this.id = null; + this.version = '0.1.6'; + this.year = new Date().getFullYear(); + this.tbl = null; + this.startRow = null; + this.refRow = null; + this.headersRow = null; + this.cfg = {}; + this.nbFilterableRows = null; + this.nbRows = null; + this.nbCells = null; + this._hasGrid = false; + + // TODO: use for-of with babel plug-in + args.forEach(function (arg) { + // for (let arg of args) { + var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); + if (argtype === 'object' && arg && arg.nodeName === 'TABLE') { + _this.tbl = arg; + _this.id = arg.id || 'tf_' + new Date().getTime() + '_'; + } else if (argtype === 'string') { + _this.id = arg; + _this.tbl = _dom2.default.id(arg); + } else if (argtype === 'number') { + _this.startRow = arg; + } else if (argtype === 'object') { + _this.cfg = arg; + } + // } + }); + + if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) { + throw new Error('Could not instantiate TableFilter: HTML table not found.'); + } + + // configuration object + var f = this.cfg; + + this.emitter = new _emitter.Emitter(); + + //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 || 'tablefilter/'; + + /*** filter types ***/ + this.fltTypeInp = 'input'; + this.fltTypeSlc = 'select'; + this.fltTypeMulti = 'multiple'; + this.fltTypeCheckList = 'checklist'; + this.fltTypeNone = 'none'; + + /*** filters' grid properties ***/ + + //enables/disables filter grid + this.fltGrid = f.grid === false ? false : true; + + //enables/disables grid layout (fixed headers) + this.gridLayout = Boolean(f.grid_layout); + + this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index; + this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index; + + //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 valid rows indexes (rows visible upon filtering) + this.validRowsIndex = []; + //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; + + //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.stylePath = f.style_path || this.basePath + 'style/'; + this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows); + //defines widths of columns + this.hasColWidths = _types2.default.isArray(f.col_widths); + this.colWidths = this.hasColWidths ? f.col_widths : null; + //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'; + + /*** filters' grid behaviours ***/ + //enables/disables enter key + this.enterKey = f.enter_key === false ? false : true; + //calls function before filtering starts + this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null; + //calls function after filtering + this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null; + //enables/disables case sensitivity + this.caseSensitive = Boolean(f.case_sensitive); + //has exact match per column + this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match); + this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : []; + //enables/disbles exact match for search + this.exactMatch = Boolean(f.exact_match); + //refreshes drop-down lists upon validation + this.linkedFilters = Boolean(f.linked_filters); + //wheter excluded options are disabled + this.disableExcludedOptions = Boolean(f.disable_excluded_options); + //stores active filter element + this.activeFlt = null; + //id of active filter + this.activeFilterId = null; + //enables always visible rows + this.hasVisibleRows = Boolean(f.rows_always_visible); + //array containing always visible rows + this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; + //enables/disables external filters generation + this.isExternalFlt = Boolean(f.external_flt_grid); + //array containing ids of external elements containing filters + this.externalFltTgtIds = f.external_flt_grid_ids || []; + //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null; + //enables/disables single filter search + this.singleSearchFlt = Boolean(f.single_filter); + //calls function after row is validated + this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null; + //input watermark text array + this.watermark = f.watermark || ''; + this.isWatermarkArray = _types2.default.isArray(this.watermark); + //id of toolbar container element + this.toolBarTgtId = f.toolbar_target_id || null; + //enables/disables help div + this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions); + //popup filters + this.popupFilters = Boolean(f.popup_filters); + //active columns color + this.markActiveColumns = Boolean(f.mark_active_columns); + //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null; + //calls function after active column header is marked + this.onAfterActiveColumn = _types2.default.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 || 'Clear'; + //enables/disables empty option in combo-box filters + this.enableEmptyOption = Boolean(f.enable_empty_option); + //defines empty option text + this.emptyText = f.empty_text || '(Empty)'; + //enables/disables non empty option in combo-box filters + this.enableNonEmptyOption = Boolean(f.enable_non_empty_option); + //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 = Boolean(f.sort_num_asc); + this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null; + //enables/disables descending numeric options sorting + this.isSortNumDesc = Boolean(f.sort_num_desc); + this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null; + //Select filters are populated on demand + this.loadFltOnDemand = Boolean(f.load_filters_on_demand); + this.hasCustomOptions = _types2.default.isObj(f.custom_options); + this.customOptions = f.custom_options; + + /*** 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 || '^[¥£€$]'; + this.separator = f.separator || ','; + + /*** rows counter ***/ + //show/hides rows counter + this.rowsCounter = Boolean(f.rows_counter); + + /*** status bar ***/ + //show/hides status bar + this.statusBar = Boolean(f.status_bar); + + /*** loader ***/ + //enables/disables loader/spinner indicator + this.loader = Boolean(f.loader); + + /*** validation - reset buttons/links ***/ + //show/hides filter's validation button + this.displayBtn = Boolean(f.btn); + //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 = Boolean(f.btn_reset); + //defines css class for reset button + this.btnResetCssClass = f.btn_reset_css_class || 'reset'; + //callback function before filters are cleared + this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null; + //callback function after filters are cleared + this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null; + + /*** paging ***/ + //enables/disables table paging + this.paging = Boolean(f.paging); + this.nbVisibleRows = 0; //nb visible rows + this.nbHiddenRows = 0; //nb hidden rows + + /*** autofilter on typing ***/ + //enables/disables auto filtering, table is filtered when user stops + //typing + this.autoFilter = Boolean(f.auto_filter); + //onkeyup delay timer (msecs) + this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900; + //typing indicator + this.isUserTyping = null; + this.autoFilterTimer = null; + + /*** keyword highlighting ***/ + //enables/disables keyword highlighting + this.highlightKeywords = Boolean(f.highlight_keywords); + + /*** No results feature ***/ + this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message); + + /*** 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 = _types2.default.isArray(f.col_number_format); + //array containing columns nb formats + this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null; + //enables date type per column + this.hasColDateType = _types2.default.isArray(f.col_date_type); + //array containing columns date type + this.colDateType = this.hasColDateType ? f.col_date_type : null; + + /*** 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_'; + //filter values cookie + this.prfxCookieFltsValues = 'tf_flts_'; + //page nb cookie + this.prfxCookiePageNb = 'tf_pgnb_'; + //page length cookie + this.prfxCookiePageLen = 'tf_pglen_'; + + /*** cookies ***/ + this.hasStoredValues = false; + //remembers filters values on page load + this.rememberGridValues = Boolean(f.remember_grid_values); + //cookie storing filter values + this.fltsValuesCookie = this.prfxCookieFltsValues + this.id; + //remembers page nb on page load + this.rememberPageNb = this.paging && f.remember_page_number; + //cookie storing page nb + this.pgNbCookie = this.prfxCookiePageNb + this.id; + //remembers page length on page load + this.rememberPageLen = this.paging && f.remember_page_length; + //cookie storing page length + this.pgLenCookie = this.prfxCookiePageLen + this.id; + + /*** extensions ***/ + //imports external script + this.extensions = f.extensions; + this.hasExtensions = _types2.default.isArray(this.extensions); + + /*** themes ***/ + this.enableDefaultTheme = Boolean(f.enable_default_theme); + //imports themes + this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes); + this.themes = f.themes || []; + //themes path + this.themesPath = f.themes_path || this.stylePath + 'themes/'; + + // Features registry + this.Mod = {}; + + // Extensions registry + this.ExtRegistry = {}; + + /*** TF events ***/ + this.Evt = { + // Detect key + + detectKey: function detectKey(e) { + if (!this.enterKey) { + return; + } + if (e) { + var key = _event2.default.keyCode(e); + if (key === 13) { + this.filter(); + _event2.default.cancel(e); + _event2.default.stop(e); + } else { + this.isUserTyping = true; + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + } + }, + + // if auto-filter on, detect user is typing and filter columns + onKeyUp: function onKeyUp(e) { + if (!this.autoFilter) { + return; + } + var key = _event2.default.keyCode(e); + this.isUserTyping = false; + + function filter() { + /*jshint validthis:true */ + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + if (!this.isUserTyping) { + this.filter(); + this.isUserTyping = null; + } + } + + if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) { + if (this.autoFilterTimer === null) { + this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay); + } + } else { + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + }, + + // if auto-filter on, detect user is typing + onKeyDown: function onKeyDown() { + if (!this.autoFilter) { + return; + } + this.isUserTyping = true; + }, + + // if auto-filter on, clear interval on filter blur + onInpBlur: function onInpBlur() { + if (this.autoFilter) { + this.isUserTyping = false; + global.clearInterval(this.autoFilterTimer); + } + this.emitter.emit('filter-blur', this); + }, + + // set focused text-box filter as active + onInpFocus: function onInpFocus(e) { + var elm = _event2.default.target(e); + this.activeFilterId = elm.getAttribute('id'); + this.activeFlt = _dom2.default.id(this.activeFilterId); + if (this.popupFilters) { + _event2.default.cancel(e); + _event2.default.stop(e); + } + this.emitter.emit('filter-focus', this); + }, + + // set focused drop-down filter as active + // onSlcFocus(e) { + // let elm = Event.target(e); + // this.activeFilterId = elm.getAttribute('id'); + // this.activeFlt = Dom.id(this.activeFilterId); + // // select is populated when element has focus + // if(this.loadFltOnDemand && elm.getAttribute('filled')==='0'){ + // let ct = elm.getAttribute('ct'); + // console.log('onSlcFocus'); + // this.Mod.dropdown.build(ct); + // } + // if(this.popupFilters){ + // Event.cancel(e); + // Event.stop(e); + // } + // this.emitter.emit('filter-focus', this); + // }, + // filter columns on drop-down filter change + onSlcChange: function onSlcChange(e) { + if (!this.activeFlt) { + return; + } + if (this.popupFilters) { + _event2.default.stop(e); + } + if (this.onSlcChange) { + this.filter(); + } + } + }; + } + + /** + * Initialise filtering grid bar behaviours and layout + * + * TODO: decompose in smaller methods + */ + + _createClass(TableFilter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this._hasGrid) { + return; + } + + var Mod = this.Mod; + var n = this.singleSearchFlt ? 1 : this.nbCells, + inpclass = undefined; + + //loads stylesheet if not imported + this.import(this.stylesheetId, this.stylesheet, null, 'link'); + + //loads theme + if (this.hasThemes) { + this.loadThemes(); + } + + if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { + Mod.store = new _store.Store(this); + Mod.store.init(); + } + + if (this.gridLayout) { + Mod.gridLayout = new _gridLayout.GridLayout(this); + Mod.gridLayout.init(); + } + + if (this.loader) { + if (!Mod.loader) { + Mod.loader = new _loader.Loader(this); + } + Mod.loader.init(); + } + + if (this.highlightKeywords) { + Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this); + Mod.highlightKeyword.init(); + } + + if (this.popupFilters) { + if (!Mod.popupFilter) { + Mod.popupFilter = new _popupFilter.PopupFilter(this); + } + Mod.popupFilter.init(); + } + + //filters grid is not generated + if (!this.fltGrid) { + this._initNoFilters(); + } else { + if (this.isFirstLoad) { + var fltrow = this._insertFiltersRow(); + + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.tbl.rows.length; + + // Generate filters + for (var i = 0; i < n; i++) { + this.emitter.emit('before-filter-init', this, i); + + var fltcell = _dom2.default.create(this.fltCellTag), + col = this.getFilterType(i); + + if (this.singleSearchFlt) { + fltcell.colSpan = this.nbCells; + } + if (!this.gridLayout) { + fltrow.appendChild(fltcell); + } + inpclass = i == n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass; + + //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 (!Mod.dropdown) { + Mod.dropdown = new _dropdown.Dropdown(this); + } + Mod.dropdown.init(i, this.isExternalFlt, fltcell); + } + // checklist + else if (col === this.fltTypeCheckList) { + if (!Mod.checkList) { + Mod.checkList = new _checkList.CheckList(this); + } + Mod.checkList.init(i, this.isExternalFlt, fltcell); + } else { + this._buildInputFilter(i, inpclass, fltcell); + } + + // this adds submit button + if (i == n - 1 && this.displayBtn) { + this._buildSubmitButton(i, fltcell); + } + + this.emitter.emit('after-filter-init', this, i); + } // for i + } else { + this._resetGrid(); + } //if isFirstLoad + } //if this.fltGrid + + /* Features */ + if (this.hasVisibleRows) { + this.emitter.on(['after-filtering'], function () { + return _this2.enforceVisibility(); + }); + this.enforceVisibility(); + } + if (this.rowsCounter) { + Mod.rowsCounter = new _rowsCounter.RowsCounter(this); + Mod.rowsCounter.init(); + } + if (this.statusBar) { + Mod.statusBar = new _statusBar.StatusBar(this); + Mod.statusBar.init(); + } + if (this.paging || Mod.paging) { + if (!Mod.paging) { + Mod.paging = new _paging.Paging(this); + Mod.paging.init(); + } + Mod.paging.reset(); + } + if (this.btnReset) { + Mod.clearButton = new _clearButton.ClearButton(this); + Mod.clearButton.init(); + } + if (this.help) { + if (!Mod.help) { + Mod.help = new _help.Help(this); + } + Mod.help.init(); + } + if (this.hasColWidths && !this.gridLayout) { + this.setColWidths(); + } + if (this.alternateRows) { + Mod.alternateRows = new _alternateRows.AlternateRows(this); + Mod.alternateRows.init(); + } + if (this.noResults) { + if (!Mod.noResults) { + Mod.noResults = new _noResults.NoResults(this); + } + Mod.noResults.init(); + } + + 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) { + _dom2.default.addClass(this.tbl, this.prfxTf); + } + + /* Loads extensions */ + if (this.hasExtensions) { + this.initExtensions(); + } + + // Subscribe to events + if (this.markActiveColumns) { + this.emitter.on(['before-filtering'], function () { + return _this2.clearActiveColumns(); + }); + this.emitter.on(['cell-processed'], function (tf, colIndex) { + return _this2.markActiveColumn(colIndex); + }); + } + if (this.linkedFilters) { + this.emitter.on(['after-filtering'], function () { + return _this2.linkFilters(); + }); + } + + if (this.onFiltersLoaded) { + this.onFiltersLoaded.call(null, this); + } + + this.emitter.emit('initialized', this); + } + + /** + * Insert filters row at initialization + */ + + }, { + key: '_insertFiltersRow', + value: function _insertFiltersRow() { + if (this.gridLayout) { + return; + } + var fltrow = undefined; + + var thead = _dom2.default.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.headersRow++; + } + + fltrow.className = this.fltsRowCssClass; + + if (this.isExternalFlt) { + fltrow.style.display = 'none'; + } + + this.emitter.emit('filters-row-inserted', this, fltrow); + return fltrow; + } + + /** + * Initialize filtersless table + */ + + }, { + key: '_initNoFilters', + value: function _initNoFilters() { + if (this.fltGrid) { + return; + } + this.refRow = this.refRow > 0 ? this.refRow - 1 : 0; + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.nbFilterableRows + this.refRow; + } + + /** + * Build input filter type + * @param {Number} colIndex Column index + * @param {String} cssClass Css class applied to filter + * @param {DOMElement} container Container DOM element + */ + + }, { + key: '_buildInputFilter', + value: function _buildInputFilter(colIndex, cssClass, container) { + var col = this.getFilterType(colIndex); + var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; + var inptype = col === this.fltTypeInp ? 'text' : 'hidden'; + var inp = _dom2.default.create(this.fltTypeInp, ['id', this.prfxFlt + colIndex + '_' + this.id], ['type', inptype], ['ct', colIndex]); + + if (inptype !== 'hidden' && this.watermark) { + inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark); + } + inp.className = cssClass || this.fltCssClass; + _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this)); + + //filter is appended in custom element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(inp); + this.externalFltEls.push(inp); + } else { + container.appendChild(inp); + } + + this.fltIds.push(inp.id); + + _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this)); + _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this)); + _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this)); + _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this)); + } + + /** + * Build submit button + * @param {Number} colIndex Column index + * @param {DOMElement} container Container DOM element + */ + + }, { + key: '_buildSubmitButton', + value: function _buildSubmitButton(colIndex, container) { + var _this3 = this; + + var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; + var btn = _dom2.default.create(this.fltTypeInp, ['id', this.prfxValButton + colIndex + '_' + this.id], ['type', 'button'], ['value', this.btnText]); + btn.className = this.btnCssClass; + + //filter is appended in custom element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(btn); + } else { + container.appendChild(btn); + } + + _event2.default.add(btn, 'click', function () { + return _this3.filter(); + }); + } + + /** + * Return a feature instance for a given name + * @param {String} name Name of the feature + * @return {Object} + */ + + }, { + key: 'feature', + value: function feature(name) { + return this.Mod[name]; + } + + /** + * Initialise all the extensions defined in the configuration object + */ + + }, { + key: 'initExtensions', + value: function initExtensions() { + var exts = this.extensions; + // Set config's publicPath dynamically for Webpack... + __webpack_require__.p = this.basePath; + + this.emitter.emit('before-loading-extensions', this); + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + if (!this.ExtRegistry[ext.name]) { + this.loadExtension(ext); + } + } + this.emitter.emit('after-loading-extensions', this); + } + + /** + * Load an extension module + * @param {Object} ext Extension config object + */ + + }, { + key: 'loadExtension', + value: function loadExtension(ext) { + var _this4 = this; + + if (!ext || !ext.name) { + return; + } + + var name = ext.name; + var path = ext.path; + var modulePath = undefined; + + if (name && path) { + modulePath = ext.path + name; + } else { + name = name.replace('.js', ''); + modulePath = 'extensions/{}/{}'.replace(/{}/g, name); + } + + // Require pattern for Webpack + __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) { + var inst = new mod.default(_this4, ext); + inst.init(); + _this4.ExtRegistry[name] = inst; + }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}); + } + + /** + * Get an extension instance + * @param {String} name Name of the extension + * @return {Object} Extension instance + */ + + }, { + key: 'extension', + value: function extension(name) { + return this.ExtRegistry[name]; + } + + /** + * Check passed extension name exists + * @param {String} name Name of the extension + * @return {Boolean} + */ + + }, { + key: 'hasExtension', + value: function hasExtension(name) { + return !_types2.default.isEmpty(this.ExtRegistry[name]); + } + + /** + * Destroy all the extensions defined in the configuration object + */ + + }, { + key: 'destroyExtensions', + value: function destroyExtensions() { + var exts = this.extensions; + + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + var extInstance = this.ExtRegistry[ext.name]; + if (extInstance) { + extInstance.destroy(); + this.ExtRegistry[ext.name] = null; + } + } + } + + /** + * Load themes defined in the configuration object + */ + + }, { + key: 'loadThemes', + value: function loadThemes() { + var themes = this.themes; + this.emitter.emit('before-loading-themes', this); + + //Default theme config + if (this.enableDefaultTheme) { + var defaultTheme = { name: 'default' }; + this.themes.push(defaultTheme); + } + if (_types2.default.isArray(themes)) { + for (var i = 0, len = themes.length; i < len; i++) { + var theme = themes[i]; + var name = theme.name; + var path = theme.path; + var styleId = this.prfxTf + name; + if (name && !path) { + path = this.themesPath + name + '/' + name + '.css'; + } else if (!name && theme.path) { + name = 'theme{0}'.replace('{0}', i); + } + + if (!this.isImported(path, 'link')) { + this.import(styleId, path, null, 'link'); + } + } + } + + //Some elements need to be overriden for default 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; + + this.emitter.emit('after-loading-themes', this); + } + + /** + * Return stylesheet DOM element for a given theme name + * @return {DOMElement} stylesheet element + */ + + }, { + key: 'getStylesheet', + value: function getStylesheet() { + var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; + + return _dom2.default.id(this.prfxTf + name); + } + + /** + * Destroy filter grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this5 = this; + + if (!this._hasGrid) { + return; + } + var rows = this.tbl.rows, + Mod = this.Mod; + + if (this.isExternalFlt && !this.popupFilters) { + this.removeExternalFlts(); + } + if (this.infDiv) { + this.removeToolbar(); + } + if (this.highlightKeywords) { + Mod.highlightKeyword.unhighlightAll(); + } + if (this.markActiveColumns) { + this.clearActiveColumns(); + this.emitter.off(['before-filtering'], function () { + return _this5.clearActiveColumns(); + }); + this.emitter.off(['cell-processed'], function (tf, colIndex) { + return _this5.markActiveColumn(colIndex); + }); + } + if (this.hasExtensions) { + this.destroyExtensions(); + } + + for (var j = this.refRow; j < this.nbRows; j++) { + // validate row + this.validateRow(j, true); + + //removes alternating colors + if (this.alternateRows) { + Mod.alternateRows.removeRowBg(j); + } + } //for j + + if (this.fltGrid && !this.gridLayout) { + this.fltGridEl = rows[this.filtersRowIndex]; + this.tbl.deleteRow(this.filtersRowIndex); + } + + // Destroy modules + Object.keys(Mod).forEach(function (key) { + var feature = Mod[key]; + if (feature && _types2.default.isFn(feature.destroy)) { + feature.destroy(); + } + }); + + // unsubscribe to events + if (this.hasVisibleRows) { + this.emitter.off(['after-filtering'], function () { + return _this5.enforceVisibility(); + }); + } + if (this.linkedFilters) { + this.emitter.off(['after-filtering'], function () { + return _this5.linkFilters(); + }); + } + + _dom2.default.removeClass(this.tbl, this.prfxTf); + this.nbHiddenRows = 0; + this.validRowsIndex = []; + this.activeFlt = null; + this._hasGrid = false; + } + + /** + * Generate container element for paging, reset button, rows counter etc. + */ + + }, { + key: 'setToolbar', + value: function setToolbar() { + if (this.infDiv) { + return; + } + + /*** container div ***/ + var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); + infdiv.className = this.infDivCssClass; + + //custom container + if (this.toolBarTgtId) { + _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); + } + //grid-layout + else if (this.gridLayout) { + var gridLayout = this.Mod.gridLayout; + gridLayout.tblMainCont.appendChild(infdiv); + infdiv.className = gridLayout.gridInfDivCssClass; + } + //default location: just above the table + else { + var cont = _dom2.default.create('caption'); + cont.appendChild(infdiv); + this.tbl.insertBefore(cont, this.tbl.firstChild); + } + this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); + + /*** left div containing rows # displayer ***/ + var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); + ldiv.className = this.lDivCssClass; + infdiv.appendChild(ldiv); + this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); + + /*** right div containing reset button + + nb results per page select ***/ + var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); + rdiv.className = this.rDivCssClass; + infdiv.appendChild(rdiv); + this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); + + /*** mid div containing paging elements ***/ + var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); + mdiv.className = this.mDivCssClass; + infdiv.appendChild(mdiv); + this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); + + // Enable help instructions by default if topbar is generated and not + // explicitely set to false + if (_types2.default.isUndef(this.help)) { + if (!this.Mod.help) { + this.Mod.help = new _help.Help(this); + } + this.Mod.help.init(); + this.help = true; + } + } + + /** + * Remove toolbar container element + */ + + }, { + key: 'removeToolbar', + value: function removeToolbar() { + if (!this.infDiv) { + return; + } + _dom2.default.remove(this.infDiv); + this.infDiv = null; + + var tbl = this.tbl; + var captions = _dom2.default.tag(tbl, 'caption'); + if (captions.length > 0) { + [].forEach.call(captions, function (elm) { + tbl.removeChild(elm); + }); + } + } + + /** + * Remove all the external column filters + */ + + }, { + key: 'removeExternalFlts', + value: function removeExternalFlts() { + if (!this.isExternalFlt) { + return; + } + var ids = this.externalFltTgtIds, + len = ids.length; + for (var ct = 0; ct < len; ct++) { + var externalFltTgtId = ids[ct], + externalFlt = _dom2.default.id(externalFltTgtId); + if (externalFlt) { + externalFlt.innerHTML = ''; + } + } + } + + /** + * Check if given column implements a filter with custom options + * @param {Number} colIndex Column's index + * @return {Boolean} + */ + + }, { + key: 'isCustomOptions', + value: function isCustomOptions(colIndex) { + return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; + } + + /** + * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the + * custom options values and texts + * @param {Number} colIndex Column's index + * @return {Array} + */ + + }, { + key: 'getCustomOptions', + value: function getCustomOptions(colIndex) { + if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { + return; + } + + var customOptions = this.customOptions; + var cols = customOptions.cols; + var optTxt = [], + optArray = []; + var index = cols.indexOf(colIndex); + var slcValues = customOptions.values[index]; + var slcTexts = customOptions.texts[index]; + var slcSort = customOptions.sorts[index]; + + for (var r = 0, len = slcValues.length; r < len; r++) { + optArray.push(slcValues[r]); + if (slcTexts[r]) { + optTxt.push(slcTexts[r]); + } else { + optTxt.push(slcValues[r]); + } + } + if (slcSort) { + optArray.sort(); + optTxt.sort(); + } + return [optArray, optTxt]; + } + + /** + * Reset persisted filter values + */ + + }, { + key: 'resetValues', + value: function resetValues() { + var _this6 = this; + + //only loadFltOnDemand + if (this.rememberGridValues) { + if (this.loadFltOnDemand) { + this._resetGridValues(this.fltsValuesCookie); + } else { + var fltValues = this.Mod.store.getFilterValues(this.fltsValuesCookie); + fltValues.forEach(function (val, idx) { + if (val !== ' ') { + _this6.setFilterValue(idx, val); + } + }); + } + } + this.filter(); + } + + /** + * Reset persisted filter values when load filters on demand feature is + * enabled + * @param {String} name cookie name storing filter values + */ + + }, { + key: '_resetGridValues', + value: function _resetGridValues(name) { + if (!this.loadFltOnDemand) { + return; + } + var fltsValues = this.Mod.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 = undefined, + opt = undefined; + var fltType = this.getFilterType(i); + // if loadFltOnDemand, drop-down needs to contain stored + // value(s) for filtering + if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { + var slc = _dom2.default.id(this.fltIds[i]); + slc.options[0].selected = false; + + //selects + if (slcFltsIndex.indexOf(i) != -1) { + opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + //multiple select + if (multiFltsIndex.indexOf(i) != -1) { + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + opt = _dom2.default.createOpt(s[j], s[j], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + } // if multiFltsIndex + } else if (fltType === this.fltTypeCheckList) { + var checkList = this.Mod.checkList; + var divChk = checkList.checkListDiv[i]; + divChk.title = divChk.innerHTML; + divChk.innerHTML = ''; + + var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); + ul.className = checkList.checkListCssClass; + + var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); + li0.className = checkList.checkListItemCssClass; + ul.appendChild(li0); + + divChk.appendChild(ul); + + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + var li = _dom2.default.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; + } + } else if (fltType === this.fltTypeInp) { + this.setFilterValue(i, fltsValues[i]); + } + } //end for + + if (!this.hasStoredValues && this.paging) { + this.Mod.paging.setPagingInfo(); + } + } //end if + } + + /** + * Filter the table by retrieving the data from each cell in every single + * row and comparing it to the search term for current column. A row is + * hidden when all the search terms are not found in inspected row. + * + * TODO: Reduce complexity of this massive method + */ + + }, { + key: 'filter', + value: function filter() { + if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { + return; + } + //invoke onbefore callback + if (this.onBeforeFilter) { + this.onBeforeFilter.call(null, this); + } + this.emitter.emit('before-filtering', this); + + var row = this.tbl.rows, + Mod = this.Mod, + hiddenrows = 0; + + this.validRowsIndex = []; + // search args re-init + this.searchArgs = this.getFiltersValue(); + + var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); + + //keyword highlighting + function highlight(str, ok, cell) { + /*jshint validthis:true */ + if (this.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 = _dom2.default.getText(cell); + } + if (w !== '') { + Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); + } + } + } + + //looks for search argument in current row + function hasArg(sA, cellData, j) { + /*jshint validthis:true */ + var occurence = undefined, + removeNbFormat = _helpers2.default.removeNbFormat; + + //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); + var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); + var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); + var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); + var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); + var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); + + var dte1 = undefined, + dte2 = undefined; + //dates + if (_date2.default.isValid(cellData, dtType)) { + dte1 = _date2.default.format(cellData, dtType); + // lower date + if (isLDate) { + dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); + occurence = dte1 < dte2; + } + // lower equal date + else if (isLEDate) { + dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); + occurence = dte1 <= dte2; + } + // greater equal date + else if (isGEDate) { + dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); + occurence = dte1 >= dte2; + } + // greater date + else if (isGDate) { + dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); + occurence = dte1 > dte2; + } + // different date + else if (isDFDate) { + dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); + occurence = dte1.toString() != dte2.toString(); + } + // equal date + else if (isEQDate) { + dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } else if (_date2.default.isValid(sA, dtType)) { + dte2 = _date2.default.format(sA, dtType); + occurence = dte1.toString() === dte2.toString(); + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } else { + //first numbers need to be formated + if (this.hasColNbFormat && this.colNbFormat[j]) { + numCellData = removeNbFormat(cellData, this.colNbFormat[j]); + nbFormat = this.colNbFormat[j]; + } else { + if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { + numCellData = removeNbFormat(cellData, 'us'); + nbFormat = 'us'; + } else { + numCellData = removeNbFormat(cellData, 'eu'); + nbFormat = 'eu'; + } + } + + // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, + // rgx:) + // lower equal + if (hasLE) { + occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); + } + //greater equal + else if (hasGE) { + occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); + } + //lower + else if (hasLO) { + occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); + } + //greater + else if (hasGR) { + occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); + } + //different + else if (hasDF) { + occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; + } + //like + else if (hasLK) { + occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } + //equal + else if (hasEQ) { + occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); + } + //starts with + else if (hasST) { + occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; + } + //ends with + else if (hasEN) { + var searchArg = sA.replace(re_en, ''); + occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } + //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(cellData); + } catch (e) { + occurence = false; + } + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } //else + return occurence; + } //fn + + for (var k = this.refRow; k < this.nbRows; k++) { + /*** if table already filtered some rows are not visible ***/ + if (this.getRowDisplay(row[k]) === '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 = true, + + //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]; + var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; + if (sA === '') { + continue; + } + + var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); + + //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 = undefined, + occur = false, + s = hasMultiOrSA ? sAOrSplit : sAAndSplit; + for (var w = 0, len = s.length; w < len; w++) { + cS = _string2.default.trim(s[w]); + occur = hasArg.call(this, cS, cellData, j); + highlight.call(this, cS, occur, cell[j]); + if (hasMultiOrSA && occur) { + break; + } + if (hasMultiAndSA && !occur) { + break; + } + } + occurence[j] = occur; + } + //single search parameter + else { + occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); + highlight.call(this, sA, occurence[j], cell[j]); + } //else single param + + if (!occurence[j]) { + isRowValid = false; + } + if (this.singleSearchFlt && occurence[j]) { + singleFltRowValid = true; + } + + this.emitter.emit('cell-processed', this, j, cell[j]); + } //for j + + if (this.singleSearchFlt && singleFltRowValid) { + isRowValid = true; + } + + if (!isRowValid) { + this.validateRow(k, false); + hiddenrows++; + } else { + this.validateRow(k, true); + } + + this.emitter.emit('row-processed', this, k, this.validRowsIndex.length, isRowValid); + } // for k + + this.nbVisibleRows = this.validRowsIndex.length; + this.nbHiddenRows = hiddenrows; + + //invokes onafterfilter callback + if (this.onAfterFilter) { + this.onAfterFilter.call(null, this); + } + + this.emitter.emit('after-filtering', this); + } + + /** + * Return the data of a specified colum + * @param {Number} colIndex Column index + * @param {Boolean} includeHeaders Optional: include headers row + * @param {Boolean} num Optional: return unformatted number + * @param {Array} exclude Optional: list of row indexes to be excluded + * @return {Array} Flat list of data for a column + */ + + }, { + key: 'getColValues', + value: function getColValues(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; + + if (!this.fltGrid) { + return; + } + var row = this.tbl.rows, + colValues = []; + + if (includeHeaders) { + colValues.push(this.getHeadersText()[colIndex]); + } + + for (var i = this.refRow; i < this.nbRows; i++) { + var isExludedRow = false; + // checks if current row index appears in exclude array + if (exclude.length > 0) { + isExludedRow = exclude.indexOf(i) != -1; + } + 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 !== '') { + continue; + } + var cellData = this.getCellData(cell[j]), + nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, + data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; + colValues.push(data); + } + } + } + return colValues; + } + + /** + * Return the filter's value of a specified column + * @param {Number} index Column index + * @return {String} Filter value + */ + + }, { + key: 'getFilterValue', + value: function getFilterValue(index) { + if (!this.fltGrid) { + return; + } + var fltValue = undefined, + flt = this.getFilterElement(index); + if (!flt) { + return ''; + } + + var fltColType = this.getFilterType(index); + if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { + fltValue = flt.value; + } + //mutiple select + else if (fltColType === this.fltTypeMulti) { + fltValue = ''; + for (var j = 0, len = flt.options.length; j < len; 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; + } + + /** + * Return the filters' values + * @return {Array} List of filters' values + */ + + }, { + key: 'getFiltersValue', + value: function getFiltersValue() { + if (!this.fltGrid) { + return; + } + var searchArgs = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); + } + return searchArgs; + } + + /** + * Return the ID of the filter of a specified column + * @param {Number} index Column's index + * @return {String} ID of the filter element + */ + + }, { + key: 'getFilterId', + value: function getFilterId(index) { + if (!this.fltGrid) { + return; + } + return this.fltIds[index]; + } + + /** + * Return the list of ids of filters matching a specified type. + * Note: hidden filters are also returned + * + * @param {String} type Filter type string ('input', 'select', 'multiple', + * 'checklist') + * @param {Boolean} bool If true returns columns indexes instead of IDs + * @return {[type]} List of element IDs or column indexes + */ + + }, { + key: 'getFiltersByType', + value: function getFiltersByType(type, bool) { + if (!this.fltGrid) { + return; + } + var arr = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + var fltType = this.getFilterType(i); + if (fltType === _string2.default.lower(type)) { + var a = bool ? i : this.fltIds[i]; + arr.push(a); + } + } + return arr; + } + + /** + * Return the filter's DOM element for a given column + * @param {Number} index Column's index + * @return {DOMElement} + */ + + }, { + key: 'getFilterElement', + value: function getFilterElement(index) { + var fltId = this.fltIds[index]; + return _dom2.default.id(fltId); + } + + /** + * Return the number of cells for a given row index + * @param {Number} rowIndex Index of the row + * @return {Number} Number of cells + */ + + }, { + key: 'getCellsNb', + value: function getCellsNb() { + var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; + + var tr = this.tbl.rows[rowIndex]; + return tr.cells.length; + } + + /** + * Return the number of filterable rows starting from reference row if + * defined + * @param {Boolean} includeHeaders Include the headers row + * @return {Number} Number of filterable rows + */ + + }, { + key: 'getRowsNb', + value: function getRowsNb(includeHeaders) { + var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, + ntrs = this.tbl.rows.length; + if (includeHeaders) { + s = 0; + } + return parseInt(ntrs - s, 10); + } + + /** + * Return the data of a given cell + * @param {DOMElement} cell Cell's DOM object + * @return {String} + */ + + }, { + key: 'getCellData', + value: function getCellData(cell) { + var idx = cell.cellIndex; + //Check for customCellData callback + if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { + return this.customCellData.call(null, this, cell, idx); + } else { + return _dom2.default.getText(cell); + } + } + + /** + * Return the table data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getTableData', + value: function getTableData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + + var rows = this.tbl.rows; + var tblData = []; + if (includeHeaders) { + var headers = this.getHeadersText(excludeHiddenCols); + tblData.push([this.getHeadersRowIndex(), headers]); + } + for (var k = this.refRow; k < this.nbRows; k++) { + var rowData = [k, []]; + var cells = rows[k].cells; + for (var j = 0, len = cells.length; j < len; j++) { + if (excludeHiddenCols && this.hasExtension('colsVisibility')) { + if (this.extension('colsVisibility').isColHidden(j)) { + continue; + } + } + var cellData = this.getCellData(cells[j]); + rowData[1].push(cellData); + } + tblData.push(rowData); + } + return tblData; + } + + /** + * Return the filtered data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredData', + value: function getFilteredData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + + if (!this.validRowsIndex) { + return []; + } + var rows = this.tbl.rows, + filteredData = []; + if (includeHeaders) { + var headers = this.getHeadersText(excludeHiddenCols); + filteredData.push([this.getHeadersRowIndex(), headers]); + } + + var validRows = this.getValidRows(true); + for (var i = 0; i < validRows.length; i++) { + var rData = [this.validRowsIndex[i], []], + cells = rows[this.validRowsIndex[i]].cells; + for (var k = 0; k < cells.length; k++) { + if (excludeHiddenCols && this.hasExtension('colsVisibility')) { + if (this.extension('colsVisibility').isColHidden(k)) { + continue; + } + } + var cellData = this.getCellData(cells[k]); + rData[1].push(cellData); + } + filteredData.push(rData); + } + return filteredData; + } + + /** + * Return the filtered data for a given column index + * @param {Number} colIndex Colmun's index + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} Flat list of values ['val0','val1','val2'...] + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredDataCol', + value: function getFilteredDataCol(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + + if (_types2.default.isUndef(colIndex)) { + return []; + } + var data = this.getFilteredData(), + colData = []; + if (includeHeaders) { + colData.push(this.getHeadersText()[colIndex]); + } + for (var i = 0, len = data.length; i < len; 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; + } + + /** + * Get the display value of a row + * @param {RowElement} DOM element of the row + * @return {String} Usually 'none' or '' + */ + + }, { + key: 'getRowDisplay', + value: function getRowDisplay(row) { + if (!_types2.default.isObj(row)) { + return null; + } + return row.style.display; + } + + /** + * Validate/invalidate row by setting the 'validRow' attribute on the row + * @param {Number} rowIndex Index of the row + * @param {Boolean} isValid + */ + + }, { + key: 'validateRow', + value: function validateRow(rowIndex, isValid) { + var row = this.tbl.rows[rowIndex]; + if (!row || typeof isValid !== 'boolean') { + return; + } + + // always visible rows are valid + if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { + isValid = true; + } + + var displayFlag = isValid ? '' : 'none', + validFlag = isValid ? 'true' : 'false'; + row.style.display = displayFlag; + + if (this.paging) { + row.setAttribute('validRow', validFlag); + } + + if (isValid) { + if (this.validRowsIndex.indexOf(rowIndex) === -1) { + this.validRowsIndex.push(rowIndex); + } + + if (this.onRowValidated) { + this.onRowValidated.call(null, this, rowIndex); + } + + this.emitter.emit('row-validated', this, rowIndex); + } + } + + /** + * Validate all filterable rows + */ + + }, { + key: 'validateAllRows', + value: function validateAllRows() { + if (!this._hasGrid) { + return; + } + this.validRowsIndex = []; + for (var k = this.refRow; k < this.nbFilterableRows; k++) { + this.validateRow(k, true); + } + } + + /** + * Set search value to a given filter + * @param {Number} index Column's index + * @param {String} searcharg Search term + */ + + }, { + key: 'setFilterValue', + value: function setFilterValue(index) { + var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; + + if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { + return; + } + var slc = this.getFilterElement(index), + fltColType = this.getFilterType(index); + + if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { + slc.value = searcharg; + } + //multiple selects + else if (fltColType === this.fltTypeMulti) { + var s = searcharg.split(' ' + this.orOperator + ' '); + // let ct = 0; //keywords counter + for (var j = 0, len = slc.options.length; j < len; j++) { + var option = slc.options[j]; + if (s === '' || s[0] === '') { + option.selected = false; + } + if (option.value === '') { + option.selected = false; + } + if (option.value !== '' && _array2.default.has(s, option.value, true)) { + option.selected = true; + } //if + } //for j + } + //checklist + else if (fltColType === this.fltTypeCheckList) { + searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); + var sarg = searcharg.split(' ' + this.orOperator + ' '); + var lisNb = _dom2.default.tag(slc, 'li').length; + + slc.setAttribute('value', ''); + slc.setAttribute('indexes', ''); + + for (var k = 0; k < lisNb; k++) { + var li = _dom2.default.tag(slc, 'li')[k], + lbl = _dom2.default.tag(li, 'label')[0], + chk = _dom2.default.tag(li, 'input')[0], + lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); + if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { + chk.checked = true; + this.Mod.checkList.setCheckListValues(chk); + } else { + chk.checked = false; + this.Mod.checkList.setCheckListValues(chk); + } + } + } + } + + /** + * Set them columns' widths as per configuration + * @param {Number} rowIndex Optional row index to apply the widths to + * @param {Element} tbl DOM element + */ + + }, { + key: 'setColWidths', + value: function setColWidths(rowIndex, tbl) { + if (!this.fltGrid || !this.hasColWidths) { + return; + } + tbl = tbl || this.tbl; + var rIndex = undefined; + if (rowIndex === undefined) { + rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; + } else { + rIndex = rowIndex; + } + + setWidths.call(this); + + function setWidths() { + /*jshint validthis:true */ + var nbCols = this.nbCells; + var colWidths = this.colWidths; + var colTags = _dom2.default.tag(tbl, 'col'); + var tblHasColTag = colTags.length > 0; + var frag = !tblHasColTag ? doc.createDocumentFragment() : null; + for (var k = 0; k < nbCols; k++) { + var col = undefined; + if (tblHasColTag) { + col = colTags[k]; + } else { + col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); + frag.appendChild(col); + } + col.style.width = colWidths[k]; + } + if (!tblHasColTag) { + tbl.insertBefore(frag, tbl.firstChild); + } + } + } + + /** + * Makes defined rows always visible + */ + + }, { + key: 'enforceVisibility', + value: function enforceVisibility() { + if (!this.hasVisibleRows) { + return; + } + for (var i = 0, len = this.visibleRows.length; i < len; i++) { + var row = this.visibleRows[i]; + //row index cannot be > nrows + if (row <= this.nbRows) { + this.validateRow(row, true); + } + } + } + + /** + * Clear all the filters' values + */ + + }, { + key: 'clearFilters', + value: function clearFilters() { + if (!this.fltGrid) { + return; + } + + this.emitter.emit('before-clearing-filters', this); + + if (this.onBeforeReset) { + this.onBeforeReset.call(null, this, this.getFiltersValue()); + } + for (var i = 0, len = this.fltIds.length; i < len; i++) { + this.setFilterValue(i, ''); + } + // if(this.linkedFilters){ + // this.linkFilters(); + // } + if (this.rememberPageLen) { + _cookie2.default.remove(this.pgLenCookie); + } + if (this.rememberPageNb) { + _cookie2.default.remove(this.pgNbCookie); + } + if (this.onAfterReset) { + this.onAfterReset.call(null, this); + } + + this.filter(); + + this.emitter.emit('after-clearing-filters', this); + } + + /** + * Clears filtered columns visual indicator (background color) + */ + + }, { + key: 'clearActiveColumns', + value: function clearActiveColumns() { + for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { + _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); + } + } + + /** + * Mark currently filtered column + * @param {Number} colIndex Column index + */ + + }, { + key: 'markActiveColumn', + value: function markActiveColumn(colIndex) { + var header = this.getHeaderElement(colIndex); + if (_dom2.default.hasClass(header, this.activeColumnsCssClass)) { + return; + } + if (this.onBeforeActiveColumn) { + this.onBeforeActiveColumn.call(null, this, colIndex); + } + _dom2.default.addClass(header, this.activeColumnsCssClass); + if (this.onAfterActiveColumn) { + this.onAfterActiveColumn.call(null, this, colIndex); + } + } + + /** + * Refresh the filters subject to linking ('select', 'multiple', + * 'checklist' type) + */ + + }, { + key: 'linkFilters', + value: function linkFilters() { + if (!this.linkedFilters || !this.activeFilterId) { + return; + } + 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); + + var activeFlt = this.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(this.prfxFlt)[1]; + var slcSelectedValue = undefined; + for (var i = 0, len = slcIndex.length; i < len; i++) { + var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); + slcSelectedValue = this.getFilterValue(slcIndex[i]); + + // Welcome to cyclomatic complexity hell :) + // TODO: simplify/refactor if statement + if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; + } else { + curSlc.innerHTML = ''; + } + + //1st option needs to be inserted + if (this.loadFltOnDemand) { + var opt0 = _dom2.default.createOpt(this.displayAllText, ''); + if (curSlc) { + curSlc.appendChild(opt0); + } + } + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList.build(slcIndex[i]); + } else { + this.Mod.dropdown.build(slcIndex[i], true); + } + + this.setFilterValue(slcIndex[i], slcSelectedValue); + } + } // for i + } + + /** + * Re-generate the filters grid bar when previously removed + */ + + }, { + key: '_resetGrid', + value: function _resetGrid() { + if (this.isFirstLoad) { + return; + } + + var Mod = this.Mod; + var tbl = this.tbl; + var rows = tbl.rows; + var filtersRowIndex = this.filtersRowIndex; + var filtersRow = rows[filtersRowIndex]; + + // grid was removed, grid row element is stored in fltGridEl property + if (!this.gridLayout) { + // If table has a thead ensure the filters row is appended in the + // thead element + if (tbl.tHead) { + var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); + tbl.tHead.replaceChild(this.fltGridEl, tempRow); + } else { + filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); + } + + _dom2.default.addClass(tbl, this.prfxTf); + } + + // filters are appended in external placeholders elements + if (this.isExternalFlt) { + var externalFltTgtIds = this.externalFltTgtIds; + for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { + var extFlt = _dom2.default.id(externalFltTgtIds[ct]); + + if (!extFlt) { + continue; + } + + var externalFltEl = this.externalFltEls[ct]; + extFlt.appendChild(externalFltEl); + var colFltType = this.getFilterType(ct); + //IE special treatment for gridLayout, appended filters are + //empty + if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { + if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { + Mod.dropdown.build(ct); + } + if (colFltType === this.fltTypeCheckList) { + Mod.checkList.build(ct); + } + } + } + } + + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = rows.length; + + if (this.popupFilters) { + this.headersRow++; + Mod.popupFilter.reset(); + } + + this._hasGrid = true; + } + + /** + * Determines if passed filter column implements exact query match + * @param {Number} colIndex [description] + * @return {Boolean} [description] + */ + + }, { + key: 'isExactMatch', + value: function isExactMatch(colIndex) { + var fltType = this.getFilterType(colIndex); + return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; + } + + /** + * Check if passed script or stylesheet is already imported + * @param {String} filePath Ressource path + * @param {String} type Possible values: 'script' or 'link' + * @return {Boolean} + */ + + }, { + key: 'isImported', + value: function isImported(filePath, type) { + var imported = false, + importType = !type ? 'script' : type, + attr = importType == 'script' ? 'src' : 'href', + files = _dom2.default.tag(doc, importType); + for (var i = 0, len = files.length; i < len; i++) { + if (files[i][attr] === undefined) { + continue; + } + if (files[i][attr].match(filePath)) { + imported = true; + break; + } + } + return imported; + } + + /** + * Import script or stylesheet + * @param {String} fileId Ressource ID + * @param {String} filePath Ressource path + * @param {Function} callback Callback + * @param {String} type Possible values: 'script' or 'link' + */ + + }, { + key: 'import', + value: function _import(fileId, filePath, callback, type) { + var ftype = !type ? 'script' : type, + imported = this.isImported(filePath, ftype); + if (imported) { + return; + } + var o = this, + isLoaded = false, + file = undefined, + head = _dom2.default.tag(doc, 'head')[0]; + + if (_string2.default.lower(ftype) === 'link') { + file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); + } else { + file = _dom2.default.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: ' + filePath); + }; + head.appendChild(file); + } + + /** + * Check if table has filters grid + * @return {Boolean} + */ + + }, { + key: 'hasGrid', + value: function hasGrid() { + return this._hasGrid; + } + + /** + * Get list of filter IDs + * @return {[type]} [description] + */ + + }, { + key: 'getFiltersId', + value: function getFiltersId() { + return this.fltIds || []; + } + + /** + * Get filtered (valid) rows indexes + * @param {Boolean} reCalc Force calculation of filtered rows list + * @return {Array} List of row indexes + */ + + }, { + key: 'getValidRows', + value: function getValidRows(reCalc) { + 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; + } + + /** + * Get the index of the row containing the filters + * @return {Number} + */ + + }, { + key: 'getFiltersRowIndex', + value: function getFiltersRowIndex() { + return this.filtersRowIndex; + } + + /** + * Get the index of the headers row + * @return {Number} + */ + + }, { + key: 'getHeadersRowIndex', + value: function getHeadersRowIndex() { + return this.headersRow; + } + + /** + * Get the row index from where the filtering process start (1st filterable + * row) + * @return {Number} + */ + + }, { + key: 'getStartRowIndex', + value: function getStartRowIndex() { + return this.refRow; + } + + /** + * Get the index of the last row + * @return {Number} + */ + + }, { + key: 'getLastRowIndex', + value: function getLastRowIndex() { + if (!this._hasGrid) { + return; + } + return this.nbRows - 1; + } + + /** + * Get the header DOM element for a given column index + * @param {Number} colIndex Column index + * @return {Object} + */ + + }, { + key: 'getHeaderElement', + value: function getHeaderElement(colIndex) { + var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; + var tHead = _dom2.default.tag(table, 'thead'); + var headersRow = this.headersRow; + var header = undefined; + for (var i = 0; i < this.nbCells; i++) { + if (i !== colIndex) { + continue; + } + if (tHead.length === 0) { + header = table.rows[headersRow].cells[i]; + } + if (tHead.length === 1) { + header = tHead[0].rows[headersRow].cells[i]; + } + break; + } + return header; + } + + /** + * Return the list of headers' text + * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns + * @return {Array} list of headers' text + */ + + }, { + key: 'getHeadersText', + value: function getHeadersText() { + var excludeHiddenCols = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var headers = []; + for (var j = 0; j < this.nbCells; j++) { + if (excludeHiddenCols && this.hasExtension('colsVisibility')) { + if (this.extension('colsVisibility').isColHidden(j)) { + continue; + } + } + var header = this.getHeaderElement(j); + var headerText = _dom2.default.getText(header); + headers.push(headerText); + } + return headers; + } + + /** + * Return the filter type for a specified column + * @param {Number} colIndex Column's index + * @return {String} + */ + + }, { + key: 'getFilterType', + value: function getFilterType(colIndex) { + var colType = this.cfg['col_' + colIndex]; + return !colType ? this.fltTypeInp : _string2.default.lower(colType); + } + + /** + * Get the total number of filterable rows + * @return {Number} + */ + + }, { + key: 'getFilterableRowsNb', + value: function getFilterableRowsNb() { + return this.getRowsNb(false); + } + + /** + * Get the configuration object (literal object) + * @return {Object} + */ + + }, { + key: 'config', + value: function config() { + return this.cfg; + } + }]); + + return TableFilter; + })(); + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * DOM event utilities + */ + + exports.default = { + 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; + } + }, + target: function target(evt) { + return evt && evt.target || window.event && window.event.srcElement; + }, + keyCode: function keyCode(evt) { + return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; + } + }; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * DOM utilities + */ + + exports.default = { + + /** + * Returns text + text of children of given node + * @param {NodeElement} node + * @return {String} + */ + + getText: function getText(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 + */ + create: function create(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]); + } + } + } + return el; + }, + + /** + * Removes passed node from DOM + * @param {DOMElement} node + * @return {DOMElement} old node reference + */ + remove: function remove(node) { + return node.parentNode.removeChild(node); + }, + + /** + * Returns a text node with given text + * @param {String} txt + * @return {Object} + */ + text: function text(txt) { + return document.createTextNode(txt); + }, + hasClass: function hasClass(ele, cls) { + if (!ele) { + return false; + } + + if (supportsClassList()) { + return ele.classList.contains(cls); + } + return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); + }, + addClass: function addClass(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; + } + }, + removeClass: function removeClass(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 + */ + createOpt: function createOpt(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 + */ + createCheckItem: function createCheckItem(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; + }, + id: function id(key) { + return document.getElementById(key); + }, + tag: function tag(o, tagname) { + return o.getElementsByTagName(tagname); + } + }; + + // HTML5 classList API + + function supportsClassList() { + return document.documentElement.classList; + } + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * String utilities + */ + + exports.default = { + lower: function lower(text) { + return text.toLowerCase(); + }, + upper: function upper(text) { + return text.toUpperCase(); + }, + trim: function trim(text) { + if (text.trim) { + return text.trim(); + } + return text.replace(/^\s*|\s*$/g, ''); + }, + isEmpty: function isEmpty(text) { + return this.trim(text) === ''; + }, + rgxEsc: function rgxEsc(text) { + var chars = /[-\/\\^$*+?.()|[\]{}]/g; + var escMatch = '\\$&'; + return String(text).replace(chars, escMatch); + }, + matchCase: function matchCase(text, caseSensitive) { + if (!caseSensitive) { + return this.lower(text); + } + return text; + }, + + /** + * Checks if passed data contains the searched term + * @param {String} term Searched term + * @param {String} data Data string + * @param {Boolean} exactMatch Exact match + * @param {Boolean} caseSensitive Case sensitive + * @return {Boolean} + */ + contains: function contains(term, data) { + var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; + + // Improved by Cedric Wartel (cwl) automatic exact match for selects and + // special characters are now filtered + var regexp = undefined, + modifier = caseSensitive ? 'g' : 'gi'; + if (exactMatch) { + regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); + } else { + regexp = new RegExp(this.rgxEsc(term), modifier); + } + return regexp.test(data); + } + }; + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Cookie utilities + */ + + exports.default = { + write: function write(name, value, hours) { + var expire = ''; + if (hours) { + expire = new Date(new Date().getTime() + hours * 3600000); + expire = '; expires=' + expire.toGMTString(); + } + document.cookie = name + '=' + escape(value) + expire; + }, + read: function read(name) { + var cookieValue = '', + search = name + '='; + if (document.cookie.length > 0) { + var cookie = document.cookie, + offset = cookie.indexOf(search); + if (offset !== -1) { + offset += search.length; + var end = cookie.indexOf(';', offset); + if (end === -1) { + end = cookie.length; + } + cookieValue = unescape(cookie.substring(offset, end)); + } + } + return cookieValue; + }, + remove: function remove(name) { + this.write(name, '', -1); + }, + valueToArray: function valueToArray(name, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.read(name); + //creates an array with filters' values + var arr = val.split(separator); + return arr; + }, + getValueByIndex: function getValueByIndex(name, index, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.valueToArray(name, separator); + return val[index]; + } + }; + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * Types utilities + */ + + var UNDEFINED = void 0; + + exports.default = { + /** + * Check if argument is an object or a global object + * @param {String or Object} v + * @return {Boolean} + */ + + isObj: function isObj(v) { + var isO = false; + if (typeof v === 'string') { + if (window[v] && _typeof(window[v]) === 'object') { + isO = true; + } + } else { + if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { + isO = true; + } + } + return isO; + }, + + /** + * Check if argument is a function + * @param {Function} fn + * @return {Boolean} + */ + isFn: function isFn(fn) { + return fn && fn.constructor == Function; + }, + + /** + * Check if argument is an array + * @param {Array} obj + * @return {Boolean} + */ + isArray: function isArray(obj) { + return obj && obj.constructor == Array; + }, + + /** + * Determine if argument is undefined + * @param {Any} o + * @return {Boolean} + */ + isUndef: function isUndef(o) { + return o === UNDEFINED; + }, + + /** + * Determine if argument is null + * @param {Any} o + * @return {Boolean} + */ + isNull: function isNull(o) { + return o === null; + }, + + /** + * Determine if argument is empty (undefined, null or empty string) + * @param {Any} o + * @return {Boolean} + */ + isEmpty: function isEmpty(o) { + return this.isUndef(o) || this.isNull(o) || o.length === 0; + } + }; + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + has: function has(arr, val, caseSensitive) { + var sCase = caseSensitive === undefined ? false : caseSensitive; + for (var i = 0; i < arr.length; i++) { + if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { + return true; + } + } + return false; + } + }; /** + * Array utilities + */ + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Date utilities + */ + + exports.default = { + 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 = undefined, + reg2 = undefined; + // 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 = undefined, + dd = undefined, + yy = undefined; + // 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(dateStr, formatStr) { + if (!formatStr) { + formatStr = 'DMY'; + } + if (!dateStr || dateStr === '') { + return new Date(1001, 0, 1); + } + var oDate = undefined; + var parts = undefined; + + switch (formatStr.toUpperCase()) { + case 'DDMMMYYYY': + parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); + oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); + break; + case 'DMY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'MDY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'YMD': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + default: + //in case format is not correct + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + } + return oDate; + } + }; + + function y2kDate(yr) { + if (yr === undefined) { + return 0; + } + if (yr.length > 2) { + return yr; + } + var y = undefined; + //>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; + } + + function mmm2mm(mmm) { + if (mmm === undefined) { + return 0; + } + var mondigit = undefined; + 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; + } + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + removeNbFormat: function removeNbFormat(data, format) { + if (!data) { + return; + } + if (!format) { + format = 'us'; + } + var n = data; + if (_string2.default.lower(format) === 'us') { + n = +n.replace(/[^\d\.-]/g, ''); + } else { + n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); + } + return n; + } + }; /** + * Misc helpers + */ + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + "use strict"; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Event emitter class + */ + + var Emitter = exports.Emitter = (function () { + function Emitter() { + _classCallCheck(this, Emitter); + + /** + * Events object + * @type {Object} + */ + this.events = {}; + } + + /** + * Subscribe to an event + * @param {Array} evts Collection of event names + * @param {Function} fn Function invoked when event is emitted + */ + + _createClass(Emitter, [{ + key: "on", + value: function on(evts, fn) { + var _this = this; + + evts.forEach(function (evt) { + _this.events[evt] = _this.events[evt] || []; + _this.events[evt].push(fn); + }); + } + + /** + * Unsubscribe to an event + * @param {Array} evts Collection of event names + * @param {Function} fn Function invoked when event is emitted + */ + + }, { + key: "off", + value: function off(evts, fn) { + var _this2 = this; + + evts.forEach(function (evt) { + if (evt in _this2.events) { + _this2.events[evt].splice(_this2.events[evt].indexOf(fn), 1); + } + }); + } + + /** + * Emit an event + * @param {String} evt Event name followed by any other argument passed to + * the invoked function + */ + + }, { + key: "emit", + value: function emit(evt /*, args...*/) { + if (evt in this.events) { + for (var i = 0; i < this.events[evt].length; i++) { + this.events[evt][i].apply(this, [].slice.call(arguments, 1)); + } + } + } + }]); + + return Emitter; + })(); + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Store = undefined; + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Store = exports.Store = (function () { + + /** + * Store, persistence manager + * @param {Object} tf TableFilter instance + * + * TODO: use localStorage and fallback to cookie persistence + */ + + function Store(tf) { + _classCallCheck(this, Store); + + var f = tf.config(); + + this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(Store, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on(['after-filtering'], function () { + return _this.saveFilterValues(_this.tf.fltsValuesCookie); + }); + } + + /** + * Store filters' values in cookie + * @param {String} cookie name + */ + + }, { + key: 'saveFilterValues', + value: function saveFilterValues(name) { + var tf = this.tf; + var fltValues = []; + + if (!tf.rememberGridValues) { + return; + } + + //store filters' values + for (var i = 0; i < tf.fltIds.length; i++) { + var value = tf.getFilterValue(i); + if (value === '') { + value = ' '; + } + fltValues.push(value); + } + //adds array size + fltValues.push(tf.fltIds.length); + + //writes cookie + _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); + } + + /** + * Retrieve filters' values from cookie + * @param {String} cookie name + * @return {Array} + */ + + }, { + key: 'getFilterValues', + value: function getFilterValues(name) { + var flts = _cookie2.default.read(name); + var rgx = new RegExp(this.tf.separator, 'g'); + // filters' values array + return flts.split(rgx); + } + + /** + * Store page number in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageNb', + value: function savePageNb(name) { + if (!this.tf.rememberPageNb) { + return; + } + _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); + } + + /** + * Retrieve page number from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageNb', + value: function getPageNb(name) { + return _cookie2.default.read(name); + } + + /** + * Store page length in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageLength', + value: function savePageLength(name) { + if (!this.tf.rememberPageLen) { + return; + } + _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); + } + + /** + * Retrieve page length from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageLength', + value: function getPageLength(name) { + return _cookie2.default.read(name); + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off(['after-filtering'], function () { + return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); + }); + } + }]); + + return Store; + })(); + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.GridLayout = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var GridLayout = exports.GridLayout = (function (_Feature) { + _inherits(GridLayout, _Feature); + + /** + * Grid layout, table with fixed headers + * @param {Object} tf TableFilter instance + */ + + function GridLayout(tf) { + _classCallCheck(this, GridLayout); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); + + var f = _this.config; + + //defines grid width + _this.gridWidth = f.grid_width || null; + //defines grid height + _this.gridHeight = f.grid_height || null; + //defines css class for main container + _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; + //defines css class for div containing table + _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; + //defines css class for div containing headers' table + _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; + //defines css class for div containing rows counter, paging etc. + _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; + //defines which row contains column headers + _this.gridHeadRowIndex = f.grid_headers_row_index || 0; + //array of headers row indexes to be placed in header table + _this.gridHeadRows = f.grid_headers_rows || [0]; + //generate filters in table headers + _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; + //default col width + _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; + + _this.gridColElms = []; + + //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_'; + + _this.sourceTblHtml = tf.tbl.outerHTML; + return _this; + } + + /** + * Generates a grid with fixed headers + */ + + _createClass(GridLayout, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + var f = this.config; + var tbl = tf.tbl; + + if (this.initialized) { + return; + } + + // Override reference rows indexes + tf.refRow = _types2.default.isNull(tf.startRow) ? 0 : tf.startRow; + tf.headersRow = 0; + tf.filtersRowIndex = 1; + + tf.isExternalFlt = true; + + // default width of 100px if column widths not set + if (!tf.hasColWidths) { + tf.colWidths = []; + for (var k = 0; k < tf.nbCells; k++) { + var colW = undefined, + cell = tbl.rows[this.gridHeadRowIndex].cells[k]; + if (cell.width !== '') { + colW = cell.width; + } else if (cell.style.width !== '') { + colW = parseInt(cell.style.width, 10); + } else { + colW = this.gridDefaultColWidth; + } + tf.colWidths[k] = colW; + } + tf.hasColWidths = true; + } + tf.setColWidths(this.gridHeadRowIndex); + + var tblW = undefined; //initial table width + if (tbl.width !== '') { + tblW = tbl.width; + } else if (tbl.style.width !== '') { + tblW = parseInt(tbl.style.width, 10); + } else { + tblW = tbl.clientWidth; + } + + //Main container: it will contain all the elements + this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); + this.tblMainCont.className = this.gridMainContCssClass; + if (this.gridWidth) { + this.tblMainCont.style.width = this.gridWidth; + } + tbl.parentNode.insertBefore(this.tblMainCont, tbl); + + //Table container: div wrapping content table + this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); + this.tblCont.className = this.gridContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.tblCont.style.width = '100%'; + } else { + this.tblCont.style.width = this.gridWidth; + } + } + if (this.gridHeight) { + this.tblCont.style.height = this.gridHeight; + } + tbl.parentNode.insertBefore(this.tblCont, tbl); + var t = _dom2.default.remove(tbl); + this.tblCont.appendChild(t); + + //In case table width is expressed in % + if (tbl.style.width === '') { + tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; + } + + var d = _dom2.default.remove(this.tblCont); + this.tblMainCont.appendChild(d); + + //Headers table container: div wrapping headers table + this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); + this.headTblCont.className = this.gridHeadContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.headTblCont.style.width = '100%'; + } else { + this.headTblCont.style.width = this.gridWidth; + } + } + + //Headers table + this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); + var tH = _dom2.default.create('tHead'); + + //1st row should be headers row, ids are added if not set + //Those ids are used by the sort feature + var hRow = tbl.rows[this.gridHeadRowIndex]; + var sortTriggers = []; + for (var n = 0; n < tf.nbCells; n++) { + var c = hRow.cells[n]; + var thId = c.getAttribute('id'); + if (!thId || thId === '') { + thId = this.prfxGridTh + n + '_' + tf.id; + c.setAttribute('id', thId); + } + sortTriggers.push(thId); + } + + //Filters row is created + var filtersRow = _dom2.default.create('tr'); + if (this.gridEnableFilters && tf.fltGrid) { + tf.externalFltTgtIds = []; + for (var j = 0; j < tf.nbCells; j++) { + var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; + var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); + filtersRow.appendChild(cl); + tf.externalFltTgtIds[j] = fltTdId; + } + } + //Headers row are moved from content table to headers table + for (var i = 0; i < this.gridHeadRows.length; i++) { + var headRow = tbl.rows[this.gridHeadRows[0]]; + tH.appendChild(headRow); + } + this.headTbl.appendChild(tH); + if (tf.filtersRowIndex === 0) { + tH.insertBefore(filtersRow, hRow); + } else { + tH.appendChild(filtersRow); + } + + this.headTblCont.appendChild(this.headTbl); + this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); + + //THead needs to be removed in content table for sort feature + var thead = _dom2.default.tag(tbl, 'thead'); + if (thead.length > 0) { + tbl.removeChild(thead[0]); + } + + //Headers table style + this.headTbl.style.tableLayout = 'fixed'; + tbl.style.tableLayout = 'fixed'; + this.headTbl.cellPadding = tbl.cellPadding; + this.headTbl.cellSpacing = tbl.cellSpacing; + // this.headTbl.style.width = tbl.style.width; + + //content table without headers needs col widths to be reset + tf.setColWidths(0, this.headTbl); + + //Headers container width + // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; + + tbl.style.width = ''; + // + this.headTbl.style.width = tbl.clientWidth + 'px'; + // + + //scroll synchronisation + _event2.default.add(this.tblCont, 'scroll', function (evt) { + var elm = _event2.default.target(evt); + var scrollLeft = elm.scrollLeft; + _this2.headTblCont.scrollLeft = scrollLeft; + //New pointerX calc taking into account scrollLeft + // if(!o.isPointerXOverwritten){ + // try{ + // o.Evt.pointerX = function(evt){ + // let e = evt || global.event; + // let bdScrollLeft = tf_StandardBody().scrollLeft + + // scrollLeft; + // return (e.pageX + scrollLeft) || + // (e.clientX + bdScrollLeft); + // }; + // o.isPointerXOverwritten = true; + // } catch(err) { + // o.isPointerXOverwritten = false; + // } + // } + }); + + //Configure sort extension if any + var sort = (f.extensions || []).filter(function (itm) { + return itm.name === 'sort'; + }); + if (sort.length === 1) { + sort[0].async_sort = true; + sort[0].trigger_ids = sortTriggers; + } + + //Cols generation for all browsers excepted IE<=7 + this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; + + //Col elements are enough to keep column widths after sorting and + //filtering + var createColTags = function createColTags() { + for (var k = tf.nbCells - 1; k >= 0; k--) { + var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); + tbl.insertBefore(col, tbl.firstChild); + col.style.width = tf.colWidths[k]; + this.gridColElms[k] = col; + } + this.tblHasColTag = true; + }; + + if (!this.tblHasColTag) { + createColTags.call(this); + } else { + var cols = _dom2.default.tag(tbl, 'col'); + for (var ii = 0; ii < tf.nbCells; ii++) { + cols[ii].setAttribute('id', tf.id + '_col_' + ii); + cols[ii].style.width = tf.colWidths[ii]; + this.gridColElms.push(cols[ii]); + } + } + + var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; + f.on_after_col_resized = function (o, colIndex) { + if (!colIndex) { + return; + } + var w = o.crWColsRow.cells[colIndex].style.width; + var col = o.gridColElms[colIndex]; + col.style.width = w; + + var thCW = o.crWColsRow.cells[colIndex].clientWidth; + var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; + + if (thCW != tdCW) { + o.headTbl.style.width = tbl.clientWidth + 'px'; + } + + if (afterColResizedFn) { + afterColResizedFn.call(null, o, colIndex); + } + }; + + if (tf.popupFilters) { + filtersRow.style.display = 'none'; + } + + if (tbl.clientWidth !== this.headTbl.clientWidth) { + tbl.style.width = this.headTbl.clientWidth + 'px'; + } + + this.initialized = true; + } + + /** + * Removes the grid layout + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + var tbl = tf.tbl; + + if (!this.initialized) { + return; + } + var t = _dom2.default.remove(tbl); + this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); + _dom2.default.remove(this.tblMainCont); + + this.tblMainCont = null; + this.headTblCont = null; + this.headTbl = null; + this.tblCont = null; + + tbl.outerHTML = this.sourceTblHtml; + //needed to keep reference of table element for future usage + this.tf.tbl = t; + + this.initialized = false; + } + }]); + + return GridLayout; + })(_feature.Feature); + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var NOTIMPLEMENTED = 'Not implemented.'; + + var Feature = exports.Feature = (function () { + function Feature(tf, feature) { + _classCallCheck(this, Feature); + + this.tf = tf; + this.feature = feature; + this.enabled = tf[feature]; + this.config = tf.config(); + this.emitter = tf.emitter; + this.initialized = false; + } + + _createClass(Feature, [{ + key: 'init', + value: function init() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + } + }, { + key: 'destroy', + value: function destroy() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'enable', + value: function enable() { + this.enabled = true; + } + }, { + key: 'disable', + value: function disable() { + this.enabled = false; + } + }, { + key: 'isEnabled', + value: function isEnabled() { + return this.enabled; + } + }]); + + return Feature; + })(); + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Loader = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var Loader = exports.Loader = (function (_Feature) { + _inherits(Loader, _Feature); + + /** + * Loading message/spinner + * @param {Object} tf TableFilter instance + */ + + function Loader(tf) { + _classCallCheck(this, Loader); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); + + var f = _this.config; + + //id of container element + _this.loaderTgtId = f.loader_target_id || null; + //div containing loader + _this.loaderDiv = null; + //defines loader text + _this.loaderText = f.loader_text || 'Loading...'; + //defines loader innerHtml + _this.loaderHtml = f.loader_html || null; + //defines css class for loader div + _this.loaderCssClass = f.loader_css_class || 'loader'; + //delay for hiding loader + _this.loaderCloseDelay = 250; + //callback function before loader is displayed + _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; + //callback function after loader is closed + _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; + //loader div + _this.prfxLoader = 'load_'; + return _this; + } + + _createClass(Loader, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + var emitter = this.emitter; + + var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); + containerDiv.className = this.loaderCssClass; + + var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); + if (!this.loaderTgtId) { + targetEl.insertBefore(containerDiv, tf.tbl); + } else { + targetEl.appendChild(containerDiv); + } + this.loaderDiv = containerDiv; + if (!this.loaderHtml) { + this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); + } else { + this.loaderDiv.innerHTML = this.loaderHtml; + } + + this.show('none'); + + // Subscribe to events + emitter.on(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { + return _this2.show(''); + }); + emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this2.show('none'); + }); + + this.initialized = true; + } + }, { + key: 'show', + value: function show(p) { + var _this3 = this; + + if (!this.isEnabled() /*|| this.loaderDiv.style.display === p*/) { + return; + } + + var displayLoader = function displayLoader() { + if (!_this3.loaderDiv) { + return; + } + if (_this3.onShowLoader && p !== 'none') { + _this3.onShowLoader.call(null, _this3); + } + _this3.loaderDiv.style.display = p; + if (_this3.onHideLoader && p === 'none') { + _this3.onHideLoader.call(null, _this3); + } + }; + + var t = p === 'none' ? this.loaderCloseDelay : 1; + global.setTimeout(displayLoader, t); + } + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + if (!this.initialized) { + return; + } + + var emitter = this.emitter; + + _dom2.default.remove(this.loaderDiv); + this.loaderDiv = null; + + // Unsubscribe to events + emitter.off(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { + return _this4.show(''); + }); + emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this4.show('none'); + }); + + this.initialized = false; + } + }]); + + return Loader; + })(_feature.Feature); + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.HighlightKeyword = undefined; + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var HighlightKeyword = exports.HighlightKeyword = (function () { + + /** + * HighlightKeyword, highlight matched keyword + * @param {Object} tf TableFilter instance + */ + + function HighlightKeyword(tf) { + _classCallCheck(this, HighlightKeyword); + + var f = tf.config(); + //defines css class for highlighting + this.highlightCssClass = f.highlight_css_class || 'keyword'; + this.highlightedNodes = []; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(HighlightKeyword, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on(['before-filtering'], function () { + return _this.unhighlightAll(); + }); + } + + /** + * highlight occurences of searched term in passed node + * @param {Node} node + * @param {String} word Searched term + * @param {String} cssClass Css class name + */ + + }, { + key: 'highlight', + value: function highlight(node, word, cssClass) { + // Iterate into this nodes childNodes + if (node.hasChildNodes) { + var children = node.childNodes; + for (var i = 0; i < children.length; i++) { + this.highlight(children[i], word, cssClass); + } + } + + if (node.nodeType === 3) { + var tempNodeVal = _string2.default.lower(node.nodeValue); + var tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) != -1) { + var pn = node.parentNode; + if (pn && pn.className != cssClass) { + // word not highlighted yet + var nv = node.nodeValue, + ni = tempNodeVal.indexOf(tempWordVal), + + // Create a load of replacement nodes + before = _dom2.default.text(nv.substr(0, ni)), + docWordVal = nv.substr(ni, word.length), + after = _dom2.default.text(nv.substr(ni + word.length)), + hiwordtext = _dom2.default.text(docWordVal), + hiword = _dom2.default.create('span'); + hiword.className = cssClass; + hiword.appendChild(hiwordtext); + pn.insertBefore(before, node); + pn.insertBefore(hiword, node); + pn.insertBefore(after, node); + pn.removeChild(node); + this.highlightedNodes.push(hiword.firstChild); + } + } + } + } + + /** + * Removes highlight to nodes matching passed string + * @param {String} word + * @param {String} cssClass Css class to remove + */ + + }, { + key: 'unhighlight', + value: function unhighlight(word, cssClass) { + var arrRemove = []; + var highlightedNodes = this.highlightedNodes; + for (var i = 0; i < highlightedNodes.length; i++) { + var n = highlightedNodes[i]; + if (!n) { + continue; + } + var tempNodeVal = _string2.default.lower(n.nodeValue), + tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) !== -1) { + var pn = n.parentNode; + if (pn && pn.className === cssClass) { + var prevSib = pn.previousSibling, + nextSib = pn.nextSibling; + if (!prevSib || !nextSib) { + continue; + } + nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; + prevSib.nodeValue = ''; + n.nodeValue = ''; + arrRemove.push(i); + } + } + } + for (var k = 0; k < arrRemove.length; k++) { + highlightedNodes.splice(arrRemove[k], 1); + } + } + + /** + * Clear all occurrences of highlighted nodes + */ + + }, { + key: 'unhighlightAll', + value: function unhighlightAll() { + if (!this.tf.highlightKeywords || !this.tf.searchArgs) { + return; + } + for (var y = 0; y < this.tf.searchArgs.length; y++) { + this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); + } + this.highlightedNodes = []; + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off(['before-filtering'], function () { + return _this2.unhighlightAll(); + }); + } + }]); + + return HighlightKeyword; + })(); + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.PopupFilter = undefined; + + var _feature = __webpack_require__(12); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var PopupFilter = exports.PopupFilter = (function (_Feature) { + _inherits(PopupFilter, _Feature); + + /** + * Pop-up filter component + * @param {Object} tf TableFilter instance + */ + + function PopupFilter(tf) { + _classCallCheck(this, PopupFilter); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); + + var f = _this.config; + + // Enable external filters + tf.isExternalFlt = true; + tf.externalFltTgtIds = []; + + //filter icon path + _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; + //active filter icon path + _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; + _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; + //defines css class for popup div containing filter + _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; + //callback function before popup filtes is opened + _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; + //callback function after popup filtes is opened + _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; + //callback function before popup filtes is closed + _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; + //callback function after popup filtes is closed + _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; + + //stores filters spans + _this.popUpFltSpans = []; + //stores filters icons + _this.popUpFltImgs = []; + //stores filters containers + _this.popUpFltElms = _this.popUpFltElmCache || []; + _this.popUpFltAdjustToContainer = true; + + //id prefix for pop-up filter span + _this.prfxPopUpSpan = 'popUpSpan_'; + //id prefix for pop-up div containing filter + _this.prfxPopUpDiv = 'popUpDiv_'; + return _this; + } + + _createClass(PopupFilter, [{ + key: 'onClick', + value: function onClick(e) { + var evt = e || global.event, + elm = evt.target.parentNode, + colIndex = parseInt(elm.getAttribute('ci'), 10); + + this.closeAll(colIndex); + this.toggle(colIndex); + + if (this.popUpFltAdjustToContainer) { + var popUpDiv = this.popUpFltElms[colIndex], + header = this.tf.getHeaderElement(colIndex), + headerWidth = header.clientWidth * 0.95; + popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; + } + _event2.default.cancel(evt); + _event2.default.stop(evt); + } + + /** + * Initialize DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + // Override headers row index if no grouped headers + if (tf.headersRow <= 1) { + tf.headersRow = 0; + } + + for (var i = 0; i < tf.nbCells; i++) { + if (tf.getFilterType(i) === tf.fltTypeNone) { + continue; + } + var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); + popUpSpan.innerHTML = this.popUpImgFltHtml; + var header = tf.getHeaderElement(i); + header.appendChild(popUpSpan); + _event2.default.add(popUpSpan, 'click', function (evt) { + _this2.onClick(evt); + }); + this.popUpFltSpans[i] = popUpSpan; + this.popUpFltImgs[i] = popUpSpan.firstChild; + } + + // subscribe to events + this.emitter.on(['before-filtering'], function () { + return _this2.buildIcons(); + }); + this.emitter.on(['after-filtering'], function () { + return _this2.closeAll(); + }); + this.emitter.on(['cell-processed'], function (tf, cellIndex) { + return _this2.buildIcon(cellIndex, true); + }); + this.emitter.on(['filters-row-inserted'], function () { + return _this2.tf.headersRow++; + }); + this.emitter.on(['before-filter-init'], function (tf, colIndex) { + return _this2.build(colIndex); + }); + + this.initialized = true; + } + + /** + * Reset previously destroyed feature + */ + + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + this.buildAll(); + } + + /** + * Build all pop-up filters elements + */ + + }, { + key: 'buildAll', + value: function buildAll() { + for (var i = 0; i < this.popUpFltElmCache.length; i++) { + this.build(i, this.popUpFltElmCache[i]); + } + } + + /** + * Build a specified pop-up filter elements + * @param {Number} colIndex Column index + * @param {Object} div Optional container DOM element + */ + + }, { + key: 'build', + value: function build(colIndex, div) { + var tf = this.tf; + var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; + popUpDiv.className = this.popUpDivCssClass; + tf.externalFltTgtIds.push(popUpDiv.id); + var header = tf.getHeaderElement(colIndex); + header.insertBefore(popUpDiv, header.firstChild); + _event2.default.add(popUpDiv, 'click', function (evt) { + _event2.default.stop(evt); + }); + this.popUpFltElms[colIndex] = popUpDiv; + } + + /** + * Toogle visibility of specified filter + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggle', + value: function toggle(colIndex) { + var tf = this.tf, + popUpFltElm = this.popUpFltElms[colIndex]; + + if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { + if (this.onBeforePopUpOpen) { + this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'block'; + if (tf.getFilterType(colIndex) === tf.fltTypeInp) { + var flt = tf.getFilterElement(colIndex); + if (flt) { + flt.focus(); + } + } + if (this.onAfterPopUpOpen) { + this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } else { + if (this.onBeforePopUpClose) { + this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'none'; + if (this.onAfterPopUpClose) { + this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } + } + + /** + * Close all filters excepted for the specified one if any + * @param {Number} exceptIdx Column index of the filter to not close + */ + + }, { + key: 'closeAll', + value: function closeAll(exceptIdx) { + for (var i = 0; i < this.popUpFltElms.length; i++) { + if (i === exceptIdx) { + continue; + } + var popUpFltElm = this.popUpFltElms[i]; + if (popUpFltElm) { + popUpFltElm.style.display = 'none'; + } + } + } + + /** + * Build all the icons representing the pop-up filters + */ + + }, { + key: 'buildIcons', + value: function buildIcons() { + for (var i = 0; i < this.popUpFltImgs.length; i++) { + this.buildIcon(i, false); + } + } + + /** + * Apply specified icon state + * @param {Number} colIndex Column index + * @param {Boolean} active Apply active state + */ + + }, { + key: 'buildIcon', + value: function buildIcon(colIndex, active) { + if (this.popUpFltImgs[colIndex]) { + this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; + } + } + + /** + * Remove pop-up filters + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + this.popUpFltElmCache = []; + for (var i = 0; i < this.popUpFltElms.length; i++) { + var popUpFltElm = this.popUpFltElms[i], + popUpFltSpan = this.popUpFltSpans[i], + popUpFltImg = this.popUpFltImgs[i]; + if (popUpFltElm) { + _dom2.default.remove(popUpFltElm); + this.popUpFltElmCache[i] = popUpFltElm; + } + popUpFltElm = null; + if (popUpFltSpan) { + _dom2.default.remove(popUpFltSpan); + } + popUpFltSpan = null; + if (popUpFltImg) { + _dom2.default.remove(popUpFltImg); + } + popUpFltImg = null; + } + this.popUpFltElms = []; + this.popUpFltSpans = []; + this.popUpFltImgs = []; + + // unsubscribe to events + this.emitter.off(['before-filtering'], function () { + return _this3.buildIcons(); + }); + this.emitter.off(['after-filtering'], function () { + return _this3.closeAll(); + }); + this.emitter.off(['cell-processed'], function (tf, cellIndex) { + return _this3.buildIcon(cellIndex, true); + }); + this.emitter.off(['filters-row-inserted'], function () { + return _this3.tf.headersRow++; + }); + this.emitter.off(['before-filter-init'], function (tf, colIndex) { + return _this3.build(colIndex); + }); + + this.initialized = false; + } + }]); + + return PopupFilter; + })(_feature.Feature); + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Dropdown = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Dropdown = exports.Dropdown = (function (_Feature) { + _inherits(Dropdown, _Feature); + + /** + * Dropdown UI component + * @param {Object} tf TableFilter instance + */ + + function Dropdown(tf) { + _classCallCheck(this, Dropdown); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Dropdown).call(this, tf, 'dropdown')); + + var f = tf.config(); + + _this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; + //defines empty option text + _this.nonEmptyText = f.non_empty_text || '(Non empty)'; + //sets select filling method: 'innerHTML' or 'createElement' + _this.slcFillingMethod = f.slc_filling_method || 'createElement'; + //IE only, tooltip text appearing on select before it is populated + _this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; + //tooltip text appearing on multiple select + _this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; + + _this.isCustom = null; + _this.opts = null; + _this.optsTxt = null; + _this.slcInnerHtml = null; + return _this; + } + + _createClass(Dropdown, [{ + key: 'onSlcFocus', + value: function onSlcFocus(e) { + var elm = _event2.default.target(e); + var tf = this.tf; + tf.activeFilterId = elm.getAttribute('id'); + tf.activeFlt = _dom2.default.id(tf.activeFilterId); + // select is populated when element has focus + if (tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + this.build(ct); + } + // if(tf.popupFilters){ + // Event.cancel(e); + // Event.stop(e); + // } + this.emitter.emit('filter-focus', tf, this); + } + + /** + * Initialize drop-down filter + * @param {Number} colIndex Column index + * @param {Boolean} isExternal External filter flag + * @param {DOMElement} container Dom element containing the filter + */ + + }, { + key: 'init', + value: function init(colIndex, isExternal, container) { + var _this2 = this; + + var tf = this.tf; + var col = tf.getFilterType(colIndex); + var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; + + var slc = _dom2.default.create(tf.fltTypeSlc, ['id', tf.prfxFlt + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); + + if (col === tf.fltTypeMulti) { + slc.multiple = tf.fltTypeMulti; + slc.title = this.multipleSlcTooltip; + } + slc.className = _string2.default.lower(col) === tf.fltTypeSlc ? tf.fltCssClass : tf.fltMultiCssClass; + + //filter is appended in container element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(slc); + tf.externalFltEls.push(slc); + } else { + container.appendChild(slc); + } + + tf.fltIds.push(slc.id); + + if (!tf.loadFltOnDemand) { + this.build(colIndex); + } else { + //1st option is created here since build isn't invoked + var opt0 = _dom2.default.createOpt(tf.displayAllText, ''); + slc.appendChild(opt0); + } + + _event2.default.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); + _event2.default.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); + _event2.default.add(slc, 'focus', function (e) { + return _this2.onSlcFocus(e); + }); + + this.initialized = true; + } + + /** + * Build drop-down filter UI + * @param {Number} colIndex Column index + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Boolean} isExternal Render in external container + * @param {String} extSlcId External container id + */ + + }, { + key: 'build', + value: function build(colIndex) { + var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.emitter.emit('before-populating-filter', tf, colIndex); + + this.opts = []; + this.optsTxt = []; + this.slcInnerHtml = ''; + + var slcId = tf.fltIds[colIndex]; + if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { + return; + } + var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), + rows = tf.tbl.rows, + matchCase = tf.matchCase; + + //custom select test + this.isCustom = tf.isCustomOptions(colIndex); + + //custom selects text + var activeFlt = undefined; + if (isLinked && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + var excludedOpts = null, + filteredDataCol = null; + if (isLinked && tf.disableExcludedOptions) { + excludedOpts = []; + filteredDataCol = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cell = rows[k].cells, + nchilds = cell.length; + + // checks if row has exact cell # + if (nchilds !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < nchilds; j++) { + // WTF: cyclomatic complexity hell + if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cell[j]), + + //Vary Peter's patch + cell_string = _string2.default.matchCase(cell_data, matchCase); + + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, matchCase)) { + this.opts.push(cell_data); + } + + if (isLinked && tf.disableExcludedOptions) { + var filteredCol = filteredDataCol[j]; + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { + excludedOpts.push(cell_data); + } + } + } //if colIndex==j + } //for j + } //for k + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (excludedOpts) { + excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + } + } + + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (excludedOpts) { + excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (excludedOpts) { + excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + //populates drop-down + this.addOptions(colIndex, slc, isLinked, excludedOpts); + + this.emitter.emit('after-populating-filter', tf, colIndex, slc); + } + + /** + * Add drop-down options + * @param {Number} colIndex Column index + * @param {Object} slc Select Dom element + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Array} excludedOpts Array of excluded options + * @param {Array} fltsValues Collection of persisted filter values + * @param {Array} fltArr Collection of persisted filter values + */ + + }, { + key: 'addOptions', + value: function addOptions(colIndex, slc, isLinked, excludedOpts /*, fltsValues, fltArr*/) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod), + slcValue = slc.value; + + slc.innerHTML = ''; + slc = this.addFirstOption(slc); + + for (var y = 0; y < this.opts.length; y++) { + if (this.opts[y] === '') { + continue; + } + var val = this.opts[y]; //option value + var lbl = this.isCustom ? this.optsTxt[y] : val; //option text + var isDisabled = false; + if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + isDisabled = true; + } + + if (fillMethod === 'innerhtml') { + var slcAttr = ''; + if (tf.loadFltOnDemand && slcValue === this.opts[y]) { + slcAttr = 'selected="selected"'; + } + this.slcInnerHtml += ''; + } else { + var opt = undefined; + //fill select on demand + if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { + opt = _dom2.default.createOpt(lbl, val, true); + } else { + opt = _dom2.default.createOpt(lbl, val, false); + } + if (isDisabled) { + opt.disabled = true; + } + slc.appendChild(opt); + } + } // for y + + if (fillMethod === 'innerhtml') { + slc.innerHTML += this.slcInnerHtml; + } + slc.setAttribute('filled', '1'); + } + + /** + * Add drop-down header option + * @param {Object} slc Select DOM element + */ + + }, { + key: 'addFirstOption', + value: function addFirstOption(slc) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod); + + if (fillMethod === 'innerhtml') { + this.slcInnerHtml += ''; + } else { + var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); + if (!this.enableSlcResetFilter) { + opt0.style.display = 'none'; + } + slc.appendChild(opt0); + if (tf.enableEmptyOption) { + var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); + slc.appendChild(opt1); + } + if (tf.enableNonEmptyOption) { + var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); + slc.appendChild(opt2); + } + } + return slc; + } + }, { + key: 'destroy', + value: function destroy() {} + }]); + + return Dropdown; + })(_feature.Feature); + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + ignoreCase: function ignoreCase(a, b) { + var x = _string2.default.lower(a); + var y = _string2.default.lower(b); + return x < y ? -1 : x > y ? 1 : 0; + } + }; + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.CheckList = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var CheckList = exports.CheckList = (function (_Feature) { + _inherits(CheckList, _Feature); + + /** + * Checklist UI component + * @param {Object} tf TableFilter instance + */ + + function CheckList(tf) { + _classCallCheck(this, CheckList); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CheckList).call(this, tf, 'checkList')); + + var f = tf.config(); + + _this.checkListDiv = []; //checklist container div + //defines css class for div containing checklist filter + _this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; + //defines css class for checklist filters + _this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; + //defines css class for checklist item (li) + _this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; + //defines css class for selected checklist item (li) + _this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; + //Load on demand text + _this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; + //defines css class for checklist filters + _this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; + _this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; + //checklist filter container div + _this.prfxCheckListDiv = 'chkdiv_'; + + _this.isCustom = null; + _this.opts = null; + _this.optsTxt = null; + _this.excludedOpts = null; + return _this; + } + + // TODO: move event here + + _createClass(CheckList, [{ + key: 'onChange', + value: function onChange(evt) { + var elm = evt.target; + this.tf.activeFilterId = elm.getAttribute('id'); + this.tf.activeFlt = _dom2.default.id(this.tf.activeFilterId); + this.tf.Evt.onSlcChange.call(this.tf, evt); + } + }, { + key: 'optionClick', + value: function optionClick(evt) { + this.setCheckListValues(evt.target); + this.onChange(evt); + } + }, { + key: 'onCheckListClick', + value: function onCheckListClick(evt) { + var _this2 = this; + + var elm = _event2.default.target(evt); + if (this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + var div = this.checkListDiv[ct]; + this.build(ct); + _event2.default.remove(div, 'click', function (evt) { + return _this2.onCheckListClick(evt); + }); + } + } + + /** + * Initialize checklist filter + * @param {Number} colIndex Column index + * @param {Boolean} isExternal External filter flag + * @param {DOMElement} container Dom element containing the filter + */ + + }, { + key: 'init', + value: function init(colIndex, isExternal, container) { + var _this3 = this; + + var tf = this.tf; + var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; + + var divCont = _dom2.default.create('div', ['id', this.prfxCheckListDiv + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); + divCont.className = this.checkListDivCssClass; + + //filter is appended in desired element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(divCont); + tf.externalFltEls.push(divCont); + } else { + container.appendChild(divCont); + } + + this.checkListDiv[colIndex] = divCont; + tf.fltIds.push(tf.prfxFlt + colIndex + '_' + tf.id); + + if (!tf.loadFltOnDemand) { + this.build(colIndex); + } else { + _event2.default.add(divCont, 'click', function (evt) { + return _this3.onCheckListClick(evt); + }); + divCont.appendChild(_dom2.default.text(this.activateCheckListTxt)); + } + + this.initialized = true; + } + + /** + * Build checklist UI + * @param {Number} colIndex Column index + * @param {Boolean} isExternal Render in external container + * @param {String} extFltId External container id + */ + + }, { + key: 'build', + value: function build(colIndex) { + var _this4 = this; + + var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.emitter.emit('before-populating-filter', tf, colIndex); + + this.opts = []; + this.optsTxt = []; + + var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; + if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { + return; + } + + var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); + var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); + ul.className = this.checkListCssClass; + _event2.default.add(ul, 'change', function (evt) { + return _this4.onChange(evt); + }); + + var rows = tf.tbl.rows; + this.isCustom = tf.isCustomOptions(colIndex); + + var activeFlt = undefined; + if (tf.linkedFilters && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + var filteredDataCol = []; + if (tf.linkedFilters && tf.disableExcludedOptions) { + this.excludedOpts = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cells = rows[k].cells; + var ncells = cells.length; + + // checks if row has exact cell # + if (ncells !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < ncells; j++) { + // WTF: cyclomatic complexity hell :) + if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cells[j]); + //Vary Peter's patch + var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { + this.opts.push(cell_data); + } + var filteredCol = filteredDataCol[j]; + if (tf.linkedFilters && tf.disableExcludedOptions) { + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { + this.excludedOpts.push(cell_data); + } + } + } + } + } + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!tf.matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (this.excludedOpts) { + this.excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + } + } + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + this.addChecks(colIndex, ul, tf.separator); + + if (tf.loadFltOnDemand) { + flt.innerHTML = ''; + } + flt.appendChild(ul); + flt.setAttribute('filled', '1'); + + this.emitter.emit('after-populating-filter', tf, colIndex, flt); + } + + /** + * Add checklist options + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addChecks', + value: function addChecks(colIndex, ul) { + var _this5 = this; + + var tf = this.tf; + var chkCt = this.addTChecks(colIndex, ul); + + for (var y = 0; y < this.opts.length; y++) { + var val = this.opts[y]; //item value + var lbl = this.isCustom ? this.optsTxt[y] : val; //item text + var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); + li.className = this.checkListItemCssClass; + if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + _dom2.default.addClass(li, this.checkListItemDisabledCssClass); + li.check.disabled = true; + li.disabled = true; + } else { + _event2.default.add(li.check, 'click', function (evt) { + return _this5.optionClick(evt); + }); + } + ul.appendChild(li); + + if (val === '') { + //item is hidden + li.style.display = 'none'; + } + } + } + + /** + * Add checklist header option + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addTChecks', + value: function addTChecks(colIndex, ul) { + var _this6 = this; + + var tf = this.tf; + var chkCt = 1; + var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); + li0.className = this.checkListItemCssClass; + ul.appendChild(li0); + + _event2.default.add(li0.check, 'click', function (evt) { + _this6.optionClick(evt); + }); + + if (!this.enableCheckListResetFilter) { + li0.style.display = 'none'; + } + + if (tf.enableEmptyOption) { + var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); + li1.className = this.checkListItemCssClass; + ul.appendChild(li1); + _event2.default.add(li1.check, 'click', function (evt) { + return _this6.optionClick(evt); + }); + chkCt++; + } + + if (tf.enableNonEmptyOption) { + var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); + li2.className = this.checkListItemCssClass; + ul.appendChild(li2); + _event2.default.add(li2.check, 'click', function (evt) { + return _this6.optionClick(evt); + }); + chkCt++; + } + return chkCt; + } + + /** + * Store checked options in DOM element attribute + * @param {Object} o checklist option DOM element + */ + + }, { + key: 'setCheckListValues', + value: function setCheckListValues(o) { + if (!o) { + return; + } + var tf = this.tf; + var chkValue = o.value; //checked item value + var chkIndex = parseInt(o.id.split('_')[2], 10); + var filterTag = 'ul', + itemTag = 'li'; + var n = o; + + //ul tag search + while (_string2.default.lower(n.nodeName) !== filterTag) { + n = n.parentNode; + } + + var li = n.childNodes[chkIndex]; + var colIndex = n.getAttribute('colIndex'); + var fltValue = n.getAttribute('value'); //filter value (ul tag) + var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) + + if (o.checked) { + //show all item + if (chkValue === '') { + if (fltIndexes && fltIndexes !== '') { + //items indexes + var indSplit = fltIndexes.split(tf.separator); + //checked items loop + for (var u = 0; u < indSplit.length; u++) { + //checked item + var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); + if (cChk) { + cChk.checked = false; + _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); + } + } + } + n.setAttribute('value', ''); + n.setAttribute('indexes', ''); + } else { + fltValue = fltValue ? fltValue : ''; + chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); + chkIndex = fltIndexes + chkIndex + tf.separator; + n.setAttribute('value', chkValue); + n.setAttribute('indexes', chkIndex); + //1st option unchecked + if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { + _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; + } + } + + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); + _dom2.default.addClass(li, this.checkListSlcItemCssClass); + } + } else { + //removes values and indexes + if (chkValue !== '') { + var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); + fltValue = fltValue.replace(replaceValue, ''); + n.setAttribute('value', _string2.default.trim(fltValue)); + + var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); + fltIndexes = fltIndexes.replace(replaceIndex, ''); + n.setAttribute('indexes', fltIndexes); + } + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(li, this.checkListSlcItemCssClass); + } + } + } + }, { + key: 'destroy', + value: function destroy() {} + }]); + + return CheckList; + })(_feature.Feature); + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.RowsCounter = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var RowsCounter = exports.RowsCounter = (function (_Feature) { + _inherits(RowsCounter, _Feature); + + /** + * Rows counter + * @param {Object} tf TableFilter instance + */ + + function RowsCounter(tf) { + _classCallCheck(this, RowsCounter); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); + + var f = _this.config; + + //id of custom container element + _this.rowsCounterTgtId = f.rows_counter_target_id || null; + //element containing tot nb rows + _this.rowsCounterDiv = null; + //element containing tot nb rows label + _this.rowsCounterSpan = null; + //defines rows counter text + _this.rowsCounterText = f.rows_counter_text || 'Rows: '; + _this.fromToTextSeparator = f.from_to_text_separator || '-'; + _this.overText = f.over_text || ' / '; + //defines css class rows counter + _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; + //rows counter div + _this.prfxCounter = 'counter_'; + //nb displayed rows label + _this.prfxTotRows = 'totrows_span_'; + //label preceding nb rows label + _this.prfxTotRowsTxt = 'totRowsTextSpan_'; + //callback raised before counter is refreshed + _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; + //callback raised after counter is refreshed + _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; + return _this; + } + + _createClass(RowsCounter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + //rows counter container + var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); + countDiv.className = this.totRowsCssClass; + //rows counter label + var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); + var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); + countText.appendChild(_dom2.default.text(this.rowsCounterText)); + + // counter is added to defined element + if (!this.rowsCounterTgtId) { + tf.setToolbar(); + } + var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); + + //default container: 'lDiv' + if (!this.rowsCounterTgtId) { + countDiv.appendChild(countText); + countDiv.appendChild(countSpan); + targetEl.appendChild(countDiv); + } else { + //custom container, no need to append statusDiv + targetEl.appendChild(countText); + targetEl.appendChild(countSpan); + } + this.rowsCounterDiv = countDiv; + this.rowsCounterSpan = countSpan; + + // subscribe to events + this.emitter.on(['after-filtering', 'grouped-by-page'], function () { + return _this2.refresh(tf.nbVisibleRows); + }); + this.emitter.on(['rows-changed'], function () { + return _this2.refresh(); + }); + + this.initialized = true; + this.refresh(); + } + }, { + key: 'refresh', + value: function refresh(p) { + if (!this.initialized || !this.isEnabled()) { + return; + } + + var tf = this.tf; + + if (this.onBeforeRefreshCounter) { + this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); + } + + var totTxt; + if (!tf.paging) { + if (p && p !== '') { + totTxt = p; + } else { + totTxt = tf.nbFilterableRows - tf.nbHiddenRows; + } + } else { + var paging = tf.feature('paging'); + if (paging) { + //paging start row + var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); + var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; + totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; + } + } + + this.rowsCounterSpan.innerHTML = totTxt; + if (this.onAfterRefreshCounter) { + this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + if (!this.rowsCounterTgtId && this.rowsCounterDiv) { + _dom2.default.remove(this.rowsCounterDiv); + } else { + _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; + } + this.rowsCounterSpan = null; + this.rowsCounterDiv = null; + + // unsubscribe to events + this.emitter.off(['after-filtering', 'grouped-by-page'], function () { + return _this3.refresh(tf.nbVisibleRows); + }); + this.emitter.off(['rows-changed'], function () { + return _this3.refresh(); + }); + + this.initialized = false; + } + }]); + + return RowsCounter; + })(_feature.Feature); + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.StatusBar = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var StatusBar = exports.StatusBar = (function (_Feature) { + _inherits(StatusBar, _Feature); + + /** + * Status bar UI component + * @param {Object} tf TableFilter instance + */ + + function StatusBar(tf) { + _classCallCheck(this, StatusBar); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); + + var f = _this.config; + + //id of custom container element + _this.statusBarTgtId = f.status_bar_target_id || null; + //element containing status bar label + _this.statusBarDiv = null; + //status bar + _this.statusBarSpan = null; + //status bar label + _this.statusBarSpanText = null; + //defines status bar text + _this.statusBarText = f.status_bar_text || ''; + //defines css class status bar + _this.statusBarCssClass = f.status_bar_css_class || 'status'; + //delay for status bar clearing + _this.statusBarCloseDelay = 250; + + //calls function before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //calls function after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + + //status messages + _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 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)...'; + + // status bar div + _this.prfxStatus = 'status_'; + // status bar label + _this.prfxStatusSpan = 'statusSpan_'; + // text preceding status bar label + _this.prfxStatusTxt = 'statusText_'; + return _this; + } + + _createClass(StatusBar, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + var emitter = this.emitter; + + //status bar container + var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); + statusDiv.className = this.statusBarCssClass; + + //status bar label + var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); + //preceding text + var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); + statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); + + // target element container + if (!this.statusBarTgtId) { + tf.setToolbar(); + } + var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); + + //default container: 'lDiv' + if (!this.statusBarTgtId) { + statusDiv.appendChild(statusSpanText); + statusDiv.appendChild(statusSpan); + targetEl.appendChild(statusDiv); + } else { + // custom container, no need to append statusDiv + targetEl.appendChild(statusSpanText); + targetEl.appendChild(statusSpan); + } + + this.statusBarDiv = statusDiv; + this.statusBarSpan = statusSpan; + this.statusBarSpanText = statusSpanText; + + // Subscribe to events + emitter.on(['before-filtering'], function () { + return _this2.message(_this2.msgFilter); + }); + emitter.on(['before-populating-filter'], function () { + return _this2.message(_this2.msgPopulate); + }); + emitter.on(['before-changing-page'], function () { + return _this2.message(_this2.msgChangePage); + }); + emitter.on(['before-clearing-filters'], function () { + return _this2.message(_this2.msgClear); + }); + emitter.on(['before-changing-results-per-page'], function () { + return _this2.message(_this2.msgChangeResults); + }); + emitter.on(['before-reset-page'], function () { + return _this2.message(_this2.msgResetPage); + }); + emitter.on(['before-reset-page-length'], function () { + return _this2.message(_this2.msgResetPageLength); + }); + emitter.on(['before-loading-extensions'], function () { + return _this2.message(_this2.msgLoadExtensions); + }); + emitter.on(['before-loading-themes'], function () { + return _this2.message(_this2.msgLoadThemes); + }); + + emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this2.message(''); + }); + + this.initialized = true; + } + }, { + key: 'message', + value: function message() { + var _this3 = this; + + var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; + + if (!this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, t); + } + + var d = t === '' ? this.statusBarCloseDelay : 1; + global.setTimeout(function () { + if (!_this3.initialized) { + return; + } + _this3.statusBarSpan.innerHTML = t; + if (_this3.onAfterShowMsg) { + _this3.onAfterShowMsg.call(null, _this3.tf, t); + } + }, d); + } + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + if (!this.initialized) { + return; + } + + var emitter = this.emitter; + + this.statusBarDiv.innerHTML = ''; + _dom2.default.remove(this.statusBarDiv); + this.statusBarSpan = null; + this.statusBarSpanText = null; + this.statusBarDiv = null; + + // Unsubscribe to events + emitter.off(['before-filtering'], function () { + return _this4.message(_this4.msgFilter); + }); + emitter.off(['before-populating-filter'], function () { + return _this4.message(_this4.msgPopulate); + }); + emitter.off(['before-changing-page'], function () { + return _this4.message(_this4.msgChangePage); + }); + emitter.off(['before-clearing-filters'], function () { + return _this4.message(_this4.msgClear); + }); + emitter.off(['before-changing-results-per-page'], function () { + return _this4.message(_this4.msgChangeResults); + }); + emitter.off(['before-reset-page'], function () { + return _this4.message(_this4.msgResetPage); + }); + emitter.off(['before-reset-page-length'], function () { + return _this4.message(_this4.msgResetPageLength); + }); + emitter.off(['before-loading-extensions'], function () { + return _this4.message(_this4.msgLoadExtensions); + }); + emitter.off(['before-loading-themes'], function () { + return _this4.message(_this4.msgLoadThemes); + }); + + emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this4.message(''); + }); + + this.initialized = false; + } + }]); + + return StatusBar; + })(_feature.Feature); + +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Paging = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Paging = exports.Paging = (function (_Feature) { + _inherits(Paging, _Feature); + + /** + * Pagination component + * @param {Object} tf TableFilter instance + */ + + function Paging(tf) { + _classCallCheck(this, Paging); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); + + var f = _this.config; + + //css class for paging buttons (previous,next,etc.) + _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; + //stores paging select element + _this.pagingSlc = null; + //results per page select element + _this.resultsPerPageSlc = null; + //id of container element + _this.pagingTgtId = f.paging_target_id || null; + //defines table paging length + _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; + //id of container element + _this.resultsPerPageTgtId = f.results_per_page_target_id || null; + //css class for paging select element + _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; + //css class for paging input element + _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; + //stores results per page text and values + _this.resultsPerPage = f.results_per_page || null; + //enables/disables results per page drop-down + _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); + //defines css class for results per page select + _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; + //css class for label preceding results per page select + _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; + //1st row index of current page + _this.startPagingRow = 0; + //total nb of pages + _this.nbPages = 0; + //current page nb + _this.currentPageNb = 1; + //defines next page button text + _this.btnNextPageText = f.btn_next_page_text || '>'; + //defines previous page button text + _this.btnPrevPageText = f.btn_prev_page_text || '<'; + //defines last page button text + _this.btnLastPageText = f.btn_last_page_text || '>|'; + //defines first page button text + _this.btnFirstPageText = f.btn_first_page_text || '|<'; + //defines next page button html + _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); + //defines last page button html + _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); + //defines text preceeding page selector drop-down + _this.pageText = f.page_text || ' Page '; + //defines text after page selector drop-down + _this.ofText = f.of_text || ' of '; + //css class for span containing tot nb of pages + _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; + //enables/disables paging buttons + _this.hasPagingBtns = f.paging_btns === false ? false : true; + //defines previous page button html + _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; + //calls function before page is changed + _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; + //calls function before page is changed + _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; + + //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_'; + + var start_row = tf.refRow; + var nrows = tf.nbRows; + //calculates page nb + _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); + + //Paging elements events + var o = _this; + // Paging DOM events + _this.evt = { + slcIndex: function slcIndex() { + return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; + }, + nbOpts: function nbOpts() { + return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; + }, + next: function next() { + var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; + o.changePage(nextIndex); + }, + prev: function prev() { + var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); + o.changePage(prevIndex); + }, + last: function last() { + o.changePage(o.evt.nbOpts()); + }, + first: function first() { + o.changePage(0); + }, + _detectKey: function _detectKey(e) { + var key = _event2.default.keyCode(e); + if (key === 13) { + if (tf.sorted) { + tf.filter(); + o.changePage(o.evt.slcIndex()); + } else { + o.changePage(); + } + this.blur(); + } + }, + + slcPagesChange: null, + nextEvt: null, + prevEvt: null, + lastEvt: null, + firstEvt: null + }; + return _this; + } + + /** + * Initialize DOM elements + */ + + _createClass(Paging, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var slcPages; + var tf = this.tf; + var evt = this.evt; + + if (this.initialized) { + return; + } + + // Check resultsPerPage is in expected format and initialise the + // results per page component + if (this.hasResultsPerPage) { + if (this.resultsPerPage.length < 2) { + this.hasResultsPerPage = false; + } else { + this.pagingLength = this.resultsPerPage[1][0]; + this.setResultsPerPage(); + } + } + + evt.slcPagesChange = function (event) { + var slc = event.target; + _this2.changePage(slc.selectedIndex); + }; + + // Paging drop-down list selector + if (this.pageSelectorType === tf.fltTypeSlc) { + slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); + slcPages.className = this.pgSlcCssClass; + _event2.default.add(slcPages, 'change', evt.slcPagesChange); + } + + // Paging input selector + if (this.pageSelectorType === tf.fltTypeInp) { + slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); + slcPages.className = this.pgInpCssClass; + _event2.default.add(slcPages, 'keypress', evt._detectKey); + } + + // btns containers + var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); + var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); + var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); + var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); + + if (this.hasPagingBtns) { + // Next button + if (!this.btnNextPageHtml) { + var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); + btn_next.className = this.btnPageCssClass; + _event2.default.add(btn_next, 'click', evt.next); + btnNextSpan.appendChild(btn_next); + } else { + btnNextSpan.innerHTML = this.btnNextPageHtml; + _event2.default.add(btnNextSpan, 'click', evt.next); + } + // Previous button + if (!this.btnPrevPageHtml) { + var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); + btn_prev.className = this.btnPageCssClass; + _event2.default.add(btn_prev, 'click', evt.prev); + btnPrevSpan.appendChild(btn_prev); + } else { + btnPrevSpan.innerHTML = this.btnPrevPageHtml; + _event2.default.add(btnPrevSpan, 'click', evt.prev); + } + // Last button + if (!this.btnLastPageHtml) { + var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); + btn_last.className = this.btnPageCssClass; + _event2.default.add(btn_last, 'click', evt.last); + btnLastSpan.appendChild(btn_last); + } else { + btnLastSpan.innerHTML = this.btnLastPageHtml; + _event2.default.add(btnLastSpan, 'click', evt.last); + } + // First button + if (!this.btnFirstPageHtml) { + var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); + btn_first.className = this.btnPageCssClass; + _event2.default.add(btn_first, 'click', evt.first); + btnFirstSpan.appendChild(btn_first); + } else { + btnFirstSpan.innerHTML = this.btnFirstPageHtml; + _event2.default.add(btnFirstSpan, 'click', evt.first); + } + } + + // paging elements (buttons+drop-down list) are added to defined element + if (!this.pagingTgtId) { + tf.setToolbar(); + } + var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + targetEl.appendChild(btnFirstSpan); + targetEl.appendChild(btnPrevSpan); + + var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); + pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); + pgBeforeSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgBeforeSpan); + targetEl.appendChild(slcPages); + var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); + pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); + pgAfterSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgAfterSpan); + var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); + pgspan.className = this.nbPgSpanCssClass; + pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); + targetEl.appendChild(pgspan); + targetEl.appendChild(btnNextSpan); + targetEl.appendChild(btnLastSpan); + this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); + + if (!tf.rememberGridValues) { + this.setPagingInfo(); + } + if (!tf.fltGrid) { + tf.validateAllRows(); + this.setPagingInfo(tf.validRowsIndex); + } + + this.emitter.on(['after-filtering'], function () { + return _this2.resetPagingInfo(); + }); + this.emitter.on(['initialized'], function () { + return _this2.resetValues(); + }); + + this.initialized = true; + } + + /** + * Reset paging when filters are already instantiated + * @param {Boolean} filterTable Execute filtering once paging instanciated + */ + + }, { + key: 'reset', + value: function reset() { + var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var tf = this.tf; + if (!tf.hasGrid() || this.isEnabled()) { + return; + } + this.enable(); + this.init(); + tf.resetValues(); + if (filterTable) { + tf.filter(); + } + } + + /** + * Reset paging info from scratch after a filtering process + */ + + }, { + key: 'resetPagingInfo', + value: function resetPagingInfo() { + this.startPagingRow = 0; + this.currentPageNb = 1; + this.setPagingInfo(this.tf.validRowsIndex); + } + + /** + * Calculate number of pages based on valid rows + * Refresh paging select according to number of pages + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'setPagingInfo', + value: function setPagingInfo(validRows) { + var tf = this.tf; + var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + //store valid rows indexes + tf.validRowsIndex = validRows || tf.getValidRows(true); + + //calculate nb of pages + this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); + //refresh page nb span + pgspan.innerHTML = this.nbPages; + //select clearing shortcut + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.innerHTML = ''; + } + + if (this.nbPages > 0) { + mdiv.style.visibility = 'visible'; + if (this.pageSelectorType === tf.fltTypeSlc) { + for (var z = 0; z < this.nbPages; z++) { + var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); + this.pagingSlc.options[z] = opt; + } + } else { + //input type + this.pagingSlc.value = this.currentPageNb; + } + } else { + /*** if no results paging select and buttons are hidden ***/ + mdiv.style.visibility = 'hidden'; + } + this.groupByPage(tf.validRowsIndex); + } + + /** + * Group table rows by page and display valid rows + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'groupByPage', + value: function groupByPage(validRows) { + var tf = this.tf; + var rows = tf.tbl.rows; + var startPagingRow = parseInt(this.startPagingRow, 10); + var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); + + //store valid rows indexes + if (validRows) { + tf.validRowsIndex = validRows; + } + + //this loop shows valid rows of current page + for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { + var validRowIdx = tf.validRowsIndex[h]; + var r = rows[validRowIdx]; + var isRowValid = r.getAttribute('validRow'); + var rowDisplayed = false; + + if (h >= startPagingRow && h < endPagingRow) { + if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { + r.style.display = ''; + rowDisplayed = true; + } + } else { + r.style.display = 'none'; + } + this.emitter.emit('row-paged', tf, validRowIdx, h, rowDisplayed); + } + + tf.nbVisibleRows = tf.validRowsIndex.length; + + // broadcast grouping by page + this.emitter.emit('grouped-by-page', tf, this); + } + + /** + * Return the current page number + * @return {Number} Page number + */ + + }, { + key: 'getPage', + value: function getPage() { + return this.currentPageNb; + } + + /** + * Show page based on passed param value (string or number): + * @param {String} or {Number} cmd possible string values: 'next', + * 'previous', 'last', 'first' or page number as per param + */ + + }, { + key: 'setPage', + value: function setPage(cmd) { + var tf = this.tf; + if (!tf.hasGrid() || !this.isEnabled()) { + return; + } + var btnEvt = this.evt, + cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); + if (cmdtype === 'string') { + switch (_string2.default.lower(cmd)) { + case 'next': + btnEvt.next(); + break; + case 'previous': + btnEvt.prev(); + break; + case 'last': + btnEvt.last(); + break; + case 'first': + btnEvt.first(); + break; + default: + btnEvt.next(); + break; + } + } else if (cmdtype === 'number') { + this.changePage(cmd - 1); + } + } + + /** + * Generates UI elements for the number of results per page drop-down + */ + + }, { + key: 'setResultsPerPage', + value: function setResultsPerPage() { + var _this3 = this; + + var tf = this.tf; + var evt = this.evt; + + if (!tf.hasGrid() && !tf.isFirstLoad) { + return; + } + if (this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + + evt.slcResultsChange = function (ev) { + _this3.changeResultsPerPage(); + ev.target.blur(); + }; + + var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); + slcR.className = this.resultsSlcCssClass; + var slcRText = this.resultsPerPage[0], + slcROpts = this.resultsPerPage[1]; + var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); + slcRSpan.className = this.resultsSpanCssClass; + + // results per page select is added to external element + if (!this.resultsPerPageTgtId) { + tf.setToolbar(); + } + var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); + slcRSpan.appendChild(_dom2.default.text(slcRText)); + + var help = tf.feature('help'); + if (help && help.btn) { + help.btn.parentNode.insertBefore(slcRSpan, help.btn); + help.btn.parentNode.insertBefore(slcR, help.btn); + } else { + targetEl.appendChild(slcRSpan); + targetEl.appendChild(slcR); + } + + for (var r = 0; r < slcROpts.length; r++) { + var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); + slcR.options[r] = currOpt; + } + _event2.default.add(slcR, 'change', evt.slcResultsChange); + this.resultsPerPageSlc = slcR; + } + + /** + * Remove number of results per page UI elements + */ + + }, { + key: 'removeResultsPerPage', + value: function removeResultsPerPage() { + var tf = this.tf; + if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + var slcR = this.resultsPerPageSlc, + slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); + if (slcR) { + _dom2.default.remove(slcR); + } + if (slcRSpan) { + _dom2.default.remove(slcRSpan); + } + this.resultsPerPageSlc = null; + } + + /** + * Change the page according to passed index + * @param {Number} index Index of the page (0-n) + */ + + }, { + key: 'changePage', + value: function changePage(index) { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + + this.emitter.emit('before-changing-page', tf, index); + + if (index === null) { + index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; + } + if (index >= 0 && index <= this.nbPages - 1) { + if (this.onBeforeChangePage) { + this.onBeforeChangePage.call(null, this, index); + } + this.currentPageNb = parseInt(index, 10) + 1; + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.options[index].selected = true; + } else { + this.pagingSlc.value = this.currentPageNb; + } + + if (tf.rememberPageNb) { + tf.feature('store').savePageNb(tf.pgNbCookie); + } + this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; + + this.groupByPage(); + + if (this.onAfterChangePage) { + this.onAfterChangePage.call(null, this, index); + } + } + + this.emitter.emit('after-changing-page', tf, index); + } + + /** + * Change rows according to page results drop-down + * TODO: accept a parameter setting the results per page length + */ + + }, { + key: 'changeResultsPerPage', + value: function changeResultsPerPage() { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + + this.emitter.emit('before-changing-results-per-page', tf); + + var slcR = this.resultsPerPageSlc; + var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); + this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); + this.startPagingRow = this.pagingLength * slcPagesSelIndex; + + if (!isNaN(this.pagingLength)) { + if (this.startPagingRow >= tf.nbFilterableRows) { + this.startPagingRow = tf.nbFilterableRows - this.pagingLength; + } + this.setPagingInfo(); + + if (this.pageSelectorType === tf.fltTypeSlc) { + var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; + this.pagingSlc.options[slcIndex].selected = true; + } + if (tf.rememberPageLen) { + tf.feature('store').savePageLength(tf.pgLenCookie); + } + } + + this.emitter.emit('after-changing-results-per-page', tf); + } + + /** + * Re-set persisted pagination info + */ + + }, { + key: 'resetValues', + value: function resetValues() { + var tf = this.tf; + if (tf.rememberPageLen) { + this.resetPageLength(tf.pgLenCookie); + } + if (tf.rememberPageNb) { + this.resetPage(tf.pgNbCookie); + } + } + + /** + * Re-set page nb at page re-load + */ + + }, { + key: 'resetPage', + value: function resetPage(name) { + var tf = this.tf; + if (!this.isEnabled()) { + return; + } + this.emitter.emit('before-reset-page', tf); + var pgnb = tf.feature('store').getPageNb(name); + if (pgnb !== '') { + this.changePage(pgnb - 1); + } + this.emitter.emit('after-reset-page', tf, pgnb); + } + + /** + * Re-set page length value at page re-load + */ + + }, { + key: 'resetPageLength', + value: function resetPageLength(name) { + var tf = this.tf; + if (!this.isEnabled()) { + return; + } + this.emitter.emit('before-reset-page-length', tf); + var pglenIndex = tf.feature('store').getPageLength(name); + + if (pglenIndex !== '') { + this.resultsPerPageSlc.options[pglenIndex].selected = true; + this.changeResultsPerPage(); + } + this.emitter.emit('after-reset-page-length', tf, pglenIndex); + } + + /** + * Remove paging feature + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + var tf = this.tf; + + if (!this.initialized) { + return; + } + // btns containers + var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); + var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); + var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); + var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); + //span containing 'Page' text + var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); + //span containing 'of' text + var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); + //span containing nb of pages + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + var evt = this.evt; + + if (this.pagingSlc) { + if (this.pageSelectorType === tf.fltTypeSlc) { + _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); + } else if (this.pageSelectorType === tf.fltTypeInp) { + _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); + } + _dom2.default.remove(this.pagingSlc); + } + + if (btnNextSpan) { + _event2.default.remove(btnNextSpan, 'click', evt.next); + _dom2.default.remove(btnNextSpan); + } + + if (btnPrevSpan) { + _event2.default.remove(btnPrevSpan, 'click', evt.prev); + _dom2.default.remove(btnPrevSpan); + } + + if (btnLastSpan) { + _event2.default.remove(btnLastSpan, 'click', evt.last); + _dom2.default.remove(btnLastSpan); + } + + if (btnFirstSpan) { + _event2.default.remove(btnFirstSpan, 'click', evt.first); + _dom2.default.remove(btnFirstSpan); + } + + if (pgBeforeSpan) { + _dom2.default.remove(pgBeforeSpan); + } + + if (pgAfterSpan) { + _dom2.default.remove(pgAfterSpan); + } + + if (pgspan) { + _dom2.default.remove(pgspan); + } + + if (this.hasResultsPerPage) { + this.removeResultsPerPage(); + } + + this.emitter.off(['after-filtering'], function () { + return _this4.resetPagingInfo(); + }); + this.emitter.off(['initialized'], function () { + return _this4.resetValues(); + }); + + this.pagingSlc = null; + this.nbPages = 0; + this.disable(); + this.initialized = false; + } + }]); + + return Paging; + })(_feature.Feature); + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.ClearButton = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var ClearButton = exports.ClearButton = (function (_Feature) { + _inherits(ClearButton, _Feature); + + /** + * Clear button component + * @param {Object} tf TableFilter instance + */ + + function ClearButton(tf) { + _classCallCheck(this, ClearButton); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); + + var f = _this.config; + + //id of container element + _this.btnResetTgtId = f.btn_reset_target_id || null; + //reset button element + _this.btnResetEl = null; + //defines reset text + _this.btnResetText = f.btn_reset_text || 'Reset'; + //defines reset button tooltip + _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; + //defines reset button innerHtml + _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); + //span containing reset button + _this.prfxResetSpan = 'resetspan_'; + return _this; + } + + _createClass(ClearButton, [{ + key: 'onClick', + value: function onClick() { + if (!this.isEnabled()) { + return; + } + this.tf.clearFilters(); + } + + /** + * Build DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + + if (this.initialized) { + return; + } + + var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); + + // reset button is added to defined element + if (!this.btnResetTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); + targetEl.appendChild(resetspan); + + if (!this.btnResetHtml) { + var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); + fltreset.className = tf.btnResetCssClass; + fltreset.appendChild(_dom2.default.text(this.btnResetText)); + resetspan.appendChild(fltreset); + _event2.default.add(fltreset, 'click', function () { + _this2.onClick(); + }); + } else { + resetspan.innerHTML = this.btnResetHtml; + var resetEl = resetspan.firstChild; + _event2.default.add(resetEl, 'click', function () { + _this2.onClick(); + }); + } + this.btnResetEl = resetspan.firstChild; + + this.initialized = true; + } + + /** + * Remove clear button UI + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + + if (!this.initialized) { + return; + } + + var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); + if (resetspan) { + _dom2.default.remove(resetspan); + } + this.btnResetEl = null; + this.initialized = false; + } + }]); + + return ClearButton; + })(_feature.Feature); + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Help = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; + var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; + + var Help = exports.Help = (function (_Feature) { + _inherits(Help, _Feature); + + /** + * Help UI component + * @param {Object} tf TableFilter instance + */ + + function Help(tf) { + _classCallCheck(this, Help); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); + + var f = _this.config; + + //id of custom container element for instructions + _this.tgtId = f.help_instructions_target_id || null; + //id of custom container element for instructions + _this.contTgtId = f.help_instructions_container_target_id || null; + //defines help text + _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; + //defines help innerHtml + _this.instrHtml = f.help_instructions_html || null; + //defines reset button text + _this.btnText = f.help_instructions_btn_text || '?'; + //defines reset button innerHtml + _this.btnHtml = f.help_instructions_btn_html || null; + //defines css class for help button + _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; + //defines css class for help container + _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; + //help button element + _this.btn = null; + //help content div + _this.cont = null; + _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; + + //id prefix for help elements + _this.prfxHelpSpan = 'helpSpan_'; + //id prefix for help elements + _this.prfxHelpDiv = 'helpDiv_'; + return _this; + } + + _createClass(Help, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); + var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); + + //help button is added to defined element + if (!this.tgtId) { + tf.setToolbar(); + } + var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); + targetEl.appendChild(helpspan); + + var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); + + if (!this.btnHtml) { + divContainer.appendChild(helpdiv); + var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); + helplink.className = this.btnCssClass; + helplink.appendChild(_dom2.default.text(this.btnText)); + helpspan.appendChild(helplink); + _event2.default.add(helplink, 'click', function () { + _this2.toggle(); + }); + } else { + helpspan.innerHTML = this.btnHtml; + var helpEl = helpspan.firstChild; + _event2.default.add(helpEl, 'click', function () { + _this2.toggle(); + }); + divContainer.appendChild(helpdiv); + } + + if (!this.instrHtml) { + helpdiv.innerHTML = this.instrText; + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } else { + if (this.contTgtId) { + divContainer.appendChild(helpdiv); + } + helpdiv.innerHTML = this.instrHtml; + if (!this.contTgtId) { + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } + } + helpdiv.innerHTML += this.defaultHtml; + _event2.default.add(helpdiv, 'click', function () { + _this2.toggle(); + }); + + this.cont = helpdiv; + this.btn = helpspan; + this.initialized = true; + } + + /** + * Toggle help pop-up + */ + + }, { + key: 'toggle', + value: function toggle() { + // check only if explicitily set to false as in this case undefined + // signifies the help feature is enabled by default + if (this.enabled === false) { + return; + } + var divDisplay = this.cont.style.display; + if (divDisplay === '' || divDisplay === 'none') { + this.cont.style.display = 'inline'; + } else { + this.cont.style.display = 'none'; + } + } + + /** + * Remove help UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + _dom2.default.remove(this.btn); + this.btn = null; + if (!this.cont) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + this.initialized = false; + } + }]); + + return Help; + })(_feature.Feature); + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.AlternateRows = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var AlternateRows = exports.AlternateRows = (function (_Feature) { + _inherits(AlternateRows, _Feature); + + /** + * Alternating rows color + * @param {Object} tf TableFilter instance + */ + + function AlternateRows(tf) { + _classCallCheck(this, AlternateRows); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); + + var config = _this.config; + //defines css class for even rows + _this.evenCss = config.even_row_css_class || 'even'; + //defines css class for odd rows + _this.oddCss = config.odd_row_css_class || 'odd'; + return _this; + } + + /** + * Sets alternating rows color + */ + + _createClass(AlternateRows, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + this.processAll(); + + // Subscribe to events + this.emitter.on(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { + return _this2.processRow(rowIndex, arrIndex, isValid); + }); + this.emitter.on(['column-sorted'], function () { + return _this2.processAll(); + }); + + this.initialized = true; + } + }, { + key: 'processAll', + value: function processAll() { + if (!this.isEnabled()) { + return; + } + var tf = this.tf; + var validRowsIndex = tf.getValidRows(true); + var noValidRowsIndex = validRowsIndex.length === 0; + //1st index + var beginIndex = noValidRowsIndex ? tf.refRow : 0; + // nb indexes + var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; + var idx = 0; + + //alternates bg color + for (var j = beginIndex; j < indexLen; j++) { + var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; + this.setRowBg(rowIdx, idx); + idx++; + } + } + + /** + * Set/remove row background based on row validation + * @param {Number} rowIdx Row index + * @param {Boolean} isValid Valid row flag + */ + + }, { + key: 'processRow', + value: function processRow(rowIdx, arrIdx, isValid) { + if (isValid) { + this.setRowBg(rowIdx, arrIdx); + } else { + this.removeRowBg(rowIdx); + } + } + + /** + * Sets row background color + * @param {Number} rowIdx Row index + * @param {Number} idx Valid rows collection index needed to calculate bg + * color + */ + + }, { + key: 'setRowBg', + value: function setRowBg(rowIdx, idx) { + if (!this.isEnabled() || isNaN(rowIdx)) { + return; + } + var rows = this.tf.tbl.rows; + var i = isNaN(idx) ? rowIdx : idx; + this.removeRowBg(rowIdx); + + _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); + } + + /** + * Removes row background color + * @param {Number} idx Row index + */ + + }, { + key: 'removeRowBg', + value: function removeRowBg(idx) { + if (isNaN(idx)) { + return; + } + var rows = this.tf.tbl.rows; + _dom2.default.removeClass(rows[idx], this.oddCss); + _dom2.default.removeClass(rows[idx], this.evenCss); + } + + /** + * Removes all alternating backgrounds + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { + this.removeRowBg(i); + } + + // Unsubscribe to events + this.emitter.off(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { + return _this3.processRow(rowIndex, arrIndex, isValid); + }); + this.emitter.off(['column-sorted'], function () { + return _this3.processAll(); + }); + + this.initialized = false; + } + }]); + + return AlternateRows; + })(_feature.Feature); + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.NoResults = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var NoResults = exports.NoResults = (function (_Feature) { + _inherits(NoResults, _Feature); + + /** + * No results message UI component + * @param {Object} tf TableFilter instance + */ + + function NoResults(tf) { + _classCallCheck(this, NoResults); + + //configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); + + var f = _this.config.no_results_message; + + _this.content = f.content || 'No results'; + _this.customContainer = f.custom_container || null; + _this.customContainerId = f.custom_container_id || null; + _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); + _this.cssClass = f.css_class || 'no-results'; + + _this.cont = null; + + //callback before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //callback after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + //callback before message is hidden + _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; + //callback after message is hidden + _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; + + _this.prfxNoResults = 'nores_'; + return _this; + } + + _createClass(NoResults, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + var tf = this.tf; + var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; + + //container + var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); + cont.className = this.cssClass; + cont.innerHTML = this.content; + + if (this.isExternal) { + target.appendChild(cont); + } else { + target.parentNode.insertBefore(cont, target.nextSibling); + } + + this.cont = cont; + + // subscribe to after-filtering event + this.emitter.on(['after-filtering'], function () { + return _this2.toggle(); + }); + + this.initialized = true; + this.hide(); + } + }, { + key: 'toggle', + value: function toggle() { + if (this.tf.nbVisibleRows > 0) { + this.hide(); + } else { + this.show(); + } + } + }, { + key: 'show', + value: function show() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, this); + } + + this.setWidth(); + this.cont.style.display = 'block'; + + if (this.onAfterShowMsg) { + this.onAfterShowMsg.call(null, this.tf, this); + } + } + }, { + key: 'hide', + value: function hide() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + + this.cont.style.display = 'none'; + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + } + }, { + key: 'setWidth', + value: function setWidth() { + if (!this.initialized || this.isExternal || !this.isEnabled()) { + return; + } + if (this.tf.gridLayout) { + var gridLayout = this.tf.feature('gridLayout'); + this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; + } else { + this.cont.style.width = this.tf.tbl.clientWidth + 'px'; + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + // unsubscribe to after-filtering event + this.emitter.off(['after-filtering'], function () { + return _this3.toggle(); + }); + + this.initialized = false; + } + }]); + + return NoResults; + })(_feature.Feature); + +/***/ } +/******/ ]) +}); +; +//# sourceMappingURL=tablefilter.js.map \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index e7f0ad1e..de8259b2 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,8 +1,2218 @@ -/** - * tablefilter v0.1.5 by Max Guglielmi - * build date: 2016-01-11T01:32:31.388Z - * MIT License - */ +webpackJsonp([1],{ -webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"destroy",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file +/***/ 26: +/***/ function(module, exports, __webpack_require__) { + + var map = { + "./array": 6, + "./array.js": 6, + "./cookie": 4, + "./cookie.js": 4, + "./date": 7, + "./date.js": 7, + "./dom": 2, + "./dom.js": 2, + "./emitter": 9, + "./emitter.js": 9, + "./event": 1, + "./event.js": 1, + "./extensions/advancedGrid/adapterEzEditTable": 27, + "./extensions/advancedGrid/adapterEzEditTable.js": 27, + "./extensions/advancedGrid/advancedGrid": 28, + "./extensions/advancedGrid/advancedGrid.js": 28, + "./extensions/colOps/colOps": 29, + "./extensions/colOps/colOps.js": 29, + "./extensions/colsVisibility/colsVisibility": 30, + "./extensions/colsVisibility/colsVisibility.js": 30, + "./extensions/filtersVisibility/filtersVisibility": 31, + "./extensions/filtersVisibility/filtersVisibility.js": 31, + "./extensions/sort/adapterSortabletable": 32, + "./extensions/sort/adapterSortabletable.js": 32, + "./extensions/sort/sort": 33, + "./extensions/sort/sort.js": 33, + "./helpers": 8, + "./helpers.js": 8, + "./modules/alternateRows": 24, + "./modules/alternateRows.js": 24, + "./modules/checkList": 18, + "./modules/checkList.js": 18, + "./modules/clearButton": 22, + "./modules/clearButton.js": 22, + "./modules/dropdown": 16, + "./modules/dropdown.js": 16, + "./modules/feature": 12, + "./modules/feature.js": 12, + "./modules/gridLayout": 11, + "./modules/gridLayout.js": 11, + "./modules/help": 23, + "./modules/help.js": 23, + "./modules/highlightKeywords": 14, + "./modules/highlightKeywords.js": 14, + "./modules/loader": 13, + "./modules/loader.js": 13, + "./modules/noResults": 25, + "./modules/noResults.js": 25, + "./modules/paging": 21, + "./modules/paging.js": 21, + "./modules/popupFilter": 15, + "./modules/popupFilter.js": 15, + "./modules/rowsCounter": 19, + "./modules/rowsCounter.js": 19, + "./modules/statusBar": 20, + "./modules/statusBar.js": 20, + "./modules/store": 10, + "./modules/store.js": 10, + "./sort": 17, + "./sort.js": 17, + "./string": 3, + "./string.js": 3, + "./types": 5, + "./types.js": 5 + }; + function webpackContext(req) { + return __webpack_require__(webpackContextResolve(req)); + }; + function webpackContextResolve(req) { + return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); + }; + webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); + }; + webpackContext.resolve = webpackContextResolve; + module.exports = webpackContext; + webpackContext.id = 26; + + +/***/ }, + +/***/ 27: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterEzEditTable = (function () { + /** + * Adapter module for ezEditTable, an external library providing advanced + * grid features (selection and edition): + * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus + * + * @param {Object} tf TableFilter instance + */ + + function AdapterEzEditTable(tf, cfg) { + _classCallCheck(this, AdapterEzEditTable); + + // ezEditTable config + this.initialized = false; + this.desc = cfg.description || 'ezEditTable adapter'; + this.filename = cfg.filename || 'ezEditTable.js'; + this.vendorPath = cfg.vendor_path; + this.loadStylesheet = Boolean(cfg.load_stylesheet); + this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; + this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; + this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; + // Enable the ezEditTable's scroll into view behaviour if grid layout on + cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; + + this._ezEditTable = null; + this.cfg = cfg; + this.tf = tf; + this.emitter = tf.emitter; + } + + /** + * Conditionally load ezEditTable library and set advanced grid + * @return {[type]} [description] + */ + + _createClass(AdapterEzEditTable, [{ + key: 'init', + value: function init() { + var _this = this; + + var tf = this.tf; + if (window.EditTable) { + this._setAdvancedGrid(); + } else { + var path = this.vendorPath + this.filename; + tf.import(this.filename, path, function () { + _this._setAdvancedGrid(); + }); + } + if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { + tf.import(this.stylesheetName, this.stylesheet, null, 'link'); + } + + // TODO: hack to prevent ezEditTable enter key event hijaking. + // Needs to be fixed in the vendor's library + this.emitter.on(['filter-focus', 'filter-blur'], function () { + return _this.toggle(); + }); + } + + /** + * Instantiate ezEditTable component for advanced grid features + */ + + }, { + key: '_setAdvancedGrid', + value: function _setAdvancedGrid() { + var tf = this.tf; + + //start row for EditTable constructor needs to be calculated + var startRow, + cfg = this.cfg, + thead = _dom2.default.tag(tf.tbl, 'thead'); + + //if thead exists and startRow not specified, startRow is calculated + //automatically by EditTable + if (thead.length > 0 && !cfg.startRow) { + startRow = undefined; + } + //otherwise startRow config property if any or TableFilter refRow + else { + startRow = cfg.startRow || tf.refRow; + } + + cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; + var editable = cfg.editable; + var selectable = cfg.selection; + + if (selectable) { + cfg.default_selection = cfg.default_selection || 'row'; + } + //CSS Styles + cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; + + var _lastValidRowIndex = 0; + var _lastRowIndex = 0; + + if (selectable) { + //Row navigation needs to be calculated according to TableFilter's + //validRowsIndex array + var onAfterSelection = function onAfterSelection(et, selectedElm, e) { + var slc = et.Selection; + //Next valid filtered row needs to be selected + var doSelect = function doSelect(nextRowIndex) { + if (et.defaultSelection === 'row') { + slc.SelectRowByIndex(nextRowIndex); + } else { + et.ClearSelections(); + var cellIndex = selectedElm.cellIndex, + row = tf.tbl.rows[nextRowIndex]; + if (et.defaultSelection === 'both') { + slc.SelectRowByIndex(nextRowIndex); + } + if (row) { + slc.SelectCell(row.cells[cellIndex]); + } + } + //Table is filtered + if (tf.validRowsIndex.length !== tf.getRowsNb()) { + var r = tf.tbl.rows[nextRowIndex]; + if (r) { + r.scrollIntoView(false); + } + if (cell) { + if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { + tf.tblCont.scrollLeft = 100000000; + } else if (cell.cellIndex === 0 && tf.gridLayout) { + tf.tblCont.scrollLeft = 0; + } else { + cell.scrollIntoView(false); + } + } + } + }; + + //table is not filtered + if (!tf.validRowsIndex) { + return; + } + var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, + nextRowIndex, + paging = tf.feature('paging'), + + //pgup/pgdown keys + d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { + //last row + if (row.rowIndex >= validIndexes[validIdxLen - 1]) { + nextRowIndex = validIndexes[validIdxLen - 1]; + } else { + var calcRowIndex = _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[_lastValidRowIndex - d]; + nextRowIndex = v ? v : validIndexes[0]; + } + } + _lastRowIndex = row.rowIndex; + doSelect(nextRowIndex); + } else { + //If filtered row is valid, special calculation for + //pgup/pgdown keys + if (keyCode !== 34 && keyCode !== 33) { + _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); + _lastRowIndex = row.rowIndex; + } else { + if (keyCode === 34) { + //pgdown + //last row + if (_lastValidRowIndex + d <= validIdxLen - 1) { + nextRowIndex = validIndexes[_lastValidRowIndex + d]; + } else { + nextRowIndex = [validIdxLen - 1]; + } + } else { + //pgup + //first row + if (_lastValidRowIndex - d <= validIndexes[0]) { + nextRowIndex = validIndexes[0]; + } else { + nextRowIndex = validIndexes[_lastValidRowIndex - d]; + } + } + _lastRowIndex = nextRowIndex; + _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); + doSelect(nextRowIndex); + } + } + }; + + //Page navigation has to be enforced whenever selected row is out of + //the current page range + var onBeforeSelection = function onBeforeSelection(et, selectedElm) { + var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; + if (tf.paging) { + if (tf.feature('paging').nbPages > 1) { + var paging = tf.feature('paging'); + //page length is re-assigned in case it has changed + et.nbRowsPerPage = paging.pagingLength; + var validIndexes = tf.validRowsIndex, + validIdxLen = validIndexes.length, + pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); + var rowIndex = row.rowIndex; + + if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { + paging.setPage('last'); + } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { + paging.setPage('first'); + } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { + paging.setPage('next'); + } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { + paging.setPage('previous'); + } + } + } + }; + + //Selected row needs to be visible when paging is activated + if (tf.paging) { + tf.feature('paging').onAfterChangePage = function (paging) { + var advGrid = paging.tf.extension('advancedGrid'); + var et = advGrid._ezEditTable; + var slc = et.Selection; + var row = slc.GetActiveRow(); + if (row) { + row.scrollIntoView(false); + } + var cell = slc.GetActiveCell(); + if (cell) { + cell.scrollIntoView(false); + } + }; + } + + //Rows navigation when rows are filtered is performed with the + //EditTable row selection callback events + if (cfg.default_selection === 'row') { + var fnB = cfg.on_before_selected_row; + cfg.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 = cfg.on_after_selected_row; + cfg.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 = cfg.on_before_selected_cell; + cfg.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 = cfg.on_after_selected_cell; + cfg.on_after_selected_cell = function () { + onAfterSelection(arguments[0], arguments[1], arguments[2]); + if (fnC) { + fnC.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + } + } + if (editable) { + //Added or removed rows, TF rows number needs to be re-calculated + var fnE = cfg.on_added_dom_row; + cfg.on_added_dom_row = function () { + tf.nbFilterableRows++; + if (!tf.paging) { + tf.emitter.emit('rows-changed', tf, this); + //tf.feature('rowsCounter').refresh(); + } else { + tf.nbRows++; + tf.nbVisibleRows++; + tf.nbFilterableRows++; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnE) { + fnE.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + if (cfg.actions && cfg.actions['delete']) { + var fnF = cfg.actions['delete'].on_after_submit; + cfg.actions['delete'].on_after_submit = function () { + tf.nbFilterableRows--; + if (!tf.paging) { + // tf.feature('rowsCounter').refresh(); + tf.emitter.emit('rows-changed', tf, this); + } else { + tf.nbRows--; + tf.nbVisibleRows--; + tf.nbFilterableRows--; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(false); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnF) { + fnF.call(null, arguments[0], arguments[1]); + } + }; + } + } + + try { + this._ezEditTable = new EditTable(tf.id, cfg, startRow); + this._ezEditTable.Init(); + } catch (e) { + throw new Error(this.err); + } + + this.initialized = true; + } + + /** + * Reset advanced grid when previously removed + */ + + }, { + key: 'reset', + value: function reset() { + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.Set(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Set(); + } + } + } + + /** + * Toggle behaviour + */ + + }, { + key: 'toggle', + value: function toggle() { + var ezEditTable = this._ezEditTable; + if (ezEditTable.editable) { + ezEditTable.Editable.Remove(); + } else { + ezEditTable.Editable.Set(); + } + if (ezEditTable.selection) { + ezEditTable.Selection.Remove(); + } else { + ezEditTable.Selection.Set(); + } + } + + /** + * Remove advanced grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.ClearSelections(); + ezEditTable.Selection.Remove(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Remove(); + } + } + + this.emitter.off(['filter-focus', 'filter-blur'], function () { + return _this2.toggle(); + }); + this.initialized = false; + } + }]); + + return AdapterEzEditTable; + })(); + + exports.default = AdapterEzEditTable; + +/***/ }, + +/***/ 28: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterEzEditTable = __webpack_require__(27); + + var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = _adapterEzEditTable2.default; + +/***/ }, + +/***/ 29: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColOps = (function () { + + /** + * Column calculations + * @param {Object} tf TableFilter instance + */ + + function ColOps(tf, opts) { + _classCallCheck(this, ColOps); + + //calls function before col operation + this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; + //calls function after col operation + this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; + + this.opts = opts; + this.tf = tf; + } + + _createClass(ColOps, [{ + key: 'init', + value: function init() { + var _this = this; + + // subscribe to events + this.tf.emitter.on(['after-filtering'], function () { + return _this.calc(); + }); + + this.calc(); + } + + /** + * Calculates columns' values + * Configuration options are stored in 'opts' property + * - 'id' contains ids of elements showing result (array) + * - 'col' contains the columns' indexes (array) + * - 'operation' contains operation type (array, values: 'sum', 'mean', + * 'min', 'max', 'median', 'q1', 'q3') + * - 'write_method' array defines which method to use for displaying the + * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' + * - 'tot_row_index' defines in which row results are displayed + * (integers array) + * + * - changes made by Nuovella: + * (1) optimized the routine (now it will only process each column once), + * (2) added calculations for the median, lower and upper quartile. + */ + + }, { + key: 'calc', + value: function calc() { + var tf = this.tf; + if (!tf.isFirstLoad && !tf.hasGrid()) { + return; + } + + if (this.onBeforeOperation) { + this.onBeforeOperation.call(null, tf); + } + + var opts = this.opts, + labelId = opts.id, + colIndex = opts.col, + operation = opts.operation, + outputType = opts.write_method, + totRowIndex = opts.tot_row_index, + excludeRow = opts.exclude_row, + decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; + + //nuovella: determine unique list of columns to operate on + var ucolIndex = [], + ucolMax = 0; + ucolIndex[ucolMax] = colIndex[0]; + + for (var ii = 1; ii < colIndex.length; ii++) { + var saved = 0; + //see if colIndex[ii] is already in the list of unique indexes + for (var jj = 0; jj <= ucolMax; jj++) { + if (ucolIndex[jj] === colIndex[ii]) { + saved = 1; + } + } + //if not saved then, save the index; + if (saved === 0) { + ucolMax++; + ucolIndex[ucolMax] = colIndex[ii]; + } + } + + if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { + var rows = tf.tbl.rows, + colvalues = []; + + for (var ucol = 0; ucol <= ucolMax; ucol++) { + //this retrieves col values + //use ucolIndex because we only want to pass through this loop + //once for each column get the values in this unique column + colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); + + //next: calculate all operations for this column + 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; + + for (var k = 0; k < colIndex.length; k++) { + if (colIndex[k] === ucolIndex[ucol]) { + mThisCol++; + opsThisCol[mThisCol] = _string2.default.lower(operation[k]); + decThisCol[mThisCol] = decimalPrecision[k]; + labThisCol[mThisCol] = labelId[k]; + oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; + + switch (opsThisCol[mThisCol]) { + case 'mean': + meanFlag = 1; + break; + case 'sum': + sumFlag = 1; + break; + case 'min': + minFlag = 1; + break; + case 'max': + maxFlag = 1; + break; + case 'median': + medFlag = 1; + break; + case 'q1': + q1Flag = 1; + break; + case 'q3': + q3Flag = 1; + break; + } + } + } + + for (var j = 0; j < colvalues[ucol].length; j++) { + //sort the list for calculation of median and quartiles + if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { + if (j < colvalues[ucol].length - 1) { + for (k = j + 1; k < colvalues[ucol].length; k++) { + if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { + temp = colvalues[ucol][j]; + colvalues[ucol][j] = colvalues[ucol][k]; + colvalues[ucol][k] = temp; + } + } + } + } + var cvalue = parseFloat(colvalues[ucol][j]); + theList[j] = parseFloat(cvalue); + + if (!isNaN(cvalue)) { + nbvalues++; + if (sumFlag === 1 || meanFlag === 1) { + sumValue += parseFloat(cvalue); + } + if (minFlag === 1) { + if (minValue === null) { + minValue = parseFloat(cvalue); + } else { + minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; + } + } + if (maxFlag === 1) { + if (maxValue === null) { + maxValue = parseFloat(cvalue); + } else { + maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; + } + } + } + } //for j + if (meanFlag === 1) { + meanValue = sumValue / nbvalues; + } + if (medFlag === 1) { + var aux = 0; + if (nbvalues % 2 === 1) { + aux = Math.floor(nbvalues / 2); + medValue = theList[aux]; + } else { + medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; + } + } + var posa; + if (q1Flag === 1) { + posa = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa == nbvalues) { + q1Value = (theList[posa - 1] + theList[posa]) / 2; + } else { + q1Value = theList[posa]; + } + } + if (q3Flag === 1) { + posa = 0.0; + var posb = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa === nbvalues) { + posb = 3 * posa; + q3Value = (theList[posb] + theList[posb - 1]) / 2; + } else { + q3Value = theList[nbvalues - posa - 1]; + } + } + + for (var i = 0; i <= mThisCol; i++) { + switch (opsThisCol[i]) { + case 'mean': + result = meanValue; + break; + case 'sum': + result = sumValue; + break; + case 'min': + result = minValue; + break; + case 'max': + result = maxValue; + break; + case 'median': + result = medValue; + break; + case 'q1': + result = q1Value; + break; + case 'q3': + result = q3Value; + break; + } + + var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; + + //if outputType is defined + if (oTypeThisCol && result) { + result = result.toFixed(precision); + + if (_dom2.default.id(labThisCol[i])) { + switch (_string2.default.lower(oTypeThisCol)) { + case 'innerhtml': + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result; + } + break; + case 'setvalue': + _dom2.default.id(labThisCol[i]).value = result; + break; + case 'createtextnode': + var oldnode = _dom2.default.id(labThisCol[i]).firstChild; + var txtnode = _dom2.default.text(result); + _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); + break; + } //switch + } + } else { + try { + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); + } + } catch (e) {} //catch + } //else + } //for i + + // row(s) with result are always visible + var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; + if (totRow) { + totRow.style.display = ''; + } + } //for ucol + } //if typeof + + if (this.onAfterOperation) { + this.onAfterOperation.call(null, tf); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + // unsubscribe to events + this.tf.emitter.off(['after-filtering'], function () { + return _this2.calc(); + }); + } + }]); + + return ColOps; + })(); + + exports.default = ColOps; + +/***/ }, + +/***/ 30: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColsVisibility = (function () { + + /** + * Columns Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function ColsVisibility(tf, f) { + _classCallCheck(this, ColsVisibility); + + // Configuration object + var cfg = tf.config(); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Columns visibility manager'; + + //show/hide cols span element + this.spanEl = null; + //show/hide cols button element + this.btnEl = null; + //show/hide cols container div element + this.contEl = null; + + //tick to hide or show column + this.tickToHide = f.tick_to_hide === false ? false : true; + //enables/disables cols manager generation + this.manager = f.manager === false ? false : true; + //only if external headers + this.headersTbl = f.headers_table || false; + //only if external headers + this.headersIndex = f.headers_index || 1; + //id of container element + this.contElTgtId = f.container_target_id || null; + //alternative headers text + this.headersText = f.headers_text || null; + //id of button container element + this.btnTgtId = f.btn_target_id || null; + //defines show/hide cols text + this.btnText = f.btn_text || 'Columns▼'; + //defines show/hide cols button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for show/hide cols button + this.btnCssClass = f.btn_css_class || 'colVis'; + //defines close link text + this.btnCloseText = f.btn_close_text || 'Close'; + //defines close button innerHtml + this.btnCloseHtml = f.btn_close_html || null; + //defines css class for close button + this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; + this.stylesheet = f.stylesheet || 'colsVisibility.css'; + //span containing show/hide cols button + this.prfx = 'colVis_'; + //defines css class span containing show/hide cols + this.spanCssClass = f.span_css_class || 'colVisSpan'; + this.prfxCont = this.prfx + 'Cont_'; + //defines css class div containing show/hide cols + this.contCssClass = f.cont_css_class || 'colVisCont'; + //defines css class for cols list (ul) + this.listCssClass = cfg.list_css_class || 'cols_checklist'; + //defines css class for list item (li) + this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; + //defines css class for selected list item (li) + this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; + //text preceding columns list + this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); + this.atStart = f.at_start || null; + this.enableHover = Boolean(f.enable_hover); + //enables select all option + this.enableTickAll = Boolean(f.enable_tick_all); + //text preceding columns list + this.tickAllText = f.tick_all_text || 'Select all:'; + + //array containing hidden columns indexes + this.hiddenCols = []; + this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; + + //callback invoked just after cols manager is loaded + this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; + //calls function before cols manager is opened + this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; + //calls function after cols manager is opened + this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; + //calls function before cols manager is closed + this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; + //calls function after cols manager is closed + this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; + + //callback before col is hidden + this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; + //callback after col is hidden + this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; + //callback before col is displayed + this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; + //callback after col is displayed + this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; + + //Grid layout compatibility + if (tf.gridLayout) { + this.headersTbl = tf.feature('gridLayout').headTbl; //headers table + this.headersIndex = 0; //headers index + this.onAfterColDisplayed = function () {}; + this.onAfterColHidden = function () {}; + } + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + _createClass(ColsVisibility, [{ + key: 'toggle', + value: function toggle() { + var contDisplay = this.contEl.style.display; + var onBeforeOpen = this.onBeforeOpen; + var onBeforeClose = this.onBeforeClose; + var onAfterOpen = this.onAfterOpen; + var onAfterClose = this.onAfterClose; + + if (onBeforeOpen && contDisplay !== 'inline') { + onBeforeOpen.call(null, this); + } + if (onBeforeClose && contDisplay === 'inline') { + onBeforeClose.call(null, this); + } + + this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; + + if (onAfterOpen && contDisplay !== 'inline') { + onAfterOpen.call(null, this); + } + if (onAfterClose && contDisplay === 'inline') { + onAfterClose.call(null, this); + } + } + }, { + key: 'checkItem', + value: function checkItem(lbl) { + var li = lbl.parentNode; + if (!li || !lbl) { + return; + } + var isChecked = lbl.firstChild.checked; + var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; + colIndex = parseInt(colIndex, 10); + if (isChecked) { + _dom2.default.addClass(li, this.listSlcItemCssClass); + } else { + _dom2.default.removeClass(li, this.listSlcItemCssClass); + } + + var hide = false; + if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { + hide = true; + } + this.setHidden(colIndex, hide); + } + }, { + key: 'init', + value: function init() { + if (!this.manager) { + return; + } + this.buildBtn(); + this.buildManager(); + + this.initialized = true; + } + + /** + * Build main button UI + */ + + }, { + key: 'buildBtn', + value: function buildBtn() { + var _this = this; + + if (this.btnEl) { + return; + } + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.spanCssClass; + + //Container element (rdiv or custom element) + if (!this.btnTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); + + if (!this.btnTgtId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + if (!this.btnHtml) { + var btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCssClass; + btn.title = this.desc; + + btn.innerHTML = this.btnText; + span.appendChild(btn); + if (!this.enableHover) { + _event2.default.add(btn, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(btn, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } else { + //Custom html + span.innerHTML = this.btnHtml; + var colVisEl = span.firstChild; + if (!this.enableHover) { + _event2.default.add(colVisEl, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(colVisEl, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } + + this.spanEl = span; + this.btnEl = this.spanEl.firstChild; + + if (this.onLoaded) { + this.onLoaded.call(null, this); + } + } + + /** + * Build columns manager UI + */ + + }, { + key: 'buildManager', + value: function buildManager() { + var _this2 = this; + + var tf = this.tf; + + var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); + container.className = this.contCssClass; + + //Extension description + var extNameLabel = _dom2.default.create('p'); + extNameLabel.innerHTML = this.text; + container.appendChild(extNameLabel); + + //Headers list + var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); + ul.className = this.listCssClass; + + var tbl = this.headersTbl ? this.headersTbl : tf.tbl; + var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); + var headerRow = tbl.rows[headerIndex]; + + //Tick all option + if (this.enableTickAll) { + var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); + _dom2.default.addClass(li, this.listItemCssClass); + ul.appendChild(li); + li.check.checked = !this.tickToHide; + + _event2.default.add(li.check, 'click', function () { + for (var h = 0; h < headerRow.cells.length; h++) { + var itm = _dom2.default.id('col_' + h + '_' + tf.id); + if (itm && li.check.checked !== itm.checked) { + itm.click(); + itm.checked = li.check.checked; + } + } + }); + } + + for (var i = 0; i < headerRow.cells.length; i++) { + var cell = headerRow.cells[i]; + var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); + var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); + _dom2.default.addClass(liElm, this.listItemCssClass); + if (!this.tickToHide) { + _dom2.default.addClass(liElm, this.listSlcItemCssClass); + } + ul.appendChild(liElm); + if (!this.tickToHide) { + liElm.check.checked = true; + } + + _event2.default.add(liElm.check, 'click', function (evt) { + var elm = _event2.default.target(evt); + var lbl = elm.parentNode; + _this2.checkItem(lbl); + }); + } + + //separator + var p = _dom2.default.create('p', ['align', 'center']); + var btn; + //Close link + if (!this.btnCloseHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCloseCssClass; + btn.innerHTML = this.btnCloseText; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + p.appendChild(btn); + } else { + p.innerHTML = this.btnCloseHtml; + btn = p.firstChild; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + } + + container.appendChild(ul); + container.appendChild(p); + + this.btnEl.parentNode.insertBefore(container, this.btnEl); + this.contEl = container; + + if (this.atStart) { + var a = this.atStart; + for (var k = 0; k < a.length; k++) { + var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); + if (itm) { + itm.click(); + } + } + } + } + + /** + * Hide or show specified columns + * @param {Numner} colIndex Column index + * @param {Boolean} hide hide column if true or show if false + */ + + }, { + key: 'setHidden', + value: function setHidden(colIndex, hide) { + var tf = this.tf; + var tbl = tf.tbl; + + if (this.onBeforeColHidden && hide) { + this.onBeforeColHidden.call(null, this, colIndex); + } + if (this.onBeforeColDisplayed && !hide) { + this.onBeforeColDisplayed.call(null, this, colIndex); + } + + this._hideCells(tbl, colIndex, hide); + if (this.headersTbl) { + this._hideCells(this.headersTbl, colIndex, hide); + } + + var hiddenCols = this.hiddenCols; + var itemIndex = hiddenCols.indexOf(colIndex); + if (hide) { + if (itemIndex === -1) { + this.hiddenCols.push(colIndex); + } + } else { + if (itemIndex !== -1) { + this.hiddenCols.splice(itemIndex, 1); + } + } + + var gridLayout; + var headTbl; + var gridColElms; + if (this.onAfterColHidden && hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); + + var headTblW = parseInt(headTbl.style.width, 10); + headTbl.style.width = headTblW - hiddenWidth + 'px'; + tbl.style.width = headTbl.style.width; + } + this.onAfterColHidden.call(null, this, colIndex); + } + + if (this.onAfterColDisplayed && !hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var width = parseInt(gridColElms[colIndex].style.width, 10); + headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; + tf.tbl.style.width = headTbl.style.width; + } + this.onAfterColDisplayed.call(null, this, colIndex); + } + } + + /** + * Show specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'showCol', + value: function showCol(colIndex) { + if (colIndex === undefined || !this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, false); + } + } + + /** + * Hide specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'hideCol', + value: function hideCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, true); + } + } + + /** + * Determine if specified column is hidden + * @param {Number} colIndex Column index + */ + + }, { + key: 'isColHidden', + value: function isColHidden(colIndex) { + if (this.hiddenCols.indexOf(colIndex) !== -1) { + return true; + } + return false; + } + + /** + * Toggle visibility of specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggleCol', + value: function toggleCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + this.showCol(colIndex); + } else { + this.hideCol(colIndex); + } + } + + /** + * Returns the indexes of the columns currently hidden + * @return {Array} column indexes + */ + + }, { + key: 'getHiddenCols', + value: function getHiddenCols() { + return this.hiddenCols; + } + + /** + * Remove the columns manager + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + if (_dom2.default.id(this.contElTgtId)) { + _dom2.default.id(this.contElTgtId).innerHTML = ''; + } else { + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + } + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + this.initialized = false; + } + }, { + key: '_getHeaderText', + value: function _getHeaderText(cell) { + if (!cell.hasChildNodes) { + return ''; + } + + for (var i = 0; i < cell.childNodes.length; i++) { + var n = cell.childNodes[i]; + if (n.nodeType === 3) { + return n.nodeValue; + } else if (n.nodeType === 1) { + if (n.id && n.id.indexOf('popUp') !== -1) { + continue; + } else { + return _dom2.default.getText(n); + } + } + continue; + } + return ''; + } + }, { + key: '_hideCells', + value: function _hideCells(tbl, colIndex, hide) { + for (var i = 0; i < tbl.rows.length; i++) { + var row = tbl.rows[i]; + var cell = row.cells[colIndex]; + if (cell) { + cell.style.display = hide ? 'none' : ''; + } + } + } + }]); + + return ColsVisibility; + })(); + + exports.default = ColsVisibility; + +/***/ }, + +/***/ 31: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var FiltersVisibility = (function () { + + /** + * Filters Row Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function FiltersVisibility(tf, f) { + _classCallCheck(this, FiltersVisibility); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Filters row visibility manager'; + + // Path and image filenames + this.stylesheet = f.stylesheet || 'filtersVisibility.css'; + this.icnExpand = f.expand_icon_name || 'icn_exp.png'; + this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; + + //expand/collapse filters span element + this.contEl = null; + //expand/collapse filters btn element + this.btnEl = null; + + this.icnExpandHtml = 'Expand filters'; + this.icnCollapseHtml = 'Collapse filters'; + this.defaultText = 'Toggle filters'; + + //id of container element + this.targetId = f.target_id || null; + //enables/disables expand/collapse icon + this.enableIcon = f.enable_icon === false ? false : true; + this.btnText = f.btn_text || ''; + + //defines expand/collapse filters text + this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; + this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; + + //defines expand/collapse filters button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for expand/collapse filters button + this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; + //defines css class span containing expand/collapse filters + this.contCssClass = f.cont_css_class || 'expClpFlt'; + this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); + + this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; + + // Prefix + this.prfx = 'fltsVis_'; + + //callback before filters row is shown + this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; + //callback after filters row is shown + this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; + //callback before filters row is hidden + this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; + //callback after filters row is hidden + this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + /** + * Initialise extension + */ + + _createClass(FiltersVisibility, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + this.buildUI(); + this.initialized = true; + } + + /** + * Build UI elements + */ + + }, { + key: 'buildUI', + value: function buildUI() { + var _this = this; + + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.contCssClass; + + //Container element (rdiv or custom element) + if (!this.targetId) { + tf.setToolbar(); + } + var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); + + if (!this.targetId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + var btn = undefined; + if (!this.btnHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); + btn.className = this.btnCssClass; + btn.title = this.btnText || this.defaultText; + btn.innerHTML = this.collapseBtnHtml; + span.appendChild(btn); + } else { + //Custom html + span.innerHTML = this.btnHtml; + btn = span.firstChild; + } + + _event2.default.add(btn, 'click', function () { + return _this.toggle(); + }); + + this.contEl = span; + this.btnEl = btn; + + if (!this.visibleAtStart) { + this.toggle(); + } + } + + /** + * Toggle filters visibility + */ + + }, { + key: 'toggle', + value: function toggle() { + var tf = this.tf; + var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; + var fltRow = tbl.rows[this.filtersRowIndex]; + var fltRowDisplay = fltRow.style.display; + + if (this.onBeforeShow && fltRowDisplay !== '') { + this.onBeforeShow.call(this, this); + } + if (this.onBeforeHide && fltRowDisplay === '') { + this.onBeforeHide.call(null, this); + } + + fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; + if (this.enableIcon && !this.btnHtml) { + this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; + } + + if (this.onAfterShow && fltRowDisplay !== '') { + this.onAfterShow.call(null, this); + } + if (this.onAfterHide && fltRowDisplay === '') { + this.onAfterHide.call(null, this); + } + } + + /** + * Destroy the UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + this.initialized = false; + } + }]); + + return FiltersVisibility; + })(); + + exports.default = FiltersVisibility; + +/***/ }, + +/***/ 32: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterSortableTable = (function () { + + /** + * SortableTable Adapter module + * @param {Object} tf TableFilter instance + */ + + function AdapterSortableTable(tf, opts) { + _classCallCheck(this, AdapterSortableTable); + + this.initialized = false; + this.name = opts.name; + this.desc = opts.description || 'Sortable table'; + + //indicates if tables was sorted + this.sorted = false; + + this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; + this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; + this.asyncSort = Boolean(opts.async_sort); + this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; + + // edit .sort-arrow.descending / .sort-arrow.ascending in + // tablefilter.css to reflect any path change + this.imgPath = opts.images_path || tf.themesPath; + this.imgBlank = opts.image_blank || 'blank.png'; + this.imgClassName = opts.image_class_name || 'sort-arrow'; + this.imgAscClassName = opts.image_asc_class_name || 'ascending'; + this.imgDescClassName = opts.image_desc_class_name || 'descending'; + //cell attribute storing custom key + this.customKey = opts.custom_key || 'data-tf-sortKey'; + + // callback invoked after sort is loaded and instanciated + this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; + // callback invoked before table is sorted + this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; + // callback invoked after table is sorted + this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(AdapterSortableTable, [{ + key: 'init', + value: function init() { + var tf = this.tf; + var adpt = this; + + // SortableTable class sanity check (sortabletable.js) + if (_types2.default.isUndef(SortableTable)) { + throw new Error('SortableTable class not found.'); + } + + this.overrideSortableTable(); + this.setSortTypes(); + + //Column sort at start + var sortColAtStart = adpt.sortColAtStart; + if (sortColAtStart) { + this.stt.sort(sortColAtStart[0], sortColAtStart[1]); + } + + if (this.onSortLoaded) { + this.onSortLoaded.call(null, tf, this); + } + + /*** SortableTable callbacks ***/ + this.stt.onbeforesort = function () { + if (adpt.onBeforeSort) { + adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); + } + + /*** sort behaviour for paging ***/ + if (tf.paging) { + tf.feature('paging').disable(); + } + }; + + this.stt.onsort = function () { + adpt.sorted = true; + + //sort behaviour for paging + if (tf.paging) { + var paginator = tf.feature('paging'); + // recalculate valid rows index as sorting may have change it + tf.getValidRows(true); + paginator.enable(); + paginator.setPage(paginator.getPage()); + } + + if (adpt.onAfterSort) { + adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); + } + + adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn); + }; + + this.initialized = true; + } + + /** + * Sort specified column + * @param {Number} colIdx Column index + * @param {Boolean} desc Optional: descending manner + */ + + }, { + key: 'sortByColumnIndex', + value: function sortByColumnIndex(colIdx, desc) { + this.stt.sort(colIdx, desc); + } + }, { + key: 'overrideSortableTable', + value: function overrideSortableTable() { + var adpt = this, + tf = this.tf; + + /** + * Overrides headerOnclick method in order to handle th event + * @param {Object} e [description] + */ + SortableTable.prototype.headerOnclick = function (evt) { + if (!adpt.initialized) { + return; + } + + // find Header element + var el = evt.target || evt.srcElement; + + while (el.tagName !== 'TD' && el.tagName !== 'TH') { + el = el.parentNode; + } + + this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); + }; + + /** + * Overrides getCellIndex IE returns wrong cellIndex when columns are + * hidden + * @param {Object} oTd TD element + * @return {Number} Cell index + */ + SortableTable.getCellIndex = function (oTd) { + var cells = oTd.parentNode.cells, + l = cells.length, + i = undefined; + for (i = 0; cells[i] != oTd && i < l; i++) {} + return i; + }; + + /** + * Overrides initHeader in order to handle filters row position + * @param {Array} oSortTypes + */ + SortableTable.prototype.initHeader = function (oSortTypes) { + var stt = this; + if (!stt.tHead) { + if (tf.gridLayout) { + stt.tHead = tf.feature('gridLayout').headTbl.tHead; + } else { + return; + } + } + + stt.headersRow = tf.headersRow; + var cells = stt.tHead.rows[stt.headersRow].cells; + stt.sortTypes = oSortTypes || []; + var l = cells.length; + var img = undefined, + c = undefined; + + for (var i = 0; i < l; i++) { + c = cells[i]; + if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { + c.style.cursor = 'pointer'; + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + c.appendChild(img); + if (stt.sortTypes[i] !== null) { + c.setAttribute('_sortType', stt.sortTypes[i]); + } + _event2.default.add(c, 'click', stt._headerOnclick); + } else { + c.setAttribute('_sortType', oSortTypes[i]); + c._sortType = 'None'; + } + } + stt.updateHeaderArrows(); + }; + + /** + * Overrides updateHeaderArrows in order to handle arrows indicators + */ + SortableTable.prototype.updateHeaderArrows = function () { + var stt = this; + var cells = undefined, + l = undefined, + img = undefined; + + // external headers + if (adpt.asyncSort && adpt.triggerIds.length > 0) { + var triggers = adpt.triggerIds; + cells = []; + l = triggers.length; + for (var j = 0; j < triggers.length; j++) { + cells.push(_dom2.default.id(triggers[j])); + } + } else { + if (!this.tHead) { + return; + } + cells = stt.tHead.rows[stt.headersRow].cells; + l = cells.length; + } + for (var i = 0; i < l; i++) { + var cellAttr = cells[i].getAttribute('_sortType'); + if (cellAttr !== null && cellAttr !== 'None') { + img = cells[i].lastChild || cells[i]; + if (img.nodeName.toLowerCase() !== 'img') { + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + cells[i].appendChild(img); + } + if (i === stt.sortColumn) { + img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); + } else { + img.className = adpt.imgClassName; + } + } + } + }; + + /** + * Overrides getRowValue for custom key value feature + * @param {Object} oRow Row element + * @param {String} sType + * @param {Number} nColumn + * @return {String} + */ + SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { + var stt = this; + // if we have defined a custom getRowValue use that + var sortTypeInfo = stt._sortTypeInfo[sType]; + if (sortTypeInfo && sortTypeInfo.getRowValue) { + return sortTypeInfo.getRowValue(oRow, nColumn); + } + var c = oRow.cells[nColumn]; + var s = SortableTable.getInnerText(c); + return stt.getValueFromString(s, sType); + }; + + /** + * Overrides getInnerText in order to avoid Firefox unexpected sorting + * behaviour with untrimmed text elements + * @param {Object} oNode DOM element + * @return {String} DOM element inner text + */ + SortableTable.getInnerText = function (oNode) { + if (!oNode) { + return; + } + if (oNode.getAttribute(adpt.customKey)) { + return oNode.getAttribute(adpt.customKey); + } else { + return _dom2.default.getText(oNode); + } + }; + } + }, { + key: 'addSortType', + value: function addSortType() { + var args = arguments; + SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); + } + }, { + key: 'setSortTypes', + value: function setSortTypes() { + var _this = this; + + var tf = this.tf, + sortTypes = this.sortTypes, + _sortTypes = []; + + for (var i = 0; i < tf.nbCells; i++) { + var colType = undefined; + + if (sortTypes[i]) { + colType = sortTypes[i].toLowerCase(); + if (colType === 'none') { + colType = 'None'; + } + } else { + // resolve column types + if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { + colType = tf.colNbFormat[i].toLowerCase(); + } else if (tf.hasColDateType && tf.colDateType[i] !== null) { + colType = tf.colDateType[i].toLowerCase() + 'date'; + } else { + colType = 'String'; + } + } + _sortTypes.push(colType); + } + + //Public TF method to add sort type + + //Custom sort types + this.addSortType('number', Number); + this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); + this.addSortType('date', SortableTable.toDate); + this.addSortType('string'); + this.addSortType('us', usNumberConverter); + this.addSortType('eu', euNumberConverter); + this.addSortType('dmydate', dmyDateConverter); + this.addSortType('ymddate', ymdDateConverter); + this.addSortType('mdydate', mdyDateConverter); + this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); + this.addSortType('ipaddress', ipAddress, sortIP); + + this.stt = new SortableTable(tf.tbl, _sortTypes); + + /*** external table headers adapter ***/ + if (this.asyncSort && this.triggerIds.length > 0) { + (function () { + var triggers = _this.triggerIds; + for (var j = 0; j < triggers.length; j++) { + if (triggers[j] === null) { + continue; + } + var trigger = _dom2.default.id(triggers[j]); + if (trigger) { + trigger.style.cursor = 'pointer'; + + _event2.default.add(trigger, 'click', function (evt) { + var elm = evt.target; + if (!_this.tf.sort) { + return; + } + _this.stt.asyncSort(triggers.indexOf(elm.id)); + }); + trigger.setAttribute('_sortType', _sortTypes[j]); + } + } + })(); + } + } + + /** + * Destroy sort + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + this.sorted = false; + this.initialized = false; + this.stt.destroy(); + + var ids = tf.getFiltersId(); + for (var idx = 0; idx < ids.length; idx++) { + var header = tf.getHeaderElement(idx); + var img = _dom2.default.tag(header, 'img'); + + if (img.length === 1) { + header.removeChild(img[0]); + } + } + } + }]); + + return AdapterSortableTable; + })(); + + //Converters + + exports.default = AdapterSortableTable; + function usNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'us'); + } + function euNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'eu'); + } + function dateConverter(s, format) { + return _date2.default.format(s, format); + } + function dmyDateConverter(s) { + return dateConverter(s, 'DMY'); + } + function mdyDateConverter(s) { + return dateConverter(s, 'MDY'); + } + function ymdDateConverter(s) { + return dateConverter(s, 'YMD'); + } + function ddmmmyyyyDateConverter(s) { + return dateConverter(s, 'DDMMMYYYY'); + } + + function ipAddress(value) { + var vals = value.split('.'); + for (var x in vals) { + var val = vals[x]; + while (3 > val.length) { + val = '0' + val; + } + vals[x] = val; + } + return vals.join('.'); + } + + function sortIP(a, b) { + var aa = ipAddress(a.value.toLowerCase()); + var bb = ipAddress(b.value.toLowerCase()); + if (aa == bb) { + return 0; + } else if (aa < bb) { + return -1; + } else { + return 1; + } + } + +/***/ }, + +/***/ 33: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterSortabletable = __webpack_require__(32); + + var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + if (!window.SortableTable) { + __webpack_require__(34); + } // import 'script!sortabletable'; + + exports.default = _adapterSortabletable2.default; + +/***/ }, + +/***/ 34: +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") + +/***/ }, + +/***/ 35: +/***/ function(module, exports) { + + /* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra + */ + module.exports = function(src) { + if (typeof execScript === "function") + execScript(src); + else + eval.call(null, src); + } + +/***/ }, + +/***/ 36: +/***/ function(module, exports) { + + module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" + +/***/ } + +}); +//# sourceMappingURL=tf-1.js.map \ No newline at end of file diff --git a/package.json b/package.json index fec939af..39478b53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tablefilter", - "version": "0.1.5", + "version": "0.1.6", "description": "A Javascript library making HTML tables filterable and a bit more", "license": "MIT", "author": { diff --git a/src/extensions/advancedGrid/adapterEzEditTable.js b/src/extensions/advancedGrid/adapterEzEditTable.js index a08ed906..f37f200c 100644 --- a/src/extensions/advancedGrid/adapterEzEditTable.js +++ b/src/extensions/advancedGrid/adapterEzEditTable.js @@ -26,6 +26,7 @@ export default class AdapterEzEditTable { this._ezEditTable = null; this.cfg = cfg; this.tf = tf; + this.emitter = tf.emitter; } /** @@ -43,6 +44,10 @@ export default class AdapterEzEditTable { if(this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')){ tf.import(this.stylesheetName, this.stylesheet, null, 'link'); } + + // TODO: hack to prevent ezEditTable enter key event hijaking. + // Needs to be fixed in the vendor's library + this.emitter.on(['filter-focus', 'filter-blur'], ()=> this.toggle()); } /** @@ -358,6 +363,23 @@ export default class AdapterEzEditTable { } } + /** + * Toggle behaviour + */ + toggle(){ + var ezEditTable = this._ezEditTable; + if(ezEditTable.editable){ + ezEditTable.Editable.Remove(); + } else { + ezEditTable.Editable.Set(); + } + if(ezEditTable.selection){ + ezEditTable.Selection.Remove(); + } else { + ezEditTable.Selection.Set(); + } + } + /** * Remove advanced grid */ @@ -372,6 +394,8 @@ export default class AdapterEzEditTable { ezEditTable.Editable.Remove(); } } + + this.emitter.off(['filter-focus', 'filter-blur'], ()=> this.toggle()); this.initialized = false; } } diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index faf099f9..7d3c24b8 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -36,6 +36,23 @@ export class Dropdown extends Feature{ this.slcInnerHtml = null; } + onSlcFocus(e) { + let elm = Event.target(e); + let tf = this.tf; + tf.activeFilterId = elm.getAttribute('id'); + tf.activeFlt = Dom.id(tf.activeFilterId); + // select is populated when element has focus + if(tf.loadFltOnDemand && elm.getAttribute('filled') === '0'){ + let ct = elm.getAttribute('ct'); + this.build(ct); + } + // if(tf.popupFilters){ + // Event.cancel(e); + // Event.stop(e); + // } + this.emitter.emit('filter-focus', tf, this); + } + /** * Initialize drop-down filter * @param {Number} colIndex Column index @@ -80,7 +97,7 @@ export class Dropdown extends Feature{ Event.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); Event.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); - Event.add(slc, 'focus', tf.Evt.onSlcFocus.bind(tf)); + Event.add(slc, 'focus', (e)=> this.onSlcFocus(e)); this.initialized = true; } diff --git a/src/tablefilter.js b/src/tablefilter.js index 2257f790..1fd88caa 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -472,18 +472,7 @@ export class TableFilter { this.isUserTyping = false; global.clearInterval(this.autoFilterTimer); } - // TODO: hack to prevent ezEditTable enter key event hijaking. - // Needs to be fixed in the vendor's library - if(this.hasExtension('advancedGrid')){ - var advGrid = this.extension('advancedGrid'); - var ezEditTable = advGrid._ezEditTable; - if(advGrid.cfg.editable){ - ezEditTable.Editable.Set(); - } - if(advGrid.cfg.selection){ - ezEditTable.Selection.Set(); - } - } + this.emitter.emit('filter-blur', this); }, // set focused text-box filter as active onInpFocus(e) { @@ -494,35 +483,25 @@ export class TableFilter { Event.cancel(e); Event.stop(e); } - // TODO: hack to prevent ezEditTable enter key event hijaking. - // Needs to be fixed in the vendor's library - if(this.hasExtension('advancedGrid')){ - var advGrid = this.extension('advancedGrid'); - var ezEditTable = advGrid._ezEditTable; - if(advGrid.cfg.editable){ - ezEditTable.Editable.Remove(); - } - if(advGrid.cfg.selection){ - ezEditTable.Selection.Remove(); - } - } + this.emitter.emit('filter-focus', this); }, // set focused drop-down filter as active - onSlcFocus(e) { - // let _ev = e || global.event; - let elm = Event.target(e); - this.activeFilterId = elm.getAttribute('id'); - this.activeFlt = Dom.id(this.activeFilterId); - // select is populated when element has focus - if(this.loadFltOnDemand && elm.getAttribute('filled') === '0'){ - let ct = elm.getAttribute('ct'); - this.Mod.dropdown.build(ct); - } - if(this.popupFilters){ - Event.cancel(e); - Event.stop(e); - } - }, + // onSlcFocus(e) { + // let elm = Event.target(e); + // this.activeFilterId = elm.getAttribute('id'); + // this.activeFlt = Dom.id(this.activeFilterId); + // // select is populated when element has focus + // if(this.loadFltOnDemand && elm.getAttribute('filled')==='0'){ + // let ct = elm.getAttribute('ct'); + // console.log('onSlcFocus'); + // this.Mod.dropdown.build(ct); + // } + // if(this.popupFilters){ + // Event.cancel(e); + // Event.stop(e); + // } + // this.emitter.emit('filter-focus', this); + // }, // filter columns on drop-down filter change onSlcChange(e) { if(!this.activeFlt){ return; } diff --git a/test/test-popup-filter.js b/test/test-popup-filter.js index 366c85c9..f6031440 100644 --- a/test/test-popup-filter.js +++ b/test/test-popup-filter.js @@ -160,11 +160,11 @@ test('Properties', function() { 'function', 'Feature enable method'); }); -module('Tear-down'); -test('TableFilter removed', function() { - tf.destroy(); - var fltIcn1 = popupFilter.popUpFltImgs[3]; - deepEqual(fltIcn1, undefined, 'Filter icon is removed'); - deepEqual(id(tf.fltIds[3]), null, 'Filter is removed'); - deepEqual(tf.hasGrid(), false, 'Filters removed'); -}); +// module('Tear-down'); +// test('TableFilter removed', function() { +// tf.destroy(); +// var fltIcn1 = popupFilter.popUpFltImgs[3]; +// deepEqual(fltIcn1, undefined, 'Filter icon is removed'); +// deepEqual(id(tf.fltIds[3]), null, 'Filter is removed'); +// deepEqual(tf.hasGrid(), false, 'Filters removed'); +// }); From 4e2ae18aff6b5cf1c77e3d8ea77c6fcaf8b86dac Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Tue, 12 Jan 2016 17:46:27 +1100 Subject: [PATCH 25/41] Continued pub-sub refactoring --- dist/starter.html | 514 ++ dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 7779 +---------------- dist/tablefilter/tf-1.js | 2224 +---- src/modules/checkList.js | 20 +- src/modules/dropdown.js | 13 +- src/tablefilter.js | 23 - test/test-popup-filter.js | 16 +- 13 files changed, 565 insertions(+), 10036 deletions(-) create mode 100644 dist/starter.html diff --git a/dist/starter.html b/dist/starter.html new file mode 100644 index 00000000..eb061487 --- /dev/null +++ b/dist/starter.html @@ -0,0 +1,514 @@ + + + + tablefilter v0.1.6 - Starter + + +

tablefilter v0.1.6

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
countryisoyearPOPXRATPPPcgdpccci
BeninBEN19985950.33589.9517822190.951178.4690.987.55
BeninBEN19996109.53615.6990967200.191174.9092.617.86
BeninBEN20006272.00711.9763184200.611224.7492.278.25
Burkina FasoBFA19949755.03555.2047119125.76838.7679.816.57
Burkina FasoBFA19959988.00499.148407136.65860.8980.419.29
Burkina FasoBFA199610225.00511.5523987144.18881.1180.4012.12
Burkina FasoBFA199710473.53583.6693726141.78899.0176.9414.94
RussiaRUS1998146899.019.7050828932.647086.3967.739.20
RussiaRUS1999146308.9924.61993984.038074.7057.358.81
RussiaRUS2000145555.0128.129169464.859995.9154.748.79
RwandaRWA19946230.00194.51750.39529.48132.164.48
RwandaRWA19956400.00262.197509870.67746.3492.773.08
RwandaRWA19966727.00306.820007377.90823.2589.713.21
RwandaRWA19977895.18301.529785284.13847.7991.443.72
RwandaRWA19988105.00312.314086985.32914.2289.344.22
El SalvadorSLV19955669.008.7545833593.544143.5989.3110.35
El SalvadorSLV19965798.008.7550001143.694235.7988.777.79
El SalvadorSLV19975911.008.7562503813.744408.4187.057.90
Slovak RepublicSVK20005401.0046.035213.0212618.5352.2224.78
SloveniaSVN19941988.90128.808593879.9711662.1253.2119.87
SloveniaSVN19951990.00118.518501389.0312574.9654.4623.11
SloveniaSVN19961991.00135.364303697.2713151.5154.3223.23
SloveniaSVN19971985.96159.6882935103.9614143.0253.2424.14
SloveniaSVN19981982.60166.134201108.9315067.3452.8225.35
ZambiaZMB19948740.72669.3706055307.48834.1975.439.86
ZambiaZMB19958980.00864.1192017402.40829.3776.5510.31
ZambiaZMB19969214.401207.900024515.01838.0578.7410.99
ZambiaZMB19979443.211314.498047596.97851.4777.5912.15
ZambiaZMB19989665.711862.06897744.91800.6985.1213.75
ZambiaZMB19999881.212388.019043941.87765.2491.8215.30
ZambiaZMB200010089.003110.8439941157.63840.9786.3315.38
ZimbabweZWE199410775.358.1515388492.012586.8460.1018.53
ZimbabweZWE199511011.008.665375712.152603.3766.8915.03
ZimbabweZWE199611242.1610.002349852.642860.2372.0611.32
ZimbabweZWE199711923.5212.111289983.172727.0682.8211.01
ZimbabweZWE199812153.8523.679109574.062799.8577.6610.75
ZimbabweZWE199912388.3238.301200876.122770.4876.8910.73
ZimbabweZWE200012627.0044.417919169.482607.0369.238.62
+ + + + + + +

+
+
+
+
+
+
+
+
+
diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index 71d1f540..64004c3f 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.6 by Max Guglielmi 
- *	 build date: 2016-01-11T07:16:04.434Z 
+ *	 build date: 2016-01-12T06:41:18.983Z 
  *	 MIT License  
  */ 
 span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
\ No newline at end of file
diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css
index a7b18d42..9e6e51d3 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.6 by Max Guglielmi 
- *	 build date: 2016-01-11T07:16:04.434Z 
+ *	 build date: 2016-01-12T06:41:18.983Z 
  *	 MIT License  
  */ 
 span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
\ No newline at end of file
diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css
index 02a4ac92..146f56b8 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.6 by Max Guglielmi 
- *	 build date: 2016-01-11T07:16:04.434Z 
+ *	 build date: 2016-01-12T06:41:18.983Z 
  *	 MIT License  
  */ 
 .activeHeader{background-color:#66afe9 !important;color:#fff !important}
diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css
index 36d63a83..401dfb92 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.6 by Max Guglielmi 
- *	 build date: 2016-01-11T07:16:04.434Z 
+ *	 build date: 2016-01-12T06:41:18.983Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css
index e9855df8..eb9b4cd1 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.6 by Max Guglielmi 
- *	 build date: 2016-01-11T07:16:04.434Z 
+ *	 build date: 2016-01-12T06:41:18.983Z 
  *	 MIT License  
  */ 
 table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
\ No newline at end of file
diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css
index 4d20e53f..b52babb7 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
 /** 
  *	 tablefilter v0.1.6 by Max Guglielmi 
- *	 build date: 2016-01-11T07:16:04.434Z 
+ *	 build date: 2016-01-12T06:41:18.983Z 
  *	 MIT License  
  */ 
 table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
index e46f89bf..0e55ab64 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -1,7771 +1,10 @@
-(function webpackUniversalModuleDefinition(root, factory) {
-	if(typeof exports === 'object' && typeof module === 'object')
-		module.exports = factory();
-	else if(typeof define === 'function' && define.amd)
-		define([], factory);
-	else {
-		var a = factory();
-		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
-	}
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ 	// install a JSONP callback for chunk loading
-/******/ 	var parentJsonpFunction = window["webpackJsonp"];
-/******/ 	window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
-/******/ 		// add "moreModules" to the modules object,
-/******/ 		// then flag all "chunkIds" as loaded and fire callback
-/******/ 		var moduleId, chunkId, i = 0, callbacks = [];
-/******/ 		for(;i < chunkIds.length; i++) {
-/******/ 			chunkId = chunkIds[i];
-/******/ 			if(installedChunks[chunkId])
-/******/ 				callbacks.push.apply(callbacks, installedChunks[chunkId]);
-/******/ 			installedChunks[chunkId] = 0;
-/******/ 		}
-/******/ 		for(moduleId in moreModules) {
-/******/ 			modules[moduleId] = moreModules[moduleId];
-/******/ 		}
-/******/ 		if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
-/******/ 		while(callbacks.length)
-/******/ 			callbacks.shift().call(null, __webpack_require__);
-/******/
-/******/ 	};
-/******/
-/******/ 	// The module cache
-/******/ 	var installedModules = {};
-/******/
-/******/ 	// object to store loaded and loading chunks
-/******/ 	// "0" means "already loaded"
-/******/ 	// Array means "loading", array contains callbacks
-/******/ 	var installedChunks = {
-/******/ 		0:0
-/******/ 	};
-/******/
-/******/ 	// The require function
-/******/ 	function __webpack_require__(moduleId) {
-/******/
-/******/ 		// Check if module is in cache
-/******/ 		if(installedModules[moduleId])
-/******/ 			return installedModules[moduleId].exports;
-/******/
-/******/ 		// Create a new module (and put it into the cache)
-/******/ 		var module = installedModules[moduleId] = {
-/******/ 			exports: {},
-/******/ 			id: moduleId,
-/******/ 			loaded: false
-/******/ 		};
-/******/
-/******/ 		// Execute the module function
-/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ 		// Flag the module as loaded
-/******/ 		module.loaded = true;
-/******/
-/******/ 		// Return the exports of the module
-/******/ 		return module.exports;
-/******/ 	}
-/******/
-/******/ 	// This file contains only the entry chunk.
-/******/ 	// The chunk loading function for additional chunks
-/******/ 	__webpack_require__.e = function requireEnsure(chunkId, callback) {
-/******/ 		// "0" is the signal for "already loaded"
-/******/ 		if(installedChunks[chunkId] === 0)
-/******/ 			return callback.call(null, __webpack_require__);
-/******/
-/******/ 		// an array means "currently loading".
-/******/ 		if(installedChunks[chunkId] !== undefined) {
-/******/ 			installedChunks[chunkId].push(callback);
-/******/ 		} else {
-/******/ 			// start chunk loading
-/******/ 			installedChunks[chunkId] = [callback];
-/******/ 			var head = document.getElementsByTagName('head')[0];
-/******/ 			var script = document.createElement('script');
-/******/ 			script.type = 'text/javascript';
-/******/ 			script.charset = 'utf-8';
-/******/ 			script.async = true;
-/******/
-/******/ 			script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js";
-/******/ 			head.appendChild(script);
-/******/ 		}
-/******/ 	};
-/******/
-/******/ 	// expose the modules object (__webpack_modules__)
-/******/ 	__webpack_require__.m = modules;
-/******/
-/******/ 	// expose the module cache
-/******/ 	__webpack_require__.c = installedModules;
-/******/
-/******/ 	// __webpack_public_path__
-/******/ 	__webpack_require__.p = "";
-/******/
-/******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
+/** 
+ *	 tablefilter v0.1.6 by Max Guglielmi
+ *	 build date: 2016-01-12T06:41:18.898Z 
+ *	 MIT License  
+ */ 
 
-	'use strict';
-	
-	var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-	
-	// Features
-	
-	Object.defineProperty(exports, "__esModule", {
-	    value: true
-	});
-	exports.TableFilter = undefined;
-	
-	var _event = __webpack_require__(1);
-	
-	var _event2 = _interopRequireDefault(_event);
-	
-	var _dom = __webpack_require__(2);
-	
-	var _dom2 = _interopRequireDefault(_dom);
-	
-	var _string = __webpack_require__(3);
-	
-	var _string2 = _interopRequireDefault(_string);
-	
-	var _cookie = __webpack_require__(4);
-	
-	var _cookie2 = _interopRequireDefault(_cookie);
-	
-	var _types = __webpack_require__(5);
-	
-	var _types2 = _interopRequireDefault(_types);
-	
-	var _array = __webpack_require__(6);
-	
-	var _array2 = _interopRequireDefault(_array);
-	
-	var _date = __webpack_require__(7);
-	
-	var _date2 = _interopRequireDefault(_date);
-	
-	var _helpers = __webpack_require__(8);
-	
-	var _helpers2 = _interopRequireDefault(_helpers);
-	
-	var _emitter = __webpack_require__(9);
-	
-	var _store = __webpack_require__(10);
-	
-	var _gridLayout = __webpack_require__(11);
-	
-	var _loader = __webpack_require__(13);
-	
-	var _highlightKeywords = __webpack_require__(14);
-	
-	var _popupFilter = __webpack_require__(15);
-	
-	var _dropdown = __webpack_require__(16);
-	
-	var _checkList = __webpack_require__(18);
-	
-	var _rowsCounter = __webpack_require__(19);
-	
-	var _statusBar = __webpack_require__(20);
-	
-	var _paging = __webpack_require__(21);
-	
-	var _clearButton = __webpack_require__(22);
-	
-	var _help = __webpack_require__(23);
-	
-	var _alternateRows = __webpack_require__(24);
-	
-	var _noResults = __webpack_require__(25);
-	
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-	
-	function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
-	
-	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-	
-	var global = window,
-	    doc = global.document;
-	
-	var TableFilter = exports.TableFilter = (function () {
-	
-	    /**
-	     * TableFilter object constructor
-	     * requires `table` or `id` arguments, `row` and `configuration` optional
-	     * @param {DOMElement} table Table DOM element
-	     * @param {String} id Table id
-	     * @param {Number} row index indicating the 1st row
-	     * @param {Object} configuration object
-	     */
-	
-	    function TableFilter() {
-	        var _this = this;
-	
-	        _classCallCheck(this, TableFilter);
-	
-	        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
-	            args[_key] = arguments[_key];
-	        }
-	
-	        if (args.length === 0) {
-	            return;
-	        }
-	
-	        this.id = null;
-	        this.version = '0.1.6';
-	        this.year = new Date().getFullYear();
-	        this.tbl = null;
-	        this.startRow = null;
-	        this.refRow = null;
-	        this.headersRow = null;
-	        this.cfg = {};
-	        this.nbFilterableRows = null;
-	        this.nbRows = null;
-	        this.nbCells = null;
-	        this._hasGrid = false;
-	
-	        // TODO: use for-of with babel plug-in
-	        args.forEach(function (arg) {
-	            // for (let arg of args) {
-	            var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg);
-	            if (argtype === 'object' && arg && arg.nodeName === 'TABLE') {
-	                _this.tbl = arg;
-	                _this.id = arg.id || 'tf_' + new Date().getTime() + '_';
-	            } else if (argtype === 'string') {
-	                _this.id = arg;
-	                _this.tbl = _dom2.default.id(arg);
-	            } else if (argtype === 'number') {
-	                _this.startRow = arg;
-	            } else if (argtype === 'object') {
-	                _this.cfg = arg;
-	            }
-	            // }
-	        });
-	
-	        if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) {
-	            throw new Error('Could not instantiate TableFilter: HTML table not found.');
-	        }
-	
-	        // configuration object
-	        var f = this.cfg;
-	
-	        this.emitter = new _emitter.Emitter();
-	
-	        //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 || 'tablefilter/';
-	
-	        /*** filter types ***/
-	        this.fltTypeInp = 'input';
-	        this.fltTypeSlc = 'select';
-	        this.fltTypeMulti = 'multiple';
-	        this.fltTypeCheckList = 'checklist';
-	        this.fltTypeNone = 'none';
-	
-	        /*** filters' grid properties ***/
-	
-	        //enables/disables filter grid
-	        this.fltGrid = f.grid === false ? false : true;
-	
-	        //enables/disables grid layout (fixed headers)
-	        this.gridLayout = Boolean(f.grid_layout);
-	
-	        this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index;
-	        this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index;
-	
-	        //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 valid rows indexes (rows visible upon filtering)
-	        this.validRowsIndex = [];
-	        //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;
-	
-	        //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.stylePath = f.style_path || this.basePath + 'style/';
-	        this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows);
-	        //defines widths of columns
-	        this.hasColWidths = _types2.default.isArray(f.col_widths);
-	        this.colWidths = this.hasColWidths ? f.col_widths : null;
-	        //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';
-	
-	        /*** filters' grid behaviours ***/
-	        //enables/disables enter key
-	        this.enterKey = f.enter_key === false ? false : true;
-	        //calls function before filtering starts
-	        this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null;
-	        //calls function after filtering
-	        this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null;
-	        //enables/disables case sensitivity
-	        this.caseSensitive = Boolean(f.case_sensitive);
-	        //has exact match per column
-	        this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match);
-	        this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : [];
-	        //enables/disbles exact match for search
-	        this.exactMatch = Boolean(f.exact_match);
-	        //refreshes drop-down lists upon validation
-	        this.linkedFilters = Boolean(f.linked_filters);
-	        //wheter excluded options are disabled
-	        this.disableExcludedOptions = Boolean(f.disable_excluded_options);
-	        //stores active filter element
-	        this.activeFlt = null;
-	        //id of active filter
-	        this.activeFilterId = null;
-	        //enables always visible rows
-	        this.hasVisibleRows = Boolean(f.rows_always_visible);
-	        //array containing always visible rows
-	        this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : [];
-	        //enables/disables external filters generation
-	        this.isExternalFlt = Boolean(f.external_flt_grid);
-	        //array containing ids of external elements containing filters
-	        this.externalFltTgtIds = f.external_flt_grid_ids || [];
-	        //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null;
-	        //enables/disables single filter search
-	        this.singleSearchFlt = Boolean(f.single_filter);
-	        //calls function after row is validated
-	        this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null;
-	        //input watermark text array
-	        this.watermark = f.watermark || '';
-	        this.isWatermarkArray = _types2.default.isArray(this.watermark);
-	        //id of toolbar container element
-	        this.toolBarTgtId = f.toolbar_target_id || null;
-	        //enables/disables help div
-	        this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions);
-	        //popup filters
-	        this.popupFilters = Boolean(f.popup_filters);
-	        //active columns color
-	        this.markActiveColumns = Boolean(f.mark_active_columns);
-	        //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null;
-	        //calls function after active column header is marked
-	        this.onAfterActiveColumn = _types2.default.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 || 'Clear';
-	        //enables/disables empty option in combo-box filters
-	        this.enableEmptyOption = Boolean(f.enable_empty_option);
-	        //defines empty option text
-	        this.emptyText = f.empty_text || '(Empty)';
-	        //enables/disables non empty option in combo-box filters
-	        this.enableNonEmptyOption = Boolean(f.enable_non_empty_option);
-	        //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 = Boolean(f.sort_num_asc);
-	        this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null;
-	        //enables/disables descending numeric options sorting
-	        this.isSortNumDesc = Boolean(f.sort_num_desc);
-	        this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null;
-	        //Select filters are populated on demand
-	        this.loadFltOnDemand = Boolean(f.load_filters_on_demand);
-	        this.hasCustomOptions = _types2.default.isObj(f.custom_options);
-	        this.customOptions = f.custom_options;
-	
-	        /*** 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 || '^[¥£€$]';
-	        this.separator = f.separator || ',';
-	
-	        /*** rows counter ***/
-	        //show/hides rows counter
-	        this.rowsCounter = Boolean(f.rows_counter);
-	
-	        /*** status bar ***/
-	        //show/hides status bar
-	        this.statusBar = Boolean(f.status_bar);
-	
-	        /*** loader ***/
-	        //enables/disables loader/spinner indicator
-	        this.loader = Boolean(f.loader);
-	
-	        /*** validation - reset buttons/links ***/
-	        //show/hides filter's validation button
-	        this.displayBtn = Boolean(f.btn);
-	        //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 = Boolean(f.btn_reset);
-	        //defines css class for reset button
-	        this.btnResetCssClass = f.btn_reset_css_class || 'reset';
-	        //callback function before filters are cleared
-	        this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null;
-	        //callback function after filters are cleared
-	        this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null;
-	
-	        /*** paging ***/
-	        //enables/disables table paging
-	        this.paging = Boolean(f.paging);
-	        this.nbVisibleRows = 0; //nb visible rows
-	        this.nbHiddenRows = 0; //nb hidden rows
-	
-	        /*** autofilter on typing ***/
-	        //enables/disables auto filtering, table is filtered when user stops
-	        //typing
-	        this.autoFilter = Boolean(f.auto_filter);
-	        //onkeyup delay timer (msecs)
-	        this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900;
-	        //typing indicator
-	        this.isUserTyping = null;
-	        this.autoFilterTimer = null;
-	
-	        /*** keyword highlighting ***/
-	        //enables/disables keyword highlighting
-	        this.highlightKeywords = Boolean(f.highlight_keywords);
-	
-	        /*** No results feature ***/
-	        this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message);
-	
-	        /*** 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 = _types2.default.isArray(f.col_number_format);
-	        //array containing columns nb formats
-	        this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null;
-	        //enables date type per column
-	        this.hasColDateType = _types2.default.isArray(f.col_date_type);
-	        //array containing columns date type
-	        this.colDateType = this.hasColDateType ? f.col_date_type : null;
-	
-	        /*** 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_';
-	        //filter values cookie
-	        this.prfxCookieFltsValues = 'tf_flts_';
-	        //page nb cookie
-	        this.prfxCookiePageNb = 'tf_pgnb_';
-	        //page length cookie
-	        this.prfxCookiePageLen = 'tf_pglen_';
-	
-	        /*** cookies ***/
-	        this.hasStoredValues = false;
-	        //remembers filters values on page load
-	        this.rememberGridValues = Boolean(f.remember_grid_values);
-	        //cookie storing filter values
-	        this.fltsValuesCookie = this.prfxCookieFltsValues + this.id;
-	        //remembers page nb on page load
-	        this.rememberPageNb = this.paging && f.remember_page_number;
-	        //cookie storing page nb
-	        this.pgNbCookie = this.prfxCookiePageNb + this.id;
-	        //remembers page length on page load
-	        this.rememberPageLen = this.paging && f.remember_page_length;
-	        //cookie storing page length
-	        this.pgLenCookie = this.prfxCookiePageLen + this.id;
-	
-	        /*** extensions ***/
-	        //imports external script
-	        this.extensions = f.extensions;
-	        this.hasExtensions = _types2.default.isArray(this.extensions);
-	
-	        /*** themes ***/
-	        this.enableDefaultTheme = Boolean(f.enable_default_theme);
-	        //imports themes
-	        this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes);
-	        this.themes = f.themes || [];
-	        //themes path
-	        this.themesPath = f.themes_path || this.stylePath + 'themes/';
-	
-	        // Features registry
-	        this.Mod = {};
-	
-	        // Extensions registry
-	        this.ExtRegistry = {};
-	
-	        /*** TF events ***/
-	        this.Evt = {
-	            // Detect  key
-	
-	            detectKey: function detectKey(e) {
-	                if (!this.enterKey) {
-	                    return;
-	                }
-	                if (e) {
-	                    var key = _event2.default.keyCode(e);
-	                    if (key === 13) {
-	                        this.filter();
-	                        _event2.default.cancel(e);
-	                        _event2.default.stop(e);
-	                    } else {
-	                        this.isUserTyping = true;
-	                        global.clearInterval(this.autoFilterTimer);
-	                        this.autoFilterTimer = null;
-	                    }
-	                }
-	            },
-	
-	            // if auto-filter on, detect user is typing and filter columns
-	            onKeyUp: function onKeyUp(e) {
-	                if (!this.autoFilter) {
-	                    return;
-	                }
-	                var key = _event2.default.keyCode(e);
-	                this.isUserTyping = false;
-	
-	                function filter() {
-	                    /*jshint validthis:true */
-	                    global.clearInterval(this.autoFilterTimer);
-	                    this.autoFilterTimer = null;
-	                    if (!this.isUserTyping) {
-	                        this.filter();
-	                        this.isUserTyping = null;
-	                    }
-	                }
-	
-	                if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) {
-	                    if (this.autoFilterTimer === null) {
-	                        this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay);
-	                    }
-	                } else {
-	                    global.clearInterval(this.autoFilterTimer);
-	                    this.autoFilterTimer = null;
-	                }
-	            },
-	
-	            // if auto-filter on, detect user is typing
-	            onKeyDown: function onKeyDown() {
-	                if (!this.autoFilter) {
-	                    return;
-	                }
-	                this.isUserTyping = true;
-	            },
-	
-	            // if auto-filter on, clear interval on filter blur
-	            onInpBlur: function onInpBlur() {
-	                if (this.autoFilter) {
-	                    this.isUserTyping = false;
-	                    global.clearInterval(this.autoFilterTimer);
-	                }
-	                this.emitter.emit('filter-blur', this);
-	            },
-	
-	            // set focused text-box filter as active
-	            onInpFocus: function onInpFocus(e) {
-	                var elm = _event2.default.target(e);
-	                this.activeFilterId = elm.getAttribute('id');
-	                this.activeFlt = _dom2.default.id(this.activeFilterId);
-	                if (this.popupFilters) {
-	                    _event2.default.cancel(e);
-	                    _event2.default.stop(e);
-	                }
-	                this.emitter.emit('filter-focus', this);
-	            },
-	
-	            // set focused drop-down filter as active
-	            // onSlcFocus(e) {
-	            //     let elm = Event.target(e);
-	            //     this.activeFilterId = elm.getAttribute('id');
-	            //     this.activeFlt = Dom.id(this.activeFilterId);
-	            //     // select is populated when element has focus
-	            //     if(this.loadFltOnDemand && elm.getAttribute('filled')==='0'){
-	            //         let ct = elm.getAttribute('ct');
-	            //         console.log('onSlcFocus');
-	            //         this.Mod.dropdown.build(ct);
-	            //     }
-	            //     if(this.popupFilters){
-	            //         Event.cancel(e);
-	            //         Event.stop(e);
-	            //     }
-	            //     this.emitter.emit('filter-focus', this);
-	            // },
-	            // filter columns on drop-down filter change
-	            onSlcChange: function onSlcChange(e) {
-	                if (!this.activeFlt) {
-	                    return;
-	                }
-	                if (this.popupFilters) {
-	                    _event2.default.stop(e);
-	                }
-	                if (this.onSlcChange) {
-	                    this.filter();
-	                }
-	            }
-	        };
-	    }
-	
-	    /**
-	     * Initialise filtering grid bar behaviours and layout
-	     *
-	     * TODO: decompose in smaller methods
-	     */
-	
-	    _createClass(TableFilter, [{
-	        key: 'init',
-	        value: function init() {
-	            var _this2 = this;
-	
-	            if (this._hasGrid) {
-	                return;
-	            }
-	
-	            var Mod = this.Mod;
-	            var n = this.singleSearchFlt ? 1 : this.nbCells,
-	                inpclass = undefined;
-	
-	            //loads stylesheet if not imported
-	            this.import(this.stylesheetId, this.stylesheet, null, 'link');
-	
-	            //loads theme
-	            if (this.hasThemes) {
-	                this.loadThemes();
-	            }
-	
-	            if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) {
-	                Mod.store = new _store.Store(this);
-	                Mod.store.init();
-	            }
-	
-	            if (this.gridLayout) {
-	                Mod.gridLayout = new _gridLayout.GridLayout(this);
-	                Mod.gridLayout.init();
-	            }
-	
-	            if (this.loader) {
-	                if (!Mod.loader) {
-	                    Mod.loader = new _loader.Loader(this);
-	                }
-	                Mod.loader.init();
-	            }
-	
-	            if (this.highlightKeywords) {
-	                Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this);
-	                Mod.highlightKeyword.init();
-	            }
-	
-	            if (this.popupFilters) {
-	                if (!Mod.popupFilter) {
-	                    Mod.popupFilter = new _popupFilter.PopupFilter(this);
-	                }
-	                Mod.popupFilter.init();
-	            }
-	
-	            //filters grid is not generated
-	            if (!this.fltGrid) {
-	                this._initNoFilters();
-	            } else {
-	                if (this.isFirstLoad) {
-	                    var fltrow = this._insertFiltersRow();
-	
-	                    this.nbFilterableRows = this.getRowsNb();
-	                    this.nbVisibleRows = this.nbFilterableRows;
-	                    this.nbRows = this.tbl.rows.length;
-	
-	                    // Generate filters
-	                    for (var i = 0; i < n; i++) {
-	                        this.emitter.emit('before-filter-init', this, i);
-	
-	                        var fltcell = _dom2.default.create(this.fltCellTag),
-	                            col = this.getFilterType(i);
-	
-	                        if (this.singleSearchFlt) {
-	                            fltcell.colSpan = this.nbCells;
-	                        }
-	                        if (!this.gridLayout) {
-	                            fltrow.appendChild(fltcell);
-	                        }
-	                        inpclass = i == n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass;
-	
-	                        //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 (!Mod.dropdown) {
-	                                Mod.dropdown = new _dropdown.Dropdown(this);
-	                            }
-	                            Mod.dropdown.init(i, this.isExternalFlt, fltcell);
-	                        }
-	                        // checklist
-	                        else if (col === this.fltTypeCheckList) {
-	                                if (!Mod.checkList) {
-	                                    Mod.checkList = new _checkList.CheckList(this);
-	                                }
-	                                Mod.checkList.init(i, this.isExternalFlt, fltcell);
-	                            } else {
-	                                this._buildInputFilter(i, inpclass, fltcell);
-	                            }
-	
-	                        // this adds submit button
-	                        if (i == n - 1 && this.displayBtn) {
-	                            this._buildSubmitButton(i, fltcell);
-	                        }
-	
-	                        this.emitter.emit('after-filter-init', this, i);
-	                    } // for i
-	                } else {
-	                        this._resetGrid();
-	                    } //if isFirstLoad
-	            } //if this.fltGrid
-	
-	            /* Features */
-	            if (this.hasVisibleRows) {
-	                this.emitter.on(['after-filtering'], function () {
-	                    return _this2.enforceVisibility();
-	                });
-	                this.enforceVisibility();
-	            }
-	            if (this.rowsCounter) {
-	                Mod.rowsCounter = new _rowsCounter.RowsCounter(this);
-	                Mod.rowsCounter.init();
-	            }
-	            if (this.statusBar) {
-	                Mod.statusBar = new _statusBar.StatusBar(this);
-	                Mod.statusBar.init();
-	            }
-	            if (this.paging || Mod.paging) {
-	                if (!Mod.paging) {
-	                    Mod.paging = new _paging.Paging(this);
-	                    Mod.paging.init();
-	                }
-	                Mod.paging.reset();
-	            }
-	            if (this.btnReset) {
-	                Mod.clearButton = new _clearButton.ClearButton(this);
-	                Mod.clearButton.init();
-	            }
-	            if (this.help) {
-	                if (!Mod.help) {
-	                    Mod.help = new _help.Help(this);
-	                }
-	                Mod.help.init();
-	            }
-	            if (this.hasColWidths && !this.gridLayout) {
-	                this.setColWidths();
-	            }
-	            if (this.alternateRows) {
-	                Mod.alternateRows = new _alternateRows.AlternateRows(this);
-	                Mod.alternateRows.init();
-	            }
-	            if (this.noResults) {
-	                if (!Mod.noResults) {
-	                    Mod.noResults = new _noResults.NoResults(this);
-	                }
-	                Mod.noResults.init();
-	            }
-	
-	            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) {
-	                _dom2.default.addClass(this.tbl, this.prfxTf);
-	            }
-	
-	            /* Loads extensions */
-	            if (this.hasExtensions) {
-	                this.initExtensions();
-	            }
-	
-	            // Subscribe to events
-	            if (this.markActiveColumns) {
-	                this.emitter.on(['before-filtering'], function () {
-	                    return _this2.clearActiveColumns();
-	                });
-	                this.emitter.on(['cell-processed'], function (tf, colIndex) {
-	                    return _this2.markActiveColumn(colIndex);
-	                });
-	            }
-	            if (this.linkedFilters) {
-	                this.emitter.on(['after-filtering'], function () {
-	                    return _this2.linkFilters();
-	                });
-	            }
-	
-	            if (this.onFiltersLoaded) {
-	                this.onFiltersLoaded.call(null, this);
-	            }
-	
-	            this.emitter.emit('initialized', this);
-	        }
-	
-	        /**
-	         * Insert filters row at initialization
-	         */
-	
-	    }, {
-	        key: '_insertFiltersRow',
-	        value: function _insertFiltersRow() {
-	            if (this.gridLayout) {
-	                return;
-	            }
-	            var fltrow = undefined;
-	
-	            var thead = _dom2.default.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.headersRow++;
-	            }
-	
-	            fltrow.className = this.fltsRowCssClass;
-	
-	            if (this.isExternalFlt) {
-	                fltrow.style.display = 'none';
-	            }
-	
-	            this.emitter.emit('filters-row-inserted', this, fltrow);
-	            return fltrow;
-	        }
-	
-	        /**
-	         * Initialize filtersless table
-	         */
-	
-	    }, {
-	        key: '_initNoFilters',
-	        value: function _initNoFilters() {
-	            if (this.fltGrid) {
-	                return;
-	            }
-	            this.refRow = this.refRow > 0 ? this.refRow - 1 : 0;
-	            this.nbFilterableRows = this.getRowsNb();
-	            this.nbVisibleRows = this.nbFilterableRows;
-	            this.nbRows = this.nbFilterableRows + this.refRow;
-	        }
-	
-	        /**
-	         * Build input filter type
-	         * @param  {Number} colIndex      Column index
-	         * @param  {String} cssClass      Css class applied to filter
-	         * @param  {DOMElement} container Container DOM element
-	         */
-	
-	    }, {
-	        key: '_buildInputFilter',
-	        value: function _buildInputFilter(colIndex, cssClass, container) {
-	            var col = this.getFilterType(colIndex);
-	            var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null;
-	            var inptype = col === this.fltTypeInp ? 'text' : 'hidden';
-	            var inp = _dom2.default.create(this.fltTypeInp, ['id', this.prfxFlt + colIndex + '_' + this.id], ['type', inptype], ['ct', colIndex]);
-	
-	            if (inptype !== 'hidden' && this.watermark) {
-	                inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark);
-	            }
-	            inp.className = cssClass || this.fltCssClass;
-	            _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this));
-	
-	            //filter is appended in custom element
-	            if (externalFltTgtId) {
-	                _dom2.default.id(externalFltTgtId).appendChild(inp);
-	                this.externalFltEls.push(inp);
-	            } else {
-	                container.appendChild(inp);
-	            }
-	
-	            this.fltIds.push(inp.id);
-	
-	            _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this));
-	            _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this));
-	            _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this));
-	            _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this));
-	        }
-	
-	        /**
-	         * Build submit button
-	         * @param  {Number} colIndex      Column index
-	         * @param  {DOMElement} container Container DOM element
-	         */
-	
-	    }, {
-	        key: '_buildSubmitButton',
-	        value: function _buildSubmitButton(colIndex, container) {
-	            var _this3 = this;
-	
-	            var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null;
-	            var btn = _dom2.default.create(this.fltTypeInp, ['id', this.prfxValButton + colIndex + '_' + this.id], ['type', 'button'], ['value', this.btnText]);
-	            btn.className = this.btnCssClass;
-	
-	            //filter is appended in custom element
-	            if (externalFltTgtId) {
-	                _dom2.default.id(externalFltTgtId).appendChild(btn);
-	            } else {
-	                container.appendChild(btn);
-	            }
-	
-	            _event2.default.add(btn, 'click', function () {
-	                return _this3.filter();
-	            });
-	        }
-	
-	        /**
-	         * Return a feature instance for a given name
-	         * @param  {String} name Name of the feature
-	         * @return {Object}
-	         */
-	
-	    }, {
-	        key: 'feature',
-	        value: function feature(name) {
-	            return this.Mod[name];
-	        }
-	
-	        /**
-	         * Initialise all the extensions defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'initExtensions',
-	        value: function initExtensions() {
-	            var exts = this.extensions;
-	            // Set config's publicPath dynamically for Webpack...
-	            __webpack_require__.p = this.basePath;
-	
-	            this.emitter.emit('before-loading-extensions', this);
-	            for (var i = 0, len = exts.length; i < len; i++) {
-	                var ext = exts[i];
-	                if (!this.ExtRegistry[ext.name]) {
-	                    this.loadExtension(ext);
-	                }
-	            }
-	            this.emitter.emit('after-loading-extensions', this);
-	        }
-	
-	        /**
-	         * Load an extension module
-	         * @param  {Object} ext Extension config object
-	         */
-	
-	    }, {
-	        key: 'loadExtension',
-	        value: function loadExtension(ext) {
-	            var _this4 = this;
-	
-	            if (!ext || !ext.name) {
-	                return;
-	            }
-	
-	            var name = ext.name;
-	            var path = ext.path;
-	            var modulePath = undefined;
-	
-	            if (name && path) {
-	                modulePath = ext.path + name;
-	            } else {
-	                name = name.replace('.js', '');
-	                modulePath = 'extensions/{}/{}'.replace(/{}/g, name);
-	            }
-	
-	            // Require pattern for Webpack
-	            __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) {
-	                var inst = new mod.default(_this4, ext);
-	                inst.init();
-	                _this4.ExtRegistry[name] = inst;
-	            }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});
-	        }
-	
-	        /**
-	         * Get an extension instance
-	         * @param  {String} name Name of the extension
-	         * @return {Object}      Extension instance
-	         */
-	
-	    }, {
-	        key: 'extension',
-	        value: function extension(name) {
-	            return this.ExtRegistry[name];
-	        }
-	
-	        /**
-	         * Check passed extension name exists
-	         * @param  {String}  name Name of the extension
-	         * @return {Boolean}
-	         */
-	
-	    }, {
-	        key: 'hasExtension',
-	        value: function hasExtension(name) {
-	            return !_types2.default.isEmpty(this.ExtRegistry[name]);
-	        }
-	
-	        /**
-	         * Destroy all the extensions defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'destroyExtensions',
-	        value: function destroyExtensions() {
-	            var exts = this.extensions;
-	
-	            for (var i = 0, len = exts.length; i < len; i++) {
-	                var ext = exts[i];
-	                var extInstance = this.ExtRegistry[ext.name];
-	                if (extInstance) {
-	                    extInstance.destroy();
-	                    this.ExtRegistry[ext.name] = null;
-	                }
-	            }
-	        }
-	
-	        /**
-	         * Load themes defined in the configuration object
-	         */
-	
-	    }, {
-	        key: 'loadThemes',
-	        value: function loadThemes() {
-	            var themes = this.themes;
-	            this.emitter.emit('before-loading-themes', this);
-	
-	            //Default theme config
-	            if (this.enableDefaultTheme) {
-	                var defaultTheme = { name: 'default' };
-	                this.themes.push(defaultTheme);
-	            }
-	            if (_types2.default.isArray(themes)) {
-	                for (var i = 0, len = themes.length; i < len; i++) {
-	                    var theme = themes[i];
-	                    var name = theme.name;
-	                    var path = theme.path;
-	                    var styleId = this.prfxTf + name;
-	                    if (name && !path) {
-	                        path = this.themesPath + name + '/' + name + '.css';
-	                    } else if (!name && theme.path) {
-	                        name = 'theme{0}'.replace('{0}', i);
-	                    }
-	
-	                    if (!this.isImported(path, 'link')) {
-	                        this.import(styleId, path, null, 'link');
-	                    }
-	                }
-	            }
-	
-	            //Some elements need to be overriden for default 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; - - this.emitter.emit('after-loading-themes', this); - } - - /** - * Return stylesheet DOM element for a given theme name - * @return {DOMElement} stylesheet element - */ - - }, { - key: 'getStylesheet', - value: function getStylesheet() { - var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; - - return _dom2.default.id(this.prfxTf + name); - } - - /** - * Destroy filter grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this5 = this; - - if (!this._hasGrid) { - return; - } - var rows = this.tbl.rows, - Mod = this.Mod; - - if (this.isExternalFlt && !this.popupFilters) { - this.removeExternalFlts(); - } - if (this.infDiv) { - this.removeToolbar(); - } - if (this.highlightKeywords) { - Mod.highlightKeyword.unhighlightAll(); - } - if (this.markActiveColumns) { - this.clearActiveColumns(); - this.emitter.off(['before-filtering'], function () { - return _this5.clearActiveColumns(); - }); - this.emitter.off(['cell-processed'], function (tf, colIndex) { - return _this5.markActiveColumn(colIndex); - }); - } - if (this.hasExtensions) { - this.destroyExtensions(); - } - - for (var j = this.refRow; j < this.nbRows; j++) { - // validate row - this.validateRow(j, true); - - //removes alternating colors - if (this.alternateRows) { - Mod.alternateRows.removeRowBg(j); - } - } //for j - - if (this.fltGrid && !this.gridLayout) { - this.fltGridEl = rows[this.filtersRowIndex]; - this.tbl.deleteRow(this.filtersRowIndex); - } - - // Destroy modules - Object.keys(Mod).forEach(function (key) { - var feature = Mod[key]; - if (feature && _types2.default.isFn(feature.destroy)) { - feature.destroy(); - } - }); - - // unsubscribe to events - if (this.hasVisibleRows) { - this.emitter.off(['after-filtering'], function () { - return _this5.enforceVisibility(); - }); - } - if (this.linkedFilters) { - this.emitter.off(['after-filtering'], function () { - return _this5.linkFilters(); - }); - } - - _dom2.default.removeClass(this.tbl, this.prfxTf); - this.nbHiddenRows = 0; - this.validRowsIndex = []; - this.activeFlt = null; - this._hasGrid = false; - } - - /** - * Generate container element for paging, reset button, rows counter etc. - */ - - }, { - key: 'setToolbar', - value: function setToolbar() { - if (this.infDiv) { - return; - } - - /*** container div ***/ - var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); - infdiv.className = this.infDivCssClass; - - //custom container - if (this.toolBarTgtId) { - _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); - } - //grid-layout - else if (this.gridLayout) { - var gridLayout = this.Mod.gridLayout; - gridLayout.tblMainCont.appendChild(infdiv); - infdiv.className = gridLayout.gridInfDivCssClass; - } - //default location: just above the table - else { - var cont = _dom2.default.create('caption'); - cont.appendChild(infdiv); - this.tbl.insertBefore(cont, this.tbl.firstChild); - } - this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); - - /*** left div containing rows # displayer ***/ - var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); - ldiv.className = this.lDivCssClass; - infdiv.appendChild(ldiv); - this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); - - /*** right div containing reset button - + nb results per page select ***/ - var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); - rdiv.className = this.rDivCssClass; - infdiv.appendChild(rdiv); - this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); - - /*** mid div containing paging elements ***/ - var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); - mdiv.className = this.mDivCssClass; - infdiv.appendChild(mdiv); - this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); - - // Enable help instructions by default if topbar is generated and not - // explicitely set to false - if (_types2.default.isUndef(this.help)) { - if (!this.Mod.help) { - this.Mod.help = new _help.Help(this); - } - this.Mod.help.init(); - this.help = true; - } - } - - /** - * Remove toolbar container element - */ - - }, { - key: 'removeToolbar', - value: function removeToolbar() { - if (!this.infDiv) { - return; - } - _dom2.default.remove(this.infDiv); - this.infDiv = null; - - var tbl = this.tbl; - var captions = _dom2.default.tag(tbl, 'caption'); - if (captions.length > 0) { - [].forEach.call(captions, function (elm) { - tbl.removeChild(elm); - }); - } - } - - /** - * Remove all the external column filters - */ - - }, { - key: 'removeExternalFlts', - value: function removeExternalFlts() { - if (!this.isExternalFlt) { - return; - } - var ids = this.externalFltTgtIds, - len = ids.length; - for (var ct = 0; ct < len; ct++) { - var externalFltTgtId = ids[ct], - externalFlt = _dom2.default.id(externalFltTgtId); - if (externalFlt) { - externalFlt.innerHTML = ''; - } - } - } - - /** - * Check if given column implements a filter with custom options - * @param {Number} colIndex Column's index - * @return {Boolean} - */ - - }, { - key: 'isCustomOptions', - value: function isCustomOptions(colIndex) { - return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; - } - - /** - * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the - * custom options values and texts - * @param {Number} colIndex Column's index - * @return {Array} - */ - - }, { - key: 'getCustomOptions', - value: function getCustomOptions(colIndex) { - if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { - return; - } - - var customOptions = this.customOptions; - var cols = customOptions.cols; - var optTxt = [], - optArray = []; - var index = cols.indexOf(colIndex); - var slcValues = customOptions.values[index]; - var slcTexts = customOptions.texts[index]; - var slcSort = customOptions.sorts[index]; - - for (var r = 0, len = slcValues.length; r < len; r++) { - optArray.push(slcValues[r]); - if (slcTexts[r]) { - optTxt.push(slcTexts[r]); - } else { - optTxt.push(slcValues[r]); - } - } - if (slcSort) { - optArray.sort(); - optTxt.sort(); - } - return [optArray, optTxt]; - } - - /** - * Reset persisted filter values - */ - - }, { - key: 'resetValues', - value: function resetValues() { - var _this6 = this; - - //only loadFltOnDemand - if (this.rememberGridValues) { - if (this.loadFltOnDemand) { - this._resetGridValues(this.fltsValuesCookie); - } else { - var fltValues = this.Mod.store.getFilterValues(this.fltsValuesCookie); - fltValues.forEach(function (val, idx) { - if (val !== ' ') { - _this6.setFilterValue(idx, val); - } - }); - } - } - this.filter(); - } - - /** - * Reset persisted filter values when load filters on demand feature is - * enabled - * @param {String} name cookie name storing filter values - */ - - }, { - key: '_resetGridValues', - value: function _resetGridValues(name) { - if (!this.loadFltOnDemand) { - return; - } - var fltsValues = this.Mod.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 = undefined, - opt = undefined; - var fltType = this.getFilterType(i); - // if loadFltOnDemand, drop-down needs to contain stored - // value(s) for filtering - if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { - var slc = _dom2.default.id(this.fltIds[i]); - slc.options[0].selected = false; - - //selects - if (slcFltsIndex.indexOf(i) != -1) { - opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - //multiple select - if (multiFltsIndex.indexOf(i) != -1) { - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - opt = _dom2.default.createOpt(s[j], s[j], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - } // if multiFltsIndex - } else if (fltType === this.fltTypeCheckList) { - var checkList = this.Mod.checkList; - var divChk = checkList.checkListDiv[i]; - divChk.title = divChk.innerHTML; - divChk.innerHTML = ''; - - var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); - ul.className = checkList.checkListCssClass; - - var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); - li0.className = checkList.checkListItemCssClass; - ul.appendChild(li0); - - divChk.appendChild(ul); - - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - var li = _dom2.default.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; - } - } else if (fltType === this.fltTypeInp) { - this.setFilterValue(i, fltsValues[i]); - } - } //end for - - if (!this.hasStoredValues && this.paging) { - this.Mod.paging.setPagingInfo(); - } - } //end if - } - - /** - * Filter the table by retrieving the data from each cell in every single - * row and comparing it to the search term for current column. A row is - * hidden when all the search terms are not found in inspected row. - * - * TODO: Reduce complexity of this massive method - */ - - }, { - key: 'filter', - value: function filter() { - if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { - return; - } - //invoke onbefore callback - if (this.onBeforeFilter) { - this.onBeforeFilter.call(null, this); - } - this.emitter.emit('before-filtering', this); - - var row = this.tbl.rows, - Mod = this.Mod, - hiddenrows = 0; - - this.validRowsIndex = []; - // search args re-init - this.searchArgs = this.getFiltersValue(); - - var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); - - //keyword highlighting - function highlight(str, ok, cell) { - /*jshint validthis:true */ - if (this.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 = _dom2.default.getText(cell); - } - if (w !== '') { - Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); - } - } - } - - //looks for search argument in current row - function hasArg(sA, cellData, j) { - /*jshint validthis:true */ - var occurence = undefined, - removeNbFormat = _helpers2.default.removeNbFormat; - - //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); - var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); - var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); - var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); - var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); - var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); - - var dte1 = undefined, - dte2 = undefined; - //dates - if (_date2.default.isValid(cellData, dtType)) { - dte1 = _date2.default.format(cellData, dtType); - // lower date - if (isLDate) { - dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); - occurence = dte1 < dte2; - } - // lower equal date - else if (isLEDate) { - dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); - occurence = dte1 <= dte2; - } - // greater equal date - else if (isGEDate) { - dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); - occurence = dte1 >= dte2; - } - // greater date - else if (isGDate) { - dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); - occurence = dte1 > dte2; - } - // different date - else if (isDFDate) { - dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); - occurence = dte1.toString() != dte2.toString(); - } - // equal date - else if (isEQDate) { - dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } else if (_date2.default.isValid(sA, dtType)) { - dte2 = _date2.default.format(sA, dtType); - occurence = dte1.toString() === dte2.toString(); - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } else { - //first numbers need to be formated - if (this.hasColNbFormat && this.colNbFormat[j]) { - numCellData = removeNbFormat(cellData, this.colNbFormat[j]); - nbFormat = this.colNbFormat[j]; - } else { - if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { - numCellData = removeNbFormat(cellData, 'us'); - nbFormat = 'us'; - } else { - numCellData = removeNbFormat(cellData, 'eu'); - nbFormat = 'eu'; - } - } - - // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, - // rgx:) - // lower equal - if (hasLE) { - occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); - } - //greater equal - else if (hasGE) { - occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); - } - //lower - else if (hasLO) { - occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); - } - //greater - else if (hasGR) { - occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); - } - //different - else if (hasDF) { - occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; - } - //like - else if (hasLK) { - occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } - //equal - else if (hasEQ) { - occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); - } - //starts with - else if (hasST) { - occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; - } - //ends with - else if (hasEN) { - var searchArg = sA.replace(re_en, ''); - occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } - //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(cellData); - } catch (e) { - occurence = false; - } - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } //else - return occurence; - } //fn - - for (var k = this.refRow; k < this.nbRows; k++) { - /*** if table already filtered some rows are not visible ***/ - if (this.getRowDisplay(row[k]) === '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 = true, - - //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]; - var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; - if (sA === '') { - continue; - } - - var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); - - //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 = undefined, - occur = false, - s = hasMultiOrSA ? sAOrSplit : sAAndSplit; - for (var w = 0, len = s.length; w < len; w++) { - cS = _string2.default.trim(s[w]); - occur = hasArg.call(this, cS, cellData, j); - highlight.call(this, cS, occur, cell[j]); - if (hasMultiOrSA && occur) { - break; - } - if (hasMultiAndSA && !occur) { - break; - } - } - occurence[j] = occur; - } - //single search parameter - else { - occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); - highlight.call(this, sA, occurence[j], cell[j]); - } //else single param - - if (!occurence[j]) { - isRowValid = false; - } - if (this.singleSearchFlt && occurence[j]) { - singleFltRowValid = true; - } - - this.emitter.emit('cell-processed', this, j, cell[j]); - } //for j - - if (this.singleSearchFlt && singleFltRowValid) { - isRowValid = true; - } - - if (!isRowValid) { - this.validateRow(k, false); - hiddenrows++; - } else { - this.validateRow(k, true); - } - - this.emitter.emit('row-processed', this, k, this.validRowsIndex.length, isRowValid); - } // for k - - this.nbVisibleRows = this.validRowsIndex.length; - this.nbHiddenRows = hiddenrows; - - //invokes onafterfilter callback - if (this.onAfterFilter) { - this.onAfterFilter.call(null, this); - } - - this.emitter.emit('after-filtering', this); - } - - /** - * Return the data of a specified colum - * @param {Number} colIndex Column index - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} num Optional: return unformatted number - * @param {Array} exclude Optional: list of row indexes to be excluded - * @return {Array} Flat list of data for a column - */ - - }, { - key: 'getColValues', - value: function getColValues(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; - - if (!this.fltGrid) { - return; - } - var row = this.tbl.rows, - colValues = []; - - if (includeHeaders) { - colValues.push(this.getHeadersText()[colIndex]); - } - - for (var i = this.refRow; i < this.nbRows; i++) { - var isExludedRow = false; - // checks if current row index appears in exclude array - if (exclude.length > 0) { - isExludedRow = exclude.indexOf(i) != -1; - } - 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 !== '') { - continue; - } - var cellData = this.getCellData(cell[j]), - nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, - data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; - colValues.push(data); - } - } - } - return colValues; - } - - /** - * Return the filter's value of a specified column - * @param {Number} index Column index - * @return {String} Filter value - */ - - }, { - key: 'getFilterValue', - value: function getFilterValue(index) { - if (!this.fltGrid) { - return; - } - var fltValue = undefined, - flt = this.getFilterElement(index); - if (!flt) { - return ''; - } - - var fltColType = this.getFilterType(index); - if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { - fltValue = flt.value; - } - //mutiple select - else if (fltColType === this.fltTypeMulti) { - fltValue = ''; - for (var j = 0, len = flt.options.length; j < len; 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; - } - - /** - * Return the filters' values - * @return {Array} List of filters' values - */ - - }, { - key: 'getFiltersValue', - value: function getFiltersValue() { - if (!this.fltGrid) { - return; - } - var searchArgs = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); - } - return searchArgs; - } - - /** - * Return the ID of the filter of a specified column - * @param {Number} index Column's index - * @return {String} ID of the filter element - */ - - }, { - key: 'getFilterId', - value: function getFilterId(index) { - if (!this.fltGrid) { - return; - } - return this.fltIds[index]; - } - - /** - * Return the list of ids of filters matching a specified type. - * Note: hidden filters are also returned - * - * @param {String} type Filter type string ('input', 'select', 'multiple', - * 'checklist') - * @param {Boolean} bool If true returns columns indexes instead of IDs - * @return {[type]} List of element IDs or column indexes - */ - - }, { - key: 'getFiltersByType', - value: function getFiltersByType(type, bool) { - if (!this.fltGrid) { - return; - } - var arr = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - var fltType = this.getFilterType(i); - if (fltType === _string2.default.lower(type)) { - var a = bool ? i : this.fltIds[i]; - arr.push(a); - } - } - return arr; - } - - /** - * Return the filter's DOM element for a given column - * @param {Number} index Column's index - * @return {DOMElement} - */ - - }, { - key: 'getFilterElement', - value: function getFilterElement(index) { - var fltId = this.fltIds[index]; - return _dom2.default.id(fltId); - } - - /** - * Return the number of cells for a given row index - * @param {Number} rowIndex Index of the row - * @return {Number} Number of cells - */ - - }, { - key: 'getCellsNb', - value: function getCellsNb() { - var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; - - var tr = this.tbl.rows[rowIndex]; - return tr.cells.length; - } - - /** - * Return the number of filterable rows starting from reference row if - * defined - * @param {Boolean} includeHeaders Include the headers row - * @return {Number} Number of filterable rows - */ - - }, { - key: 'getRowsNb', - value: function getRowsNb(includeHeaders) { - var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, - ntrs = this.tbl.rows.length; - if (includeHeaders) { - s = 0; - } - return parseInt(ntrs - s, 10); - } - - /** - * Return the data of a given cell - * @param {DOMElement} cell Cell's DOM object - * @return {String} - */ - - }, { - key: 'getCellData', - value: function getCellData(cell) { - var idx = cell.cellIndex; - //Check for customCellData callback - if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { - return this.customCellData.call(null, this, cell, idx); - } else { - return _dom2.default.getText(cell); - } - } - - /** - * Return the table data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getTableData', - value: function getTableData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - var rows = this.tbl.rows; - var tblData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - tblData.push([this.getHeadersRowIndex(), headers]); - } - for (var k = this.refRow; k < this.nbRows; k++) { - var rowData = [k, []]; - var cells = rows[k].cells; - for (var j = 0, len = cells.length; j < len; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var cellData = this.getCellData(cells[j]); - rowData[1].push(cellData); - } - tblData.push(rowData); - } - return tblData; - } - - /** - * Return the filtered data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredData', - value: function getFilteredData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (!this.validRowsIndex) { - return []; - } - var rows = this.tbl.rows, - filteredData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - filteredData.push([this.getHeadersRowIndex(), headers]); - } - - var validRows = this.getValidRows(true); - for (var i = 0; i < validRows.length; i++) { - var rData = [this.validRowsIndex[i], []], - cells = rows[this.validRowsIndex[i]].cells; - for (var k = 0; k < cells.length; k++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(k)) { - continue; - } - } - var cellData = this.getCellData(cells[k]); - rData[1].push(cellData); - } - filteredData.push(rData); - } - return filteredData; - } - - /** - * Return the filtered data for a given column index - * @param {Number} colIndex Colmun's index - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} Flat list of values ['val0','val1','val2'...] - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredDataCol', - value: function getFilteredDataCol(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (_types2.default.isUndef(colIndex)) { - return []; - } - var data = this.getFilteredData(), - colData = []; - if (includeHeaders) { - colData.push(this.getHeadersText()[colIndex]); - } - for (var i = 0, len = data.length; i < len; 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; - } - - /** - * Get the display value of a row - * @param {RowElement} DOM element of the row - * @return {String} Usually 'none' or '' - */ - - }, { - key: 'getRowDisplay', - value: function getRowDisplay(row) { - if (!_types2.default.isObj(row)) { - return null; - } - return row.style.display; - } - - /** - * Validate/invalidate row by setting the 'validRow' attribute on the row - * @param {Number} rowIndex Index of the row - * @param {Boolean} isValid - */ - - }, { - key: 'validateRow', - value: function validateRow(rowIndex, isValid) { - var row = this.tbl.rows[rowIndex]; - if (!row || typeof isValid !== 'boolean') { - return; - } - - // always visible rows are valid - if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { - isValid = true; - } - - var displayFlag = isValid ? '' : 'none', - validFlag = isValid ? 'true' : 'false'; - row.style.display = displayFlag; - - if (this.paging) { - row.setAttribute('validRow', validFlag); - } - - if (isValid) { - if (this.validRowsIndex.indexOf(rowIndex) === -1) { - this.validRowsIndex.push(rowIndex); - } - - if (this.onRowValidated) { - this.onRowValidated.call(null, this, rowIndex); - } - - this.emitter.emit('row-validated', this, rowIndex); - } - } - - /** - * Validate all filterable rows - */ - - }, { - key: 'validateAllRows', - value: function validateAllRows() { - if (!this._hasGrid) { - return; - } - this.validRowsIndex = []; - for (var k = this.refRow; k < this.nbFilterableRows; k++) { - this.validateRow(k, true); - } - } - - /** - * Set search value to a given filter - * @param {Number} index Column's index - * @param {String} searcharg Search term - */ - - }, { - key: 'setFilterValue', - value: function setFilterValue(index) { - var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; - - if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { - return; - } - var slc = this.getFilterElement(index), - fltColType = this.getFilterType(index); - - if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { - slc.value = searcharg; - } - //multiple selects - else if (fltColType === this.fltTypeMulti) { - var s = searcharg.split(' ' + this.orOperator + ' '); - // let ct = 0; //keywords counter - for (var j = 0, len = slc.options.length; j < len; j++) { - var option = slc.options[j]; - if (s === '' || s[0] === '') { - option.selected = false; - } - if (option.value === '') { - option.selected = false; - } - if (option.value !== '' && _array2.default.has(s, option.value, true)) { - option.selected = true; - } //if - } //for j - } - //checklist - else if (fltColType === this.fltTypeCheckList) { - searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); - var sarg = searcharg.split(' ' + this.orOperator + ' '); - var lisNb = _dom2.default.tag(slc, 'li').length; - - slc.setAttribute('value', ''); - slc.setAttribute('indexes', ''); - - for (var k = 0; k < lisNb; k++) { - var li = _dom2.default.tag(slc, 'li')[k], - lbl = _dom2.default.tag(li, 'label')[0], - chk = _dom2.default.tag(li, 'input')[0], - lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); - if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { - chk.checked = true; - this.Mod.checkList.setCheckListValues(chk); - } else { - chk.checked = false; - this.Mod.checkList.setCheckListValues(chk); - } - } - } - } - - /** - * Set them columns' widths as per configuration - * @param {Number} rowIndex Optional row index to apply the widths to - * @param {Element} tbl DOM element - */ - - }, { - key: 'setColWidths', - value: function setColWidths(rowIndex, tbl) { - if (!this.fltGrid || !this.hasColWidths) { - return; - } - tbl = tbl || this.tbl; - var rIndex = undefined; - if (rowIndex === undefined) { - rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; - } else { - rIndex = rowIndex; - } - - setWidths.call(this); - - function setWidths() { - /*jshint validthis:true */ - var nbCols = this.nbCells; - var colWidths = this.colWidths; - var colTags = _dom2.default.tag(tbl, 'col'); - var tblHasColTag = colTags.length > 0; - var frag = !tblHasColTag ? doc.createDocumentFragment() : null; - for (var k = 0; k < nbCols; k++) { - var col = undefined; - if (tblHasColTag) { - col = colTags[k]; - } else { - col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); - frag.appendChild(col); - } - col.style.width = colWidths[k]; - } - if (!tblHasColTag) { - tbl.insertBefore(frag, tbl.firstChild); - } - } - } - - /** - * Makes defined rows always visible - */ - - }, { - key: 'enforceVisibility', - value: function enforceVisibility() { - if (!this.hasVisibleRows) { - return; - } - for (var i = 0, len = this.visibleRows.length; i < len; i++) { - var row = this.visibleRows[i]; - //row index cannot be > nrows - if (row <= this.nbRows) { - this.validateRow(row, true); - } - } - } - - /** - * Clear all the filters' values - */ - - }, { - key: 'clearFilters', - value: function clearFilters() { - if (!this.fltGrid) { - return; - } - - this.emitter.emit('before-clearing-filters', this); - - if (this.onBeforeReset) { - this.onBeforeReset.call(null, this, this.getFiltersValue()); - } - for (var i = 0, len = this.fltIds.length; i < len; i++) { - this.setFilterValue(i, ''); - } - // if(this.linkedFilters){ - // this.linkFilters(); - // } - if (this.rememberPageLen) { - _cookie2.default.remove(this.pgLenCookie); - } - if (this.rememberPageNb) { - _cookie2.default.remove(this.pgNbCookie); - } - if (this.onAfterReset) { - this.onAfterReset.call(null, this); - } - - this.filter(); - - this.emitter.emit('after-clearing-filters', this); - } - - /** - * Clears filtered columns visual indicator (background color) - */ - - }, { - key: 'clearActiveColumns', - value: function clearActiveColumns() { - for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { - _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); - } - } - - /** - * Mark currently filtered column - * @param {Number} colIndex Column index - */ - - }, { - key: 'markActiveColumn', - value: function markActiveColumn(colIndex) { - var header = this.getHeaderElement(colIndex); - if (_dom2.default.hasClass(header, this.activeColumnsCssClass)) { - return; - } - if (this.onBeforeActiveColumn) { - this.onBeforeActiveColumn.call(null, this, colIndex); - } - _dom2.default.addClass(header, this.activeColumnsCssClass); - if (this.onAfterActiveColumn) { - this.onAfterActiveColumn.call(null, this, colIndex); - } - } - - /** - * Refresh the filters subject to linking ('select', 'multiple', - * 'checklist' type) - */ - - }, { - key: 'linkFilters', - value: function linkFilters() { - if (!this.linkedFilters || !this.activeFilterId) { - return; - } - 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); - - var activeFlt = this.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(this.prfxFlt)[1]; - var slcSelectedValue = undefined; - for (var i = 0, len = slcIndex.length; i < len; i++) { - var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); - slcSelectedValue = this.getFilterValue(slcIndex[i]); - - // Welcome to cyclomatic complexity hell :) - // TODO: simplify/refactor if statement - if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; - } else { - curSlc.innerHTML = ''; - } - - //1st option needs to be inserted - if (this.loadFltOnDemand) { - var opt0 = _dom2.default.createOpt(this.displayAllText, ''); - if (curSlc) { - curSlc.appendChild(opt0); - } - } - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.build(slcIndex[i]); - } else { - this.Mod.dropdown.build(slcIndex[i], true); - } - - this.setFilterValue(slcIndex[i], slcSelectedValue); - } - } // for i - } - - /** - * Re-generate the filters grid bar when previously removed - */ - - }, { - key: '_resetGrid', - value: function _resetGrid() { - if (this.isFirstLoad) { - return; - } - - var Mod = this.Mod; - var tbl = this.tbl; - var rows = tbl.rows; - var filtersRowIndex = this.filtersRowIndex; - var filtersRow = rows[filtersRowIndex]; - - // grid was removed, grid row element is stored in fltGridEl property - if (!this.gridLayout) { - // If table has a thead ensure the filters row is appended in the - // thead element - if (tbl.tHead) { - var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); - tbl.tHead.replaceChild(this.fltGridEl, tempRow); - } else { - filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); - } - - _dom2.default.addClass(tbl, this.prfxTf); - } - - // filters are appended in external placeholders elements - if (this.isExternalFlt) { - var externalFltTgtIds = this.externalFltTgtIds; - for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { - var extFlt = _dom2.default.id(externalFltTgtIds[ct]); - - if (!extFlt) { - continue; - } - - var externalFltEl = this.externalFltEls[ct]; - extFlt.appendChild(externalFltEl); - var colFltType = this.getFilterType(ct); - //IE special treatment for gridLayout, appended filters are - //empty - if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { - if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { - Mod.dropdown.build(ct); - } - if (colFltType === this.fltTypeCheckList) { - Mod.checkList.build(ct); - } - } - } - } - - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = rows.length; - - if (this.popupFilters) { - this.headersRow++; - Mod.popupFilter.reset(); - } - - this._hasGrid = true; - } - - /** - * Determines if passed filter column implements exact query match - * @param {Number} colIndex [description] - * @return {Boolean} [description] - */ - - }, { - key: 'isExactMatch', - value: function isExactMatch(colIndex) { - var fltType = this.getFilterType(colIndex); - return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; - } - - /** - * Check if passed script or stylesheet is already imported - * @param {String} filePath Ressource path - * @param {String} type Possible values: 'script' or 'link' - * @return {Boolean} - */ - - }, { - key: 'isImported', - value: function isImported(filePath, type) { - var imported = false, - importType = !type ? 'script' : type, - attr = importType == 'script' ? 'src' : 'href', - files = _dom2.default.tag(doc, importType); - for (var i = 0, len = files.length; i < len; i++) { - if (files[i][attr] === undefined) { - continue; - } - if (files[i][attr].match(filePath)) { - imported = true; - break; - } - } - return imported; - } - - /** - * Import script or stylesheet - * @param {String} fileId Ressource ID - * @param {String} filePath Ressource path - * @param {Function} callback Callback - * @param {String} type Possible values: 'script' or 'link' - */ - - }, { - key: 'import', - value: function _import(fileId, filePath, callback, type) { - var ftype = !type ? 'script' : type, - imported = this.isImported(filePath, ftype); - if (imported) { - return; - } - var o = this, - isLoaded = false, - file = undefined, - head = _dom2.default.tag(doc, 'head')[0]; - - if (_string2.default.lower(ftype) === 'link') { - file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); - } else { - file = _dom2.default.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: ' + filePath); - }; - head.appendChild(file); - } - - /** - * Check if table has filters grid - * @return {Boolean} - */ - - }, { - key: 'hasGrid', - value: function hasGrid() { - return this._hasGrid; - } - - /** - * Get list of filter IDs - * @return {[type]} [description] - */ - - }, { - key: 'getFiltersId', - value: function getFiltersId() { - return this.fltIds || []; - } - - /** - * Get filtered (valid) rows indexes - * @param {Boolean} reCalc Force calculation of filtered rows list - * @return {Array} List of row indexes - */ - - }, { - key: 'getValidRows', - value: function getValidRows(reCalc) { - 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; - } - - /** - * Get the index of the row containing the filters - * @return {Number} - */ - - }, { - key: 'getFiltersRowIndex', - value: function getFiltersRowIndex() { - return this.filtersRowIndex; - } - - /** - * Get the index of the headers row - * @return {Number} - */ - - }, { - key: 'getHeadersRowIndex', - value: function getHeadersRowIndex() { - return this.headersRow; - } - - /** - * Get the row index from where the filtering process start (1st filterable - * row) - * @return {Number} - */ - - }, { - key: 'getStartRowIndex', - value: function getStartRowIndex() { - return this.refRow; - } - - /** - * Get the index of the last row - * @return {Number} - */ - - }, { - key: 'getLastRowIndex', - value: function getLastRowIndex() { - if (!this._hasGrid) { - return; - } - return this.nbRows - 1; - } - - /** - * Get the header DOM element for a given column index - * @param {Number} colIndex Column index - * @return {Object} - */ - - }, { - key: 'getHeaderElement', - value: function getHeaderElement(colIndex) { - var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; - var tHead = _dom2.default.tag(table, 'thead'); - var headersRow = this.headersRow; - var header = undefined; - for (var i = 0; i < this.nbCells; i++) { - if (i !== colIndex) { - continue; - } - if (tHead.length === 0) { - header = table.rows[headersRow].cells[i]; - } - if (tHead.length === 1) { - header = tHead[0].rows[headersRow].cells[i]; - } - break; - } - return header; - } - - /** - * Return the list of headers' text - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} list of headers' text - */ - - }, { - key: 'getHeadersText', - value: function getHeadersText() { - var excludeHiddenCols = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var headers = []; - for (var j = 0; j < this.nbCells; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var header = this.getHeaderElement(j); - var headerText = _dom2.default.getText(header); - headers.push(headerText); - } - return headers; - } - - /** - * Return the filter type for a specified column - * @param {Number} colIndex Column's index - * @return {String} - */ - - }, { - key: 'getFilterType', - value: function getFilterType(colIndex) { - var colType = this.cfg['col_' + colIndex]; - return !colType ? this.fltTypeInp : _string2.default.lower(colType); - } - - /** - * Get the total number of filterable rows - * @return {Number} - */ - - }, { - key: 'getFilterableRowsNb', - value: function getFilterableRowsNb() { - return this.getRowsNb(false); - } - - /** - * Get the configuration object (literal object) - * @return {Object} - */ - - }, { - key: 'config', - value: function config() { - return this.cfg; - } - }]); - - return TableFilter; - })(); - -/***/ }, -/* 1 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * DOM event utilities - */ - - exports.default = { - 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; - } - }, - target: function target(evt) { - return evt && evt.target || window.event && window.event.srcElement; - }, - keyCode: function keyCode(evt) { - return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; - } - }; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * DOM utilities - */ - - exports.default = { - - /** - * Returns text + text of children of given node - * @param {NodeElement} node - * @return {String} - */ - - getText: function getText(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 - */ - create: function create(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]); - } - } - } - return el; - }, - - /** - * Removes passed node from DOM - * @param {DOMElement} node - * @return {DOMElement} old node reference - */ - remove: function remove(node) { - return node.parentNode.removeChild(node); - }, - - /** - * Returns a text node with given text - * @param {String} txt - * @return {Object} - */ - text: function text(txt) { - return document.createTextNode(txt); - }, - hasClass: function hasClass(ele, cls) { - if (!ele) { - return false; - } - - if (supportsClassList()) { - return ele.classList.contains(cls); - } - return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); - }, - addClass: function addClass(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; - } - }, - removeClass: function removeClass(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 - */ - createOpt: function createOpt(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 - */ - createCheckItem: function createCheckItem(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; - }, - id: function id(key) { - return document.getElementById(key); - }, - tag: function tag(o, tagname) { - return o.getElementsByTagName(tagname); - } - }; - - // HTML5 classList API - - function supportsClassList() { - return document.documentElement.classList; - } - -/***/ }, -/* 3 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * String utilities - */ - - exports.default = { - lower: function lower(text) { - return text.toLowerCase(); - }, - upper: function upper(text) { - return text.toUpperCase(); - }, - trim: function trim(text) { - if (text.trim) { - return text.trim(); - } - return text.replace(/^\s*|\s*$/g, ''); - }, - isEmpty: function isEmpty(text) { - return this.trim(text) === ''; - }, - rgxEsc: function rgxEsc(text) { - var chars = /[-\/\\^$*+?.()|[\]{}]/g; - var escMatch = '\\$&'; - return String(text).replace(chars, escMatch); - }, - matchCase: function matchCase(text, caseSensitive) { - if (!caseSensitive) { - return this.lower(text); - } - return text; - }, - - /** - * Checks if passed data contains the searched term - * @param {String} term Searched term - * @param {String} data Data string - * @param {Boolean} exactMatch Exact match - * @param {Boolean} caseSensitive Case sensitive - * @return {Boolean} - */ - contains: function contains(term, data) { - var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; - - // Improved by Cedric Wartel (cwl) automatic exact match for selects and - // special characters are now filtered - var regexp = undefined, - modifier = caseSensitive ? 'g' : 'gi'; - if (exactMatch) { - regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); - } else { - regexp = new RegExp(this.rgxEsc(term), modifier); - } - return regexp.test(data); - } - }; - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Cookie utilities - */ - - exports.default = { - write: function write(name, value, hours) { - var expire = ''; - if (hours) { - expire = new Date(new Date().getTime() + hours * 3600000); - expire = '; expires=' + expire.toGMTString(); - } - document.cookie = name + '=' + escape(value) + expire; - }, - read: function read(name) { - var cookieValue = '', - search = name + '='; - if (document.cookie.length > 0) { - var cookie = document.cookie, - offset = cookie.indexOf(search); - if (offset !== -1) { - offset += search.length; - var end = cookie.indexOf(';', offset); - if (end === -1) { - end = cookie.length; - } - cookieValue = unescape(cookie.substring(offset, end)); - } - } - return cookieValue; - }, - remove: function remove(name) { - this.write(name, '', -1); - }, - valueToArray: function valueToArray(name, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.read(name); - //creates an array with filters' values - var arr = val.split(separator); - return arr; - }, - getValueByIndex: function getValueByIndex(name, index, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.valueToArray(name, separator); - return val[index]; - } - }; - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * Types utilities - */ - - var UNDEFINED = void 0; - - exports.default = { - /** - * Check if argument is an object or a global object - * @param {String or Object} v - * @return {Boolean} - */ - - isObj: function isObj(v) { - var isO = false; - if (typeof v === 'string') { - if (window[v] && _typeof(window[v]) === 'object') { - isO = true; - } - } else { - if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { - isO = true; - } - } - return isO; - }, - - /** - * Check if argument is a function - * @param {Function} fn - * @return {Boolean} - */ - isFn: function isFn(fn) { - return fn && fn.constructor == Function; - }, - - /** - * Check if argument is an array - * @param {Array} obj - * @return {Boolean} - */ - isArray: function isArray(obj) { - return obj && obj.constructor == Array; - }, - - /** - * Determine if argument is undefined - * @param {Any} o - * @return {Boolean} - */ - isUndef: function isUndef(o) { - return o === UNDEFINED; - }, - - /** - * Determine if argument is null - * @param {Any} o - * @return {Boolean} - */ - isNull: function isNull(o) { - return o === null; - }, - - /** - * Determine if argument is empty (undefined, null or empty string) - * @param {Any} o - * @return {Boolean} - */ - isEmpty: function isEmpty(o) { - return this.isUndef(o) || this.isNull(o) || o.length === 0; - } - }; - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - has: function has(arr, val, caseSensitive) { - var sCase = caseSensitive === undefined ? false : caseSensitive; - for (var i = 0; i < arr.length; i++) { - if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { - return true; - } - } - return false; - } - }; /** - * Array utilities - */ - -/***/ }, -/* 7 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Date utilities - */ - - exports.default = { - 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 = undefined, - reg2 = undefined; - // 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 = undefined, - dd = undefined, - yy = undefined; - // 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(dateStr, formatStr) { - if (!formatStr) { - formatStr = 'DMY'; - } - if (!dateStr || dateStr === '') { - return new Date(1001, 0, 1); - } - var oDate = undefined; - var parts = undefined; - - switch (formatStr.toUpperCase()) { - case 'DDMMMYYYY': - parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); - oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); - break; - case 'DMY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'MDY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'YMD': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - default: - //in case format is not correct - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - } - return oDate; - } - }; - - function y2kDate(yr) { - if (yr === undefined) { - return 0; - } - if (yr.length > 2) { - return yr; - } - var y = undefined; - //>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; - } - - function mmm2mm(mmm) { - if (mmm === undefined) { - return 0; - } - var mondigit = undefined; - 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; - } - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - removeNbFormat: function removeNbFormat(data, format) { - if (!data) { - return; - } - if (!format) { - format = 'us'; - } - var n = data; - if (_string2.default.lower(format) === 'us') { - n = +n.replace(/[^\d\.-]/g, ''); - } else { - n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); - } - return n; - } - }; /** - * Misc helpers - */ - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - "use strict"; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /** - * Event emitter class - */ - - var Emitter = exports.Emitter = (function () { - function Emitter() { - _classCallCheck(this, Emitter); - - /** - * Events object - * @type {Object} - */ - this.events = {}; - } - - /** - * Subscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - _createClass(Emitter, [{ - key: "on", - value: function on(evts, fn) { - var _this = this; - - evts.forEach(function (evt) { - _this.events[evt] = _this.events[evt] || []; - _this.events[evt].push(fn); - }); - } - - /** - * Unsubscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - }, { - key: "off", - value: function off(evts, fn) { - var _this2 = this; - - evts.forEach(function (evt) { - if (evt in _this2.events) { - _this2.events[evt].splice(_this2.events[evt].indexOf(fn), 1); - } - }); - } - - /** - * Emit an event - * @param {String} evt Event name followed by any other argument passed to - * the invoked function - */ - - }, { - key: "emit", - value: function emit(evt /*, args...*/) { - if (evt in this.events) { - for (var i = 0; i < this.events[evt].length; i++) { - this.events[evt][i].apply(this, [].slice.call(arguments, 1)); - } - } - } - }]); - - return Emitter; - })(); - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Store = undefined; - - var _cookie = __webpack_require__(4); - - var _cookie2 = _interopRequireDefault(_cookie); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Store = exports.Store = (function () { - - /** - * Store, persistence manager - * @param {Object} tf TableFilter instance - * - * TODO: use localStorage and fallback to cookie persistence - */ - - function Store(tf) { - _classCallCheck(this, Store); - - var f = tf.config(); - - this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(Store, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on(['after-filtering'], function () { - return _this.saveFilterValues(_this.tf.fltsValuesCookie); - }); - } - - /** - * Store filters' values in cookie - * @param {String} cookie name - */ - - }, { - key: 'saveFilterValues', - value: function saveFilterValues(name) { - var tf = this.tf; - var fltValues = []; - - if (!tf.rememberGridValues) { - return; - } - - //store filters' values - for (var i = 0; i < tf.fltIds.length; i++) { - var value = tf.getFilterValue(i); - if (value === '') { - value = ' '; - } - fltValues.push(value); - } - //adds array size - fltValues.push(tf.fltIds.length); - - //writes cookie - _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); - } - - /** - * Retrieve filters' values from cookie - * @param {String} cookie name - * @return {Array} - */ - - }, { - key: 'getFilterValues', - value: function getFilterValues(name) { - var flts = _cookie2.default.read(name); - var rgx = new RegExp(this.tf.separator, 'g'); - // filters' values array - return flts.split(rgx); - } - - /** - * Store page number in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageNb', - value: function savePageNb(name) { - if (!this.tf.rememberPageNb) { - return; - } - _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); - } - - /** - * Retrieve page number from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageNb', - value: function getPageNb(name) { - return _cookie2.default.read(name); - } - - /** - * Store page length in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageLength', - value: function savePageLength(name) { - if (!this.tf.rememberPageLen) { - return; - } - _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); - } - - /** - * Retrieve page length from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageLength', - value: function getPageLength(name) { - return _cookie2.default.read(name); - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off(['after-filtering'], function () { - return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); - }); - } - }]); - - return Store; - })(); - -/***/ }, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.GridLayout = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var GridLayout = exports.GridLayout = (function (_Feature) { - _inherits(GridLayout, _Feature); - - /** - * Grid layout, table with fixed headers - * @param {Object} tf TableFilter instance - */ - - function GridLayout(tf) { - _classCallCheck(this, GridLayout); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); - - var f = _this.config; - - //defines grid width - _this.gridWidth = f.grid_width || null; - //defines grid height - _this.gridHeight = f.grid_height || null; - //defines css class for main container - _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; - //defines css class for div containing table - _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; - //defines css class for div containing headers' table - _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; - //defines css class for div containing rows counter, paging etc. - _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; - //defines which row contains column headers - _this.gridHeadRowIndex = f.grid_headers_row_index || 0; - //array of headers row indexes to be placed in header table - _this.gridHeadRows = f.grid_headers_rows || [0]; - //generate filters in table headers - _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; - //default col width - _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; - - _this.gridColElms = []; - - //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_'; - - _this.sourceTblHtml = tf.tbl.outerHTML; - return _this; - } - - /** - * Generates a grid with fixed headers - */ - - _createClass(GridLayout, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - var f = this.config; - var tbl = tf.tbl; - - if (this.initialized) { - return; - } - - // Override reference rows indexes - tf.refRow = _types2.default.isNull(tf.startRow) ? 0 : tf.startRow; - tf.headersRow = 0; - tf.filtersRowIndex = 1; - - tf.isExternalFlt = true; - - // default width of 100px if column widths not set - if (!tf.hasColWidths) { - tf.colWidths = []; - for (var k = 0; k < tf.nbCells; k++) { - var colW = undefined, - cell = tbl.rows[this.gridHeadRowIndex].cells[k]; - if (cell.width !== '') { - colW = cell.width; - } else if (cell.style.width !== '') { - colW = parseInt(cell.style.width, 10); - } else { - colW = this.gridDefaultColWidth; - } - tf.colWidths[k] = colW; - } - tf.hasColWidths = true; - } - tf.setColWidths(this.gridHeadRowIndex); - - var tblW = undefined; //initial table width - if (tbl.width !== '') { - tblW = tbl.width; - } else if (tbl.style.width !== '') { - tblW = parseInt(tbl.style.width, 10); - } else { - tblW = tbl.clientWidth; - } - - //Main container: it will contain all the elements - this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); - this.tblMainCont.className = this.gridMainContCssClass; - if (this.gridWidth) { - this.tblMainCont.style.width = this.gridWidth; - } - tbl.parentNode.insertBefore(this.tblMainCont, tbl); - - //Table container: div wrapping content table - this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); - this.tblCont.className = this.gridContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.tblCont.style.width = '100%'; - } else { - this.tblCont.style.width = this.gridWidth; - } - } - if (this.gridHeight) { - this.tblCont.style.height = this.gridHeight; - } - tbl.parentNode.insertBefore(this.tblCont, tbl); - var t = _dom2.default.remove(tbl); - this.tblCont.appendChild(t); - - //In case table width is expressed in % - if (tbl.style.width === '') { - tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; - } - - var d = _dom2.default.remove(this.tblCont); - this.tblMainCont.appendChild(d); - - //Headers table container: div wrapping headers table - this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); - this.headTblCont.className = this.gridHeadContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.headTblCont.style.width = '100%'; - } else { - this.headTblCont.style.width = this.gridWidth; - } - } - - //Headers table - this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); - var tH = _dom2.default.create('tHead'); - - //1st row should be headers row, ids are added if not set - //Those ids are used by the sort feature - var hRow = tbl.rows[this.gridHeadRowIndex]; - var sortTriggers = []; - for (var n = 0; n < tf.nbCells; n++) { - var c = hRow.cells[n]; - var thId = c.getAttribute('id'); - if (!thId || thId === '') { - thId = this.prfxGridTh + n + '_' + tf.id; - c.setAttribute('id', thId); - } - sortTriggers.push(thId); - } - - //Filters row is created - var filtersRow = _dom2.default.create('tr'); - if (this.gridEnableFilters && tf.fltGrid) { - tf.externalFltTgtIds = []; - for (var j = 0; j < tf.nbCells; j++) { - var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; - var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); - filtersRow.appendChild(cl); - tf.externalFltTgtIds[j] = fltTdId; - } - } - //Headers row are moved from content table to headers table - for (var i = 0; i < this.gridHeadRows.length; i++) { - var headRow = tbl.rows[this.gridHeadRows[0]]; - tH.appendChild(headRow); - } - this.headTbl.appendChild(tH); - if (tf.filtersRowIndex === 0) { - tH.insertBefore(filtersRow, hRow); - } else { - tH.appendChild(filtersRow); - } - - this.headTblCont.appendChild(this.headTbl); - this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); - - //THead needs to be removed in content table for sort feature - var thead = _dom2.default.tag(tbl, 'thead'); - if (thead.length > 0) { - tbl.removeChild(thead[0]); - } - - //Headers table style - this.headTbl.style.tableLayout = 'fixed'; - tbl.style.tableLayout = 'fixed'; - this.headTbl.cellPadding = tbl.cellPadding; - this.headTbl.cellSpacing = tbl.cellSpacing; - // this.headTbl.style.width = tbl.style.width; - - //content table without headers needs col widths to be reset - tf.setColWidths(0, this.headTbl); - - //Headers container width - // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; - - tbl.style.width = ''; - // - this.headTbl.style.width = tbl.clientWidth + 'px'; - // - - //scroll synchronisation - _event2.default.add(this.tblCont, 'scroll', function (evt) { - var elm = _event2.default.target(evt); - var scrollLeft = elm.scrollLeft; - _this2.headTblCont.scrollLeft = scrollLeft; - //New pointerX calc taking into account scrollLeft - // if(!o.isPointerXOverwritten){ - // try{ - // o.Evt.pointerX = function(evt){ - // let e = evt || global.event; - // let bdScrollLeft = tf_StandardBody().scrollLeft + - // scrollLeft; - // return (e.pageX + scrollLeft) || - // (e.clientX + bdScrollLeft); - // }; - // o.isPointerXOverwritten = true; - // } catch(err) { - // o.isPointerXOverwritten = false; - // } - // } - }); - - //Configure sort extension if any - var sort = (f.extensions || []).filter(function (itm) { - return itm.name === 'sort'; - }); - if (sort.length === 1) { - sort[0].async_sort = true; - sort[0].trigger_ids = sortTriggers; - } - - //Cols generation for all browsers excepted IE<=7 - this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; - - //Col elements are enough to keep column widths after sorting and - //filtering - var createColTags = function createColTags() { - for (var k = tf.nbCells - 1; k >= 0; k--) { - var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); - tbl.insertBefore(col, tbl.firstChild); - col.style.width = tf.colWidths[k]; - this.gridColElms[k] = col; - } - this.tblHasColTag = true; - }; - - if (!this.tblHasColTag) { - createColTags.call(this); - } else { - var cols = _dom2.default.tag(tbl, 'col'); - for (var ii = 0; ii < tf.nbCells; ii++) { - cols[ii].setAttribute('id', tf.id + '_col_' + ii); - cols[ii].style.width = tf.colWidths[ii]; - this.gridColElms.push(cols[ii]); - } - } - - var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; - f.on_after_col_resized = function (o, colIndex) { - if (!colIndex) { - return; - } - var w = o.crWColsRow.cells[colIndex].style.width; - var col = o.gridColElms[colIndex]; - col.style.width = w; - - var thCW = o.crWColsRow.cells[colIndex].clientWidth; - var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; - - if (thCW != tdCW) { - o.headTbl.style.width = tbl.clientWidth + 'px'; - } - - if (afterColResizedFn) { - afterColResizedFn.call(null, o, colIndex); - } - }; - - if (tf.popupFilters) { - filtersRow.style.display = 'none'; - } - - if (tbl.clientWidth !== this.headTbl.clientWidth) { - tbl.style.width = this.headTbl.clientWidth + 'px'; - } - - this.initialized = true; - } - - /** - * Removes the grid layout - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - var tbl = tf.tbl; - - if (!this.initialized) { - return; - } - var t = _dom2.default.remove(tbl); - this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); - _dom2.default.remove(this.tblMainCont); - - this.tblMainCont = null; - this.headTblCont = null; - this.headTbl = null; - this.tblCont = null; - - tbl.outerHTML = this.sourceTblHtml; - //needed to keep reference of table element for future usage - this.tf.tbl = t; - - this.initialized = false; - } - }]); - - return GridLayout; - })(_feature.Feature); - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var NOTIMPLEMENTED = 'Not implemented.'; - - var Feature = exports.Feature = (function () { - function Feature(tf, feature) { - _classCallCheck(this, Feature); - - this.tf = tf; - this.feature = feature; - this.enabled = tf[feature]; - this.config = tf.config(); - this.emitter = tf.emitter; - this.initialized = false; - } - - _createClass(Feature, [{ - key: 'init', - value: function init() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - } - }, { - key: 'destroy', - value: function destroy() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'enable', - value: function enable() { - this.enabled = true; - } - }, { - key: 'disable', - value: function disable() { - this.enabled = false; - } - }, { - key: 'isEnabled', - value: function isEnabled() { - return this.enabled; - } - }]); - - return Feature; - })(); - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Loader = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var Loader = exports.Loader = (function (_Feature) { - _inherits(Loader, _Feature); - - /** - * Loading message/spinner - * @param {Object} tf TableFilter instance - */ - - function Loader(tf) { - _classCallCheck(this, Loader); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); - - var f = _this.config; - - //id of container element - _this.loaderTgtId = f.loader_target_id || null; - //div containing loader - _this.loaderDiv = null; - //defines loader text - _this.loaderText = f.loader_text || 'Loading...'; - //defines loader innerHtml - _this.loaderHtml = f.loader_html || null; - //defines css class for loader div - _this.loaderCssClass = f.loader_css_class || 'loader'; - //delay for hiding loader - _this.loaderCloseDelay = 250; - //callback function before loader is displayed - _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; - //callback function after loader is closed - _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; - //loader div - _this.prfxLoader = 'load_'; - return _this; - } - - _createClass(Loader, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); - containerDiv.className = this.loaderCssClass; - - var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); - if (!this.loaderTgtId) { - targetEl.insertBefore(containerDiv, tf.tbl); - } else { - targetEl.appendChild(containerDiv); - } - this.loaderDiv = containerDiv; - if (!this.loaderHtml) { - this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); - } else { - this.loaderDiv.innerHTML = this.loaderHtml; - } - - this.show('none'); - - // Subscribe to events - emitter.on(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this2.show(''); - }); - emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.show('none'); - }); - - this.initialized = true; - } - }, { - key: 'show', - value: function show(p) { - var _this3 = this; - - if (!this.isEnabled() /*|| this.loaderDiv.style.display === p*/) { - return; - } - - var displayLoader = function displayLoader() { - if (!_this3.loaderDiv) { - return; - } - if (_this3.onShowLoader && p !== 'none') { - _this3.onShowLoader.call(null, _this3); - } - _this3.loaderDiv.style.display = p; - if (_this3.onHideLoader && p === 'none') { - _this3.onHideLoader.call(null, _this3); - } - }; - - var t = p === 'none' ? this.loaderCloseDelay : 1; - global.setTimeout(displayLoader, t); - } - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - _dom2.default.remove(this.loaderDiv); - this.loaderDiv = null; - - // Unsubscribe to events - emitter.off(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this4.show(''); - }); - emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.show('none'); - }); - - this.initialized = false; - } - }]); - - return Loader; - })(_feature.Feature); - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.HighlightKeyword = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var HighlightKeyword = exports.HighlightKeyword = (function () { - - /** - * HighlightKeyword, highlight matched keyword - * @param {Object} tf TableFilter instance - */ - - function HighlightKeyword(tf) { - _classCallCheck(this, HighlightKeyword); - - var f = tf.config(); - //defines css class for highlighting - this.highlightCssClass = f.highlight_css_class || 'keyword'; - this.highlightedNodes = []; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(HighlightKeyword, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on(['before-filtering'], function () { - return _this.unhighlightAll(); - }); - } - - /** - * highlight occurences of searched term in passed node - * @param {Node} node - * @param {String} word Searched term - * @param {String} cssClass Css class name - */ - - }, { - key: 'highlight', - value: function highlight(node, word, cssClass) { - // Iterate into this nodes childNodes - if (node.hasChildNodes) { - var children = node.childNodes; - for (var i = 0; i < children.length; i++) { - this.highlight(children[i], word, cssClass); - } - } - - if (node.nodeType === 3) { - var tempNodeVal = _string2.default.lower(node.nodeValue); - var tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) != -1) { - var pn = node.parentNode; - if (pn && pn.className != cssClass) { - // word not highlighted yet - var nv = node.nodeValue, - ni = tempNodeVal.indexOf(tempWordVal), - - // Create a load of replacement nodes - before = _dom2.default.text(nv.substr(0, ni)), - docWordVal = nv.substr(ni, word.length), - after = _dom2.default.text(nv.substr(ni + word.length)), - hiwordtext = _dom2.default.text(docWordVal), - hiword = _dom2.default.create('span'); - hiword.className = cssClass; - hiword.appendChild(hiwordtext); - pn.insertBefore(before, node); - pn.insertBefore(hiword, node); - pn.insertBefore(after, node); - pn.removeChild(node); - this.highlightedNodes.push(hiword.firstChild); - } - } - } - } - - /** - * Removes highlight to nodes matching passed string - * @param {String} word - * @param {String} cssClass Css class to remove - */ - - }, { - key: 'unhighlight', - value: function unhighlight(word, cssClass) { - var arrRemove = []; - var highlightedNodes = this.highlightedNodes; - for (var i = 0; i < highlightedNodes.length; i++) { - var n = highlightedNodes[i]; - if (!n) { - continue; - } - var tempNodeVal = _string2.default.lower(n.nodeValue), - tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) !== -1) { - var pn = n.parentNode; - if (pn && pn.className === cssClass) { - var prevSib = pn.previousSibling, - nextSib = pn.nextSibling; - if (!prevSib || !nextSib) { - continue; - } - nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; - prevSib.nodeValue = ''; - n.nodeValue = ''; - arrRemove.push(i); - } - } - } - for (var k = 0; k < arrRemove.length; k++) { - highlightedNodes.splice(arrRemove[k], 1); - } - } - - /** - * Clear all occurrences of highlighted nodes - */ - - }, { - key: 'unhighlightAll', - value: function unhighlightAll() { - if (!this.tf.highlightKeywords || !this.tf.searchArgs) { - return; - } - for (var y = 0; y < this.tf.searchArgs.length; y++) { - this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); - } - this.highlightedNodes = []; - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off(['before-filtering'], function () { - return _this2.unhighlightAll(); - }); - } - }]); - - return HighlightKeyword; - })(); - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.PopupFilter = undefined; - - var _feature = __webpack_require__(12); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var PopupFilter = exports.PopupFilter = (function (_Feature) { - _inherits(PopupFilter, _Feature); - - /** - * Pop-up filter component - * @param {Object} tf TableFilter instance - */ - - function PopupFilter(tf) { - _classCallCheck(this, PopupFilter); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); - - var f = _this.config; - - // Enable external filters - tf.isExternalFlt = true; - tf.externalFltTgtIds = []; - - //filter icon path - _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; - //active filter icon path - _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; - _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; - //defines css class for popup div containing filter - _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; - //callback function before popup filtes is opened - _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; - //callback function after popup filtes is opened - _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; - //callback function before popup filtes is closed - _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; - //callback function after popup filtes is closed - _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; - - //stores filters spans - _this.popUpFltSpans = []; - //stores filters icons - _this.popUpFltImgs = []; - //stores filters containers - _this.popUpFltElms = _this.popUpFltElmCache || []; - _this.popUpFltAdjustToContainer = true; - - //id prefix for pop-up filter span - _this.prfxPopUpSpan = 'popUpSpan_'; - //id prefix for pop-up div containing filter - _this.prfxPopUpDiv = 'popUpDiv_'; - return _this; - } - - _createClass(PopupFilter, [{ - key: 'onClick', - value: function onClick(e) { - var evt = e || global.event, - elm = evt.target.parentNode, - colIndex = parseInt(elm.getAttribute('ci'), 10); - - this.closeAll(colIndex); - this.toggle(colIndex); - - if (this.popUpFltAdjustToContainer) { - var popUpDiv = this.popUpFltElms[colIndex], - header = this.tf.getHeaderElement(colIndex), - headerWidth = header.clientWidth * 0.95; - popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; - } - _event2.default.cancel(evt); - _event2.default.stop(evt); - } - - /** - * Initialize DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - // Override headers row index if no grouped headers - if (tf.headersRow <= 1) { - tf.headersRow = 0; - } - - for (var i = 0; i < tf.nbCells; i++) { - if (tf.getFilterType(i) === tf.fltTypeNone) { - continue; - } - var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); - popUpSpan.innerHTML = this.popUpImgFltHtml; - var header = tf.getHeaderElement(i); - header.appendChild(popUpSpan); - _event2.default.add(popUpSpan, 'click', function (evt) { - _this2.onClick(evt); - }); - this.popUpFltSpans[i] = popUpSpan; - this.popUpFltImgs[i] = popUpSpan.firstChild; - } - - // subscribe to events - this.emitter.on(['before-filtering'], function () { - return _this2.buildIcons(); - }); - this.emitter.on(['after-filtering'], function () { - return _this2.closeAll(); - }); - this.emitter.on(['cell-processed'], function (tf, cellIndex) { - return _this2.buildIcon(cellIndex, true); - }); - this.emitter.on(['filters-row-inserted'], function () { - return _this2.tf.headersRow++; - }); - this.emitter.on(['before-filter-init'], function (tf, colIndex) { - return _this2.build(colIndex); - }); - - this.initialized = true; - } - - /** - * Reset previously destroyed feature - */ - - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - this.buildAll(); - } - - /** - * Build all pop-up filters elements - */ - - }, { - key: 'buildAll', - value: function buildAll() { - for (var i = 0; i < this.popUpFltElmCache.length; i++) { - this.build(i, this.popUpFltElmCache[i]); - } - } - - /** - * Build a specified pop-up filter elements - * @param {Number} colIndex Column index - * @param {Object} div Optional container DOM element - */ - - }, { - key: 'build', - value: function build(colIndex, div) { - var tf = this.tf; - var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; - popUpDiv.className = this.popUpDivCssClass; - tf.externalFltTgtIds.push(popUpDiv.id); - var header = tf.getHeaderElement(colIndex); - header.insertBefore(popUpDiv, header.firstChild); - _event2.default.add(popUpDiv, 'click', function (evt) { - _event2.default.stop(evt); - }); - this.popUpFltElms[colIndex] = popUpDiv; - } - - /** - * Toogle visibility of specified filter - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggle', - value: function toggle(colIndex) { - var tf = this.tf, - popUpFltElm = this.popUpFltElms[colIndex]; - - if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { - if (this.onBeforePopUpOpen) { - this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'block'; - if (tf.getFilterType(colIndex) === tf.fltTypeInp) { - var flt = tf.getFilterElement(colIndex); - if (flt) { - flt.focus(); - } - } - if (this.onAfterPopUpOpen) { - this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } else { - if (this.onBeforePopUpClose) { - this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'none'; - if (this.onAfterPopUpClose) { - this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } - } - - /** - * Close all filters excepted for the specified one if any - * @param {Number} exceptIdx Column index of the filter to not close - */ - - }, { - key: 'closeAll', - value: function closeAll(exceptIdx) { - for (var i = 0; i < this.popUpFltElms.length; i++) { - if (i === exceptIdx) { - continue; - } - var popUpFltElm = this.popUpFltElms[i]; - if (popUpFltElm) { - popUpFltElm.style.display = 'none'; - } - } - } - - /** - * Build all the icons representing the pop-up filters - */ - - }, { - key: 'buildIcons', - value: function buildIcons() { - for (var i = 0; i < this.popUpFltImgs.length; i++) { - this.buildIcon(i, false); - } - } - - /** - * Apply specified icon state - * @param {Number} colIndex Column index - * @param {Boolean} active Apply active state - */ - - }, { - key: 'buildIcon', - value: function buildIcon(colIndex, active) { - if (this.popUpFltImgs[colIndex]) { - this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; - } - } - - /** - * Remove pop-up filters - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - this.popUpFltElmCache = []; - for (var i = 0; i < this.popUpFltElms.length; i++) { - var popUpFltElm = this.popUpFltElms[i], - popUpFltSpan = this.popUpFltSpans[i], - popUpFltImg = this.popUpFltImgs[i]; - if (popUpFltElm) { - _dom2.default.remove(popUpFltElm); - this.popUpFltElmCache[i] = popUpFltElm; - } - popUpFltElm = null; - if (popUpFltSpan) { - _dom2.default.remove(popUpFltSpan); - } - popUpFltSpan = null; - if (popUpFltImg) { - _dom2.default.remove(popUpFltImg); - } - popUpFltImg = null; - } - this.popUpFltElms = []; - this.popUpFltSpans = []; - this.popUpFltImgs = []; - - // unsubscribe to events - this.emitter.off(['before-filtering'], function () { - return _this3.buildIcons(); - }); - this.emitter.off(['after-filtering'], function () { - return _this3.closeAll(); - }); - this.emitter.off(['cell-processed'], function (tf, cellIndex) { - return _this3.buildIcon(cellIndex, true); - }); - this.emitter.off(['filters-row-inserted'], function () { - return _this3.tf.headersRow++; - }); - this.emitter.off(['before-filter-init'], function (tf, colIndex) { - return _this3.build(colIndex); - }); - - this.initialized = false; - } - }]); - - return PopupFilter; - })(_feature.Feature); - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Dropdown = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Dropdown = exports.Dropdown = (function (_Feature) { - _inherits(Dropdown, _Feature); - - /** - * Dropdown UI component - * @param {Object} tf TableFilter instance - */ - - function Dropdown(tf) { - _classCallCheck(this, Dropdown); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Dropdown).call(this, tf, 'dropdown')); - - var f = tf.config(); - - _this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; - //defines empty option text - _this.nonEmptyText = f.non_empty_text || '(Non empty)'; - //sets select filling method: 'innerHTML' or 'createElement' - _this.slcFillingMethod = f.slc_filling_method || 'createElement'; - //IE only, tooltip text appearing on select before it is populated - _this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; - //tooltip text appearing on multiple select - _this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; - - _this.isCustom = null; - _this.opts = null; - _this.optsTxt = null; - _this.slcInnerHtml = null; - return _this; - } - - _createClass(Dropdown, [{ - key: 'onSlcFocus', - value: function onSlcFocus(e) { - var elm = _event2.default.target(e); - var tf = this.tf; - tf.activeFilterId = elm.getAttribute('id'); - tf.activeFlt = _dom2.default.id(tf.activeFilterId); - // select is populated when element has focus - if (tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - this.build(ct); - } - // if(tf.popupFilters){ - // Event.cancel(e); - // Event.stop(e); - // } - this.emitter.emit('filter-focus', tf, this); - } - - /** - * Initialize drop-down filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - }, { - key: 'init', - value: function init(colIndex, isExternal, container) { - var _this2 = this; - - var tf = this.tf; - var col = tf.getFilterType(colIndex); - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var slc = _dom2.default.create(tf.fltTypeSlc, ['id', tf.prfxFlt + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - - if (col === tf.fltTypeMulti) { - slc.multiple = tf.fltTypeMulti; - slc.title = this.multipleSlcTooltip; - } - slc.className = _string2.default.lower(col) === tf.fltTypeSlc ? tf.fltCssClass : tf.fltMultiCssClass; - - //filter is appended in container element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(slc); - tf.externalFltEls.push(slc); - } else { - container.appendChild(slc); - } - - tf.fltIds.push(slc.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - //1st option is created here since build isn't invoked - var opt0 = _dom2.default.createOpt(tf.displayAllText, ''); - slc.appendChild(opt0); - } - - _event2.default.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); - _event2.default.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); - _event2.default.add(slc, 'focus', function (e) { - return _this2.onSlcFocus(e); - }); - - this.initialized = true; - } - - /** - * Build drop-down filter UI - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Boolean} isExternal Render in external container - * @param {String} extSlcId External container id - */ - - }, { - key: 'build', - value: function build(colIndex) { - var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - this.slcInnerHtml = ''; - - var slcId = tf.fltIds[colIndex]; - if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { - return; - } - var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), - rows = tf.tbl.rows, - matchCase = tf.matchCase; - - //custom select test - this.isCustom = tf.isCustomOptions(colIndex); - - //custom selects text - var activeFlt = undefined; - if (isLinked && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - var excludedOpts = null, - filteredDataCol = null; - if (isLinked && tf.disableExcludedOptions) { - excludedOpts = []; - filteredDataCol = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cell = rows[k].cells, - nchilds = cell.length; - - // checks if row has exact cell # - if (nchilds !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - // WTF: cyclomatic complexity hell - if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cell[j]), - - //Vary Peter's patch - cell_string = _string2.default.matchCase(cell_data, matchCase); - - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, matchCase)) { - this.opts.push(cell_data); - } - - if (isLinked && tf.disableExcludedOptions) { - var filteredCol = filteredDataCol[j]; - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { - excludedOpts.push(cell_data); - } - } - } //if colIndex==j - } //for j - } //for k - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (excludedOpts) { - excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - } - } - - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (excludedOpts) { - excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (excludedOpts) { - excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - //populates drop-down - this.addOptions(colIndex, slc, isLinked, excludedOpts); - - this.emitter.emit('after-populating-filter', tf, colIndex, slc); - } - - /** - * Add drop-down options - * @param {Number} colIndex Column index - * @param {Object} slc Select Dom element - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Array} excludedOpts Array of excluded options - * @param {Array} fltsValues Collection of persisted filter values - * @param {Array} fltArr Collection of persisted filter values - */ - - }, { - key: 'addOptions', - value: function addOptions(colIndex, slc, isLinked, excludedOpts /*, fltsValues, fltArr*/) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod), - slcValue = slc.value; - - slc.innerHTML = ''; - slc = this.addFirstOption(slc); - - for (var y = 0; y < this.opts.length; y++) { - if (this.opts[y] === '') { - continue; - } - var val = this.opts[y]; //option value - var lbl = this.isCustom ? this.optsTxt[y] : val; //option text - var isDisabled = false; - if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - isDisabled = true; - } - - if (fillMethod === 'innerhtml') { - var slcAttr = ''; - if (tf.loadFltOnDemand && slcValue === this.opts[y]) { - slcAttr = 'selected="selected"'; - } - this.slcInnerHtml += ''; - } else { - var opt = undefined; - //fill select on demand - if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { - opt = _dom2.default.createOpt(lbl, val, true); - } else { - opt = _dom2.default.createOpt(lbl, val, false); - } - if (isDisabled) { - opt.disabled = true; - } - slc.appendChild(opt); - } - } // for y - - if (fillMethod === 'innerhtml') { - slc.innerHTML += this.slcInnerHtml; - } - slc.setAttribute('filled', '1'); - } - - /** - * Add drop-down header option - * @param {Object} slc Select DOM element - */ - - }, { - key: 'addFirstOption', - value: function addFirstOption(slc) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod); - - if (fillMethod === 'innerhtml') { - this.slcInnerHtml += ''; - } else { - var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); - if (!this.enableSlcResetFilter) { - opt0.style.display = 'none'; - } - slc.appendChild(opt0); - if (tf.enableEmptyOption) { - var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); - slc.appendChild(opt1); - } - if (tf.enableNonEmptyOption) { - var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); - slc.appendChild(opt2); - } - } - return slc; - } - }, { - key: 'destroy', - value: function destroy() {} - }]); - - return Dropdown; - })(_feature.Feature); - -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - ignoreCase: function ignoreCase(a, b) { - var x = _string2.default.lower(a); - var y = _string2.default.lower(b); - return x < y ? -1 : x > y ? 1 : 0; - } - }; - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.CheckList = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var CheckList = exports.CheckList = (function (_Feature) { - _inherits(CheckList, _Feature); - - /** - * Checklist UI component - * @param {Object} tf TableFilter instance - */ - - function CheckList(tf) { - _classCallCheck(this, CheckList); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CheckList).call(this, tf, 'checkList')); - - var f = tf.config(); - - _this.checkListDiv = []; //checklist container div - //defines css class for div containing checklist filter - _this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; - //defines css class for checklist filters - _this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; - //defines css class for checklist item (li) - _this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; - //defines css class for selected checklist item (li) - _this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; - //Load on demand text - _this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; - //defines css class for checklist filters - _this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; - _this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; - //checklist filter container div - _this.prfxCheckListDiv = 'chkdiv_'; - - _this.isCustom = null; - _this.opts = null; - _this.optsTxt = null; - _this.excludedOpts = null; - return _this; - } - - // TODO: move event here - - _createClass(CheckList, [{ - key: 'onChange', - value: function onChange(evt) { - var elm = evt.target; - this.tf.activeFilterId = elm.getAttribute('id'); - this.tf.activeFlt = _dom2.default.id(this.tf.activeFilterId); - this.tf.Evt.onSlcChange.call(this.tf, evt); - } - }, { - key: 'optionClick', - value: function optionClick(evt) { - this.setCheckListValues(evt.target); - this.onChange(evt); - } - }, { - key: 'onCheckListClick', - value: function onCheckListClick(evt) { - var _this2 = this; - - var elm = _event2.default.target(evt); - if (this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - var div = this.checkListDiv[ct]; - this.build(ct); - _event2.default.remove(div, 'click', function (evt) { - return _this2.onCheckListClick(evt); - }); - } - } - - /** - * Initialize checklist filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - }, { - key: 'init', - value: function init(colIndex, isExternal, container) { - var _this3 = this; - - var tf = this.tf; - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var divCont = _dom2.default.create('div', ['id', this.prfxCheckListDiv + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - divCont.className = this.checkListDivCssClass; - - //filter is appended in desired element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(divCont); - tf.externalFltEls.push(divCont); - } else { - container.appendChild(divCont); - } - - this.checkListDiv[colIndex] = divCont; - tf.fltIds.push(tf.prfxFlt + colIndex + '_' + tf.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - _event2.default.add(divCont, 'click', function (evt) { - return _this3.onCheckListClick(evt); - }); - divCont.appendChild(_dom2.default.text(this.activateCheckListTxt)); - } - - this.initialized = true; - } - - /** - * Build checklist UI - * @param {Number} colIndex Column index - * @param {Boolean} isExternal Render in external container - * @param {String} extFltId External container id - */ - - }, { - key: 'build', - value: function build(colIndex) { - var _this4 = this; - - var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - - var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; - if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { - return; - } - - var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); - var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); - ul.className = this.checkListCssClass; - _event2.default.add(ul, 'change', function (evt) { - return _this4.onChange(evt); - }); - - var rows = tf.tbl.rows; - this.isCustom = tf.isCustomOptions(colIndex); - - var activeFlt = undefined; - if (tf.linkedFilters && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - var filteredDataCol = []; - if (tf.linkedFilters && tf.disableExcludedOptions) { - this.excludedOpts = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cells = rows[k].cells; - var ncells = cells.length; - - // checks if row has exact cell # - if (ncells !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < ncells; j++) { - // WTF: cyclomatic complexity hell :) - if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cells[j]); - //Vary Peter's patch - var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { - this.opts.push(cell_data); - } - var filteredCol = filteredDataCol[j]; - if (tf.linkedFilters && tf.disableExcludedOptions) { - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { - this.excludedOpts.push(cell_data); - } - } - } - } - } - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!tf.matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (this.excludedOpts) { - this.excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - } - } - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - this.addChecks(colIndex, ul, tf.separator); - - if (tf.loadFltOnDemand) { - flt.innerHTML = ''; - } - flt.appendChild(ul); - flt.setAttribute('filled', '1'); - - this.emitter.emit('after-populating-filter', tf, colIndex, flt); - } - - /** - * Add checklist options - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addChecks', - value: function addChecks(colIndex, ul) { - var _this5 = this; - - var tf = this.tf; - var chkCt = this.addTChecks(colIndex, ul); - - for (var y = 0; y < this.opts.length; y++) { - var val = this.opts[y]; //item value - var lbl = this.isCustom ? this.optsTxt[y] : val; //item text - var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); - li.className = this.checkListItemCssClass; - if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - _dom2.default.addClass(li, this.checkListItemDisabledCssClass); - li.check.disabled = true; - li.disabled = true; - } else { - _event2.default.add(li.check, 'click', function (evt) { - return _this5.optionClick(evt); - }); - } - ul.appendChild(li); - - if (val === '') { - //item is hidden - li.style.display = 'none'; - } - } - } - - /** - * Add checklist header option - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addTChecks', - value: function addTChecks(colIndex, ul) { - var _this6 = this; - - var tf = this.tf; - var chkCt = 1; - var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); - li0.className = this.checkListItemCssClass; - ul.appendChild(li0); - - _event2.default.add(li0.check, 'click', function (evt) { - _this6.optionClick(evt); - }); - - if (!this.enableCheckListResetFilter) { - li0.style.display = 'none'; - } - - if (tf.enableEmptyOption) { - var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); - li1.className = this.checkListItemCssClass; - ul.appendChild(li1); - _event2.default.add(li1.check, 'click', function (evt) { - return _this6.optionClick(evt); - }); - chkCt++; - } - - if (tf.enableNonEmptyOption) { - var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); - li2.className = this.checkListItemCssClass; - ul.appendChild(li2); - _event2.default.add(li2.check, 'click', function (evt) { - return _this6.optionClick(evt); - }); - chkCt++; - } - return chkCt; - } - - /** - * Store checked options in DOM element attribute - * @param {Object} o checklist option DOM element - */ - - }, { - key: 'setCheckListValues', - value: function setCheckListValues(o) { - if (!o) { - return; - } - var tf = this.tf; - var chkValue = o.value; //checked item value - var chkIndex = parseInt(o.id.split('_')[2], 10); - var filterTag = 'ul', - itemTag = 'li'; - var n = o; - - //ul tag search - while (_string2.default.lower(n.nodeName) !== filterTag) { - n = n.parentNode; - } - - var li = n.childNodes[chkIndex]; - var colIndex = n.getAttribute('colIndex'); - var fltValue = n.getAttribute('value'); //filter value (ul tag) - var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) - - if (o.checked) { - //show all item - if (chkValue === '') { - if (fltIndexes && fltIndexes !== '') { - //items indexes - var indSplit = fltIndexes.split(tf.separator); - //checked items loop - for (var u = 0; u < indSplit.length; u++) { - //checked item - var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); - if (cChk) { - cChk.checked = false; - _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); - } - } - } - n.setAttribute('value', ''); - n.setAttribute('indexes', ''); - } else { - fltValue = fltValue ? fltValue : ''; - chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); - chkIndex = fltIndexes + chkIndex + tf.separator; - n.setAttribute('value', chkValue); - n.setAttribute('indexes', chkIndex); - //1st option unchecked - if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { - _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; - } - } - - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); - _dom2.default.addClass(li, this.checkListSlcItemCssClass); - } - } else { - //removes values and indexes - if (chkValue !== '') { - var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); - fltValue = fltValue.replace(replaceValue, ''); - n.setAttribute('value', _string2.default.trim(fltValue)); - - var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); - fltIndexes = fltIndexes.replace(replaceIndex, ''); - n.setAttribute('indexes', fltIndexes); - } - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(li, this.checkListSlcItemCssClass); - } - } - } - }, { - key: 'destroy', - value: function destroy() {} - }]); - - return CheckList; - })(_feature.Feature); - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.RowsCounter = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var RowsCounter = exports.RowsCounter = (function (_Feature) { - _inherits(RowsCounter, _Feature); - - /** - * Rows counter - * @param {Object} tf TableFilter instance - */ - - function RowsCounter(tf) { - _classCallCheck(this, RowsCounter); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); - - var f = _this.config; - - //id of custom container element - _this.rowsCounterTgtId = f.rows_counter_target_id || null; - //element containing tot nb rows - _this.rowsCounterDiv = null; - //element containing tot nb rows label - _this.rowsCounterSpan = null; - //defines rows counter text - _this.rowsCounterText = f.rows_counter_text || 'Rows: '; - _this.fromToTextSeparator = f.from_to_text_separator || '-'; - _this.overText = f.over_text || ' / '; - //defines css class rows counter - _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; - //rows counter div - _this.prfxCounter = 'counter_'; - //nb displayed rows label - _this.prfxTotRows = 'totrows_span_'; - //label preceding nb rows label - _this.prfxTotRowsTxt = 'totRowsTextSpan_'; - //callback raised before counter is refreshed - _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; - //callback raised after counter is refreshed - _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; - return _this; - } - - _createClass(RowsCounter, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - //rows counter container - var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); - countDiv.className = this.totRowsCssClass; - //rows counter label - var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); - var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); - countText.appendChild(_dom2.default.text(this.rowsCounterText)); - - // counter is added to defined element - if (!this.rowsCounterTgtId) { - tf.setToolbar(); - } - var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); - - //default container: 'lDiv' - if (!this.rowsCounterTgtId) { - countDiv.appendChild(countText); - countDiv.appendChild(countSpan); - targetEl.appendChild(countDiv); - } else { - //custom container, no need to append statusDiv - targetEl.appendChild(countText); - targetEl.appendChild(countSpan); - } - this.rowsCounterDiv = countDiv; - this.rowsCounterSpan = countSpan; - - // subscribe to events - this.emitter.on(['after-filtering', 'grouped-by-page'], function () { - return _this2.refresh(tf.nbVisibleRows); - }); - this.emitter.on(['rows-changed'], function () { - return _this2.refresh(); - }); - - this.initialized = true; - this.refresh(); - } - }, { - key: 'refresh', - value: function refresh(p) { - if (!this.initialized || !this.isEnabled()) { - return; - } - - var tf = this.tf; - - if (this.onBeforeRefreshCounter) { - this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); - } - - var totTxt; - if (!tf.paging) { - if (p && p !== '') { - totTxt = p; - } else { - totTxt = tf.nbFilterableRows - tf.nbHiddenRows; - } - } else { - var paging = tf.feature('paging'); - if (paging) { - //paging start row - var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); - var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; - totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; - } - } - - this.rowsCounterSpan.innerHTML = totTxt; - if (this.onAfterRefreshCounter) { - this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - if (!this.rowsCounterTgtId && this.rowsCounterDiv) { - _dom2.default.remove(this.rowsCounterDiv); - } else { - _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; - } - this.rowsCounterSpan = null; - this.rowsCounterDiv = null; - - // unsubscribe to events - this.emitter.off(['after-filtering', 'grouped-by-page'], function () { - return _this3.refresh(tf.nbVisibleRows); - }); - this.emitter.off(['rows-changed'], function () { - return _this3.refresh(); - }); - - this.initialized = false; - } - }]); - - return RowsCounter; - })(_feature.Feature); - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.StatusBar = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var StatusBar = exports.StatusBar = (function (_Feature) { - _inherits(StatusBar, _Feature); - - /** - * Status bar UI component - * @param {Object} tf TableFilter instance - */ - - function StatusBar(tf) { - _classCallCheck(this, StatusBar); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); - - var f = _this.config; - - //id of custom container element - _this.statusBarTgtId = f.status_bar_target_id || null; - //element containing status bar label - _this.statusBarDiv = null; - //status bar - _this.statusBarSpan = null; - //status bar label - _this.statusBarSpanText = null; - //defines status bar text - _this.statusBarText = f.status_bar_text || ''; - //defines css class status bar - _this.statusBarCssClass = f.status_bar_css_class || 'status'; - //delay for status bar clearing - _this.statusBarCloseDelay = 250; - - //calls function before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //calls function after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - - //status messages - _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 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)...'; - - // status bar div - _this.prfxStatus = 'status_'; - // status bar label - _this.prfxStatusSpan = 'statusSpan_'; - // text preceding status bar label - _this.prfxStatusTxt = 'statusText_'; - return _this; - } - - _createClass(StatusBar, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - //status bar container - var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); - statusDiv.className = this.statusBarCssClass; - - //status bar label - var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); - //preceding text - var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); - statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); - - // target element container - if (!this.statusBarTgtId) { - tf.setToolbar(); - } - var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); - - //default container: 'lDiv' - if (!this.statusBarTgtId) { - statusDiv.appendChild(statusSpanText); - statusDiv.appendChild(statusSpan); - targetEl.appendChild(statusDiv); - } else { - // custom container, no need to append statusDiv - targetEl.appendChild(statusSpanText); - targetEl.appendChild(statusSpan); - } - - this.statusBarDiv = statusDiv; - this.statusBarSpan = statusSpan; - this.statusBarSpanText = statusSpanText; - - // Subscribe to events - emitter.on(['before-filtering'], function () { - return _this2.message(_this2.msgFilter); - }); - emitter.on(['before-populating-filter'], function () { - return _this2.message(_this2.msgPopulate); - }); - emitter.on(['before-changing-page'], function () { - return _this2.message(_this2.msgChangePage); - }); - emitter.on(['before-clearing-filters'], function () { - return _this2.message(_this2.msgClear); - }); - emitter.on(['before-changing-results-per-page'], function () { - return _this2.message(_this2.msgChangeResults); - }); - emitter.on(['before-reset-page'], function () { - return _this2.message(_this2.msgResetPage); - }); - emitter.on(['before-reset-page-length'], function () { - return _this2.message(_this2.msgResetPageLength); - }); - emitter.on(['before-loading-extensions'], function () { - return _this2.message(_this2.msgLoadExtensions); - }); - emitter.on(['before-loading-themes'], function () { - return _this2.message(_this2.msgLoadThemes); - }); - - emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.message(''); - }); - - this.initialized = true; - } - }, { - key: 'message', - value: function message() { - var _this3 = this; - - var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; - - if (!this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, t); - } - - var d = t === '' ? this.statusBarCloseDelay : 1; - global.setTimeout(function () { - if (!_this3.initialized) { - return; - } - _this3.statusBarSpan.innerHTML = t; - if (_this3.onAfterShowMsg) { - _this3.onAfterShowMsg.call(null, _this3.tf, t); - } - }, d); - } - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - this.statusBarDiv.innerHTML = ''; - _dom2.default.remove(this.statusBarDiv); - this.statusBarSpan = null; - this.statusBarSpanText = null; - this.statusBarDiv = null; - - // Unsubscribe to events - emitter.off(['before-filtering'], function () { - return _this4.message(_this4.msgFilter); - }); - emitter.off(['before-populating-filter'], function () { - return _this4.message(_this4.msgPopulate); - }); - emitter.off(['before-changing-page'], function () { - return _this4.message(_this4.msgChangePage); - }); - emitter.off(['before-clearing-filters'], function () { - return _this4.message(_this4.msgClear); - }); - emitter.off(['before-changing-results-per-page'], function () { - return _this4.message(_this4.msgChangeResults); - }); - emitter.off(['before-reset-page'], function () { - return _this4.message(_this4.msgResetPage); - }); - emitter.off(['before-reset-page-length'], function () { - return _this4.message(_this4.msgResetPageLength); - }); - emitter.off(['before-loading-extensions'], function () { - return _this4.message(_this4.msgLoadExtensions); - }); - emitter.off(['before-loading-themes'], function () { - return _this4.message(_this4.msgLoadThemes); - }); - - emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.message(''); - }); - - this.initialized = false; - } - }]); - - return StatusBar; - })(_feature.Feature); - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Paging = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Paging = exports.Paging = (function (_Feature) { - _inherits(Paging, _Feature); - - /** - * Pagination component - * @param {Object} tf TableFilter instance - */ - - function Paging(tf) { - _classCallCheck(this, Paging); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); - - var f = _this.config; - - //css class for paging buttons (previous,next,etc.) - _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; - //stores paging select element - _this.pagingSlc = null; - //results per page select element - _this.resultsPerPageSlc = null; - //id of container element - _this.pagingTgtId = f.paging_target_id || null; - //defines table paging length - _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; - //id of container element - _this.resultsPerPageTgtId = f.results_per_page_target_id || null; - //css class for paging select element - _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; - //css class for paging input element - _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; - //stores results per page text and values - _this.resultsPerPage = f.results_per_page || null; - //enables/disables results per page drop-down - _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); - //defines css class for results per page select - _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; - //css class for label preceding results per page select - _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; - //1st row index of current page - _this.startPagingRow = 0; - //total nb of pages - _this.nbPages = 0; - //current page nb - _this.currentPageNb = 1; - //defines next page button text - _this.btnNextPageText = f.btn_next_page_text || '>'; - //defines previous page button text - _this.btnPrevPageText = f.btn_prev_page_text || '<'; - //defines last page button text - _this.btnLastPageText = f.btn_last_page_text || '>|'; - //defines first page button text - _this.btnFirstPageText = f.btn_first_page_text || '|<'; - //defines next page button html - _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); - //defines last page button html - _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); - //defines text preceeding page selector drop-down - _this.pageText = f.page_text || ' Page '; - //defines text after page selector drop-down - _this.ofText = f.of_text || ' of '; - //css class for span containing tot nb of pages - _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; - //enables/disables paging buttons - _this.hasPagingBtns = f.paging_btns === false ? false : true; - //defines previous page button html - _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; - //calls function before page is changed - _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; - //calls function before page is changed - _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; - - //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_'; - - var start_row = tf.refRow; - var nrows = tf.nbRows; - //calculates page nb - _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); - - //Paging elements events - var o = _this; - // Paging DOM events - _this.evt = { - slcIndex: function slcIndex() { - return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; - }, - nbOpts: function nbOpts() { - return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; - }, - next: function next() { - var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; - o.changePage(nextIndex); - }, - prev: function prev() { - var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); - o.changePage(prevIndex); - }, - last: function last() { - o.changePage(o.evt.nbOpts()); - }, - first: function first() { - o.changePage(0); - }, - _detectKey: function _detectKey(e) { - var key = _event2.default.keyCode(e); - if (key === 13) { - if (tf.sorted) { - tf.filter(); - o.changePage(o.evt.slcIndex()); - } else { - o.changePage(); - } - this.blur(); - } - }, - - slcPagesChange: null, - nextEvt: null, - prevEvt: null, - lastEvt: null, - firstEvt: null - }; - return _this; - } - - /** - * Initialize DOM elements - */ - - _createClass(Paging, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var slcPages; - var tf = this.tf; - var evt = this.evt; - - if (this.initialized) { - return; - } - - // Check resultsPerPage is in expected format and initialise the - // results per page component - if (this.hasResultsPerPage) { - if (this.resultsPerPage.length < 2) { - this.hasResultsPerPage = false; - } else { - this.pagingLength = this.resultsPerPage[1][0]; - this.setResultsPerPage(); - } - } - - evt.slcPagesChange = function (event) { - var slc = event.target; - _this2.changePage(slc.selectedIndex); - }; - - // Paging drop-down list selector - if (this.pageSelectorType === tf.fltTypeSlc) { - slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); - slcPages.className = this.pgSlcCssClass; - _event2.default.add(slcPages, 'change', evt.slcPagesChange); - } - - // Paging input selector - if (this.pageSelectorType === tf.fltTypeInp) { - slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); - slcPages.className = this.pgInpCssClass; - _event2.default.add(slcPages, 'keypress', evt._detectKey); - } - - // btns containers - var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); - var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); - var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); - var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); - - if (this.hasPagingBtns) { - // Next button - if (!this.btnNextPageHtml) { - var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); - btn_next.className = this.btnPageCssClass; - _event2.default.add(btn_next, 'click', evt.next); - btnNextSpan.appendChild(btn_next); - } else { - btnNextSpan.innerHTML = this.btnNextPageHtml; - _event2.default.add(btnNextSpan, 'click', evt.next); - } - // Previous button - if (!this.btnPrevPageHtml) { - var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); - btn_prev.className = this.btnPageCssClass; - _event2.default.add(btn_prev, 'click', evt.prev); - btnPrevSpan.appendChild(btn_prev); - } else { - btnPrevSpan.innerHTML = this.btnPrevPageHtml; - _event2.default.add(btnPrevSpan, 'click', evt.prev); - } - // Last button - if (!this.btnLastPageHtml) { - var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); - btn_last.className = this.btnPageCssClass; - _event2.default.add(btn_last, 'click', evt.last); - btnLastSpan.appendChild(btn_last); - } else { - btnLastSpan.innerHTML = this.btnLastPageHtml; - _event2.default.add(btnLastSpan, 'click', evt.last); - } - // First button - if (!this.btnFirstPageHtml) { - var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); - btn_first.className = this.btnPageCssClass; - _event2.default.add(btn_first, 'click', evt.first); - btnFirstSpan.appendChild(btn_first); - } else { - btnFirstSpan.innerHTML = this.btnFirstPageHtml; - _event2.default.add(btnFirstSpan, 'click', evt.first); - } - } - - // paging elements (buttons+drop-down list) are added to defined element - if (!this.pagingTgtId) { - tf.setToolbar(); - } - var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - targetEl.appendChild(btnFirstSpan); - targetEl.appendChild(btnPrevSpan); - - var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); - pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); - pgBeforeSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgBeforeSpan); - targetEl.appendChild(slcPages); - var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); - pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); - pgAfterSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgAfterSpan); - var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); - pgspan.className = this.nbPgSpanCssClass; - pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); - targetEl.appendChild(pgspan); - targetEl.appendChild(btnNextSpan); - targetEl.appendChild(btnLastSpan); - this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); - - if (!tf.rememberGridValues) { - this.setPagingInfo(); - } - if (!tf.fltGrid) { - tf.validateAllRows(); - this.setPagingInfo(tf.validRowsIndex); - } - - this.emitter.on(['after-filtering'], function () { - return _this2.resetPagingInfo(); - }); - this.emitter.on(['initialized'], function () { - return _this2.resetValues(); - }); - - this.initialized = true; - } - - /** - * Reset paging when filters are already instantiated - * @param {Boolean} filterTable Execute filtering once paging instanciated - */ - - }, { - key: 'reset', - value: function reset() { - var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var tf = this.tf; - if (!tf.hasGrid() || this.isEnabled()) { - return; - } - this.enable(); - this.init(); - tf.resetValues(); - if (filterTable) { - tf.filter(); - } - } - - /** - * Reset paging info from scratch after a filtering process - */ - - }, { - key: 'resetPagingInfo', - value: function resetPagingInfo() { - this.startPagingRow = 0; - this.currentPageNb = 1; - this.setPagingInfo(this.tf.validRowsIndex); - } - - /** - * Calculate number of pages based on valid rows - * Refresh paging select according to number of pages - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'setPagingInfo', - value: function setPagingInfo(validRows) { - var tf = this.tf; - var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - //store valid rows indexes - tf.validRowsIndex = validRows || tf.getValidRows(true); - - //calculate nb of pages - this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); - //refresh page nb span - pgspan.innerHTML = this.nbPages; - //select clearing shortcut - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.innerHTML = ''; - } - - if (this.nbPages > 0) { - mdiv.style.visibility = 'visible'; - if (this.pageSelectorType === tf.fltTypeSlc) { - for (var z = 0; z < this.nbPages; z++) { - var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); - this.pagingSlc.options[z] = opt; - } - } else { - //input type - this.pagingSlc.value = this.currentPageNb; - } - } else { - /*** if no results paging select and buttons are hidden ***/ - mdiv.style.visibility = 'hidden'; - } - this.groupByPage(tf.validRowsIndex); - } - - /** - * Group table rows by page and display valid rows - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'groupByPage', - value: function groupByPage(validRows) { - var tf = this.tf; - var rows = tf.tbl.rows; - var startPagingRow = parseInt(this.startPagingRow, 10); - var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); - - //store valid rows indexes - if (validRows) { - tf.validRowsIndex = validRows; - } - - //this loop shows valid rows of current page - for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { - var validRowIdx = tf.validRowsIndex[h]; - var r = rows[validRowIdx]; - var isRowValid = r.getAttribute('validRow'); - var rowDisplayed = false; - - if (h >= startPagingRow && h < endPagingRow) { - if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { - r.style.display = ''; - rowDisplayed = true; - } - } else { - r.style.display = 'none'; - } - this.emitter.emit('row-paged', tf, validRowIdx, h, rowDisplayed); - } - - tf.nbVisibleRows = tf.validRowsIndex.length; - - // broadcast grouping by page - this.emitter.emit('grouped-by-page', tf, this); - } - - /** - * Return the current page number - * @return {Number} Page number - */ - - }, { - key: 'getPage', - value: function getPage() { - return this.currentPageNb; - } - - /** - * Show page based on passed param value (string or number): - * @param {String} or {Number} cmd possible string values: 'next', - * 'previous', 'last', 'first' or page number as per param - */ - - }, { - key: 'setPage', - value: function setPage(cmd) { - var tf = this.tf; - if (!tf.hasGrid() || !this.isEnabled()) { - return; - } - var btnEvt = this.evt, - cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); - if (cmdtype === 'string') { - switch (_string2.default.lower(cmd)) { - case 'next': - btnEvt.next(); - break; - case 'previous': - btnEvt.prev(); - break; - case 'last': - btnEvt.last(); - break; - case 'first': - btnEvt.first(); - break; - default: - btnEvt.next(); - break; - } - } else if (cmdtype === 'number') { - this.changePage(cmd - 1); - } - } - - /** - * Generates UI elements for the number of results per page drop-down - */ - - }, { - key: 'setResultsPerPage', - value: function setResultsPerPage() { - var _this3 = this; - - var tf = this.tf; - var evt = this.evt; - - if (!tf.hasGrid() && !tf.isFirstLoad) { - return; - } - if (this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - - evt.slcResultsChange = function (ev) { - _this3.changeResultsPerPage(); - ev.target.blur(); - }; - - var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); - slcR.className = this.resultsSlcCssClass; - var slcRText = this.resultsPerPage[0], - slcROpts = this.resultsPerPage[1]; - var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); - slcRSpan.className = this.resultsSpanCssClass; - - // results per page select is added to external element - if (!this.resultsPerPageTgtId) { - tf.setToolbar(); - } - var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); - slcRSpan.appendChild(_dom2.default.text(slcRText)); - - var help = tf.feature('help'); - if (help && help.btn) { - help.btn.parentNode.insertBefore(slcRSpan, help.btn); - help.btn.parentNode.insertBefore(slcR, help.btn); - } else { - targetEl.appendChild(slcRSpan); - targetEl.appendChild(slcR); - } - - for (var r = 0; r < slcROpts.length; r++) { - var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); - slcR.options[r] = currOpt; - } - _event2.default.add(slcR, 'change', evt.slcResultsChange); - this.resultsPerPageSlc = slcR; - } - - /** - * Remove number of results per page UI elements - */ - - }, { - key: 'removeResultsPerPage', - value: function removeResultsPerPage() { - var tf = this.tf; - if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - var slcR = this.resultsPerPageSlc, - slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); - if (slcR) { - _dom2.default.remove(slcR); - } - if (slcRSpan) { - _dom2.default.remove(slcRSpan); - } - this.resultsPerPageSlc = null; - } - - /** - * Change the page according to passed index - * @param {Number} index Index of the page (0-n) - */ - - }, { - key: 'changePage', - value: function changePage(index) { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-changing-page', tf, index); - - if (index === null) { - index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; - } - if (index >= 0 && index <= this.nbPages - 1) { - if (this.onBeforeChangePage) { - this.onBeforeChangePage.call(null, this, index); - } - this.currentPageNb = parseInt(index, 10) + 1; - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.options[index].selected = true; - } else { - this.pagingSlc.value = this.currentPageNb; - } - - if (tf.rememberPageNb) { - tf.feature('store').savePageNb(tf.pgNbCookie); - } - this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; - - this.groupByPage(); - - if (this.onAfterChangePage) { - this.onAfterChangePage.call(null, this, index); - } - } - - this.emitter.emit('after-changing-page', tf, index); - } - - /** - * Change rows according to page results drop-down - * TODO: accept a parameter setting the results per page length - */ - - }, { - key: 'changeResultsPerPage', - value: function changeResultsPerPage() { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-changing-results-per-page', tf); - - var slcR = this.resultsPerPageSlc; - var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); - this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); - this.startPagingRow = this.pagingLength * slcPagesSelIndex; - - if (!isNaN(this.pagingLength)) { - if (this.startPagingRow >= tf.nbFilterableRows) { - this.startPagingRow = tf.nbFilterableRows - this.pagingLength; - } - this.setPagingInfo(); - - if (this.pageSelectorType === tf.fltTypeSlc) { - var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; - this.pagingSlc.options[slcIndex].selected = true; - } - if (tf.rememberPageLen) { - tf.feature('store').savePageLength(tf.pgLenCookie); - } - } - - this.emitter.emit('after-changing-results-per-page', tf); - } - - /** - * Re-set persisted pagination info - */ - - }, { - key: 'resetValues', - value: function resetValues() { - var tf = this.tf; - if (tf.rememberPageLen) { - this.resetPageLength(tf.pgLenCookie); - } - if (tf.rememberPageNb) { - this.resetPage(tf.pgNbCookie); - } - } - - /** - * Re-set page nb at page re-load - */ - - }, { - key: 'resetPage', - value: function resetPage(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page', tf); - var pgnb = tf.feature('store').getPageNb(name); - if (pgnb !== '') { - this.changePage(pgnb - 1); - } - this.emitter.emit('after-reset-page', tf, pgnb); - } - - /** - * Re-set page length value at page re-load - */ - - }, { - key: 'resetPageLength', - value: function resetPageLength(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page-length', tf); - var pglenIndex = tf.feature('store').getPageLength(name); - - if (pglenIndex !== '') { - this.resultsPerPageSlc.options[pglenIndex].selected = true; - this.changeResultsPerPage(); - } - this.emitter.emit('after-reset-page-length', tf, pglenIndex); - } - - /** - * Remove paging feature - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - var tf = this.tf; - - if (!this.initialized) { - return; - } - // btns containers - var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); - var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); - var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); - var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); - //span containing 'Page' text - var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); - //span containing 'of' text - var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); - //span containing nb of pages - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - var evt = this.evt; - - if (this.pagingSlc) { - if (this.pageSelectorType === tf.fltTypeSlc) { - _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); - } else if (this.pageSelectorType === tf.fltTypeInp) { - _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); - } - _dom2.default.remove(this.pagingSlc); - } - - if (btnNextSpan) { - _event2.default.remove(btnNextSpan, 'click', evt.next); - _dom2.default.remove(btnNextSpan); - } - - if (btnPrevSpan) { - _event2.default.remove(btnPrevSpan, 'click', evt.prev); - _dom2.default.remove(btnPrevSpan); - } - - if (btnLastSpan) { - _event2.default.remove(btnLastSpan, 'click', evt.last); - _dom2.default.remove(btnLastSpan); - } - - if (btnFirstSpan) { - _event2.default.remove(btnFirstSpan, 'click', evt.first); - _dom2.default.remove(btnFirstSpan); - } - - if (pgBeforeSpan) { - _dom2.default.remove(pgBeforeSpan); - } - - if (pgAfterSpan) { - _dom2.default.remove(pgAfterSpan); - } - - if (pgspan) { - _dom2.default.remove(pgspan); - } - - if (this.hasResultsPerPage) { - this.removeResultsPerPage(); - } - - this.emitter.off(['after-filtering'], function () { - return _this4.resetPagingInfo(); - }); - this.emitter.off(['initialized'], function () { - return _this4.resetValues(); - }); - - this.pagingSlc = null; - this.nbPages = 0; - this.disable(); - this.initialized = false; - } - }]); - - return Paging; - })(_feature.Feature); - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.ClearButton = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var ClearButton = exports.ClearButton = (function (_Feature) { - _inherits(ClearButton, _Feature); - - /** - * Clear button component - * @param {Object} tf TableFilter instance - */ - - function ClearButton(tf) { - _classCallCheck(this, ClearButton); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); - - var f = _this.config; - - //id of container element - _this.btnResetTgtId = f.btn_reset_target_id || null; - //reset button element - _this.btnResetEl = null; - //defines reset text - _this.btnResetText = f.btn_reset_text || 'Reset'; - //defines reset button tooltip - _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; - //defines reset button innerHtml - _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); - //span containing reset button - _this.prfxResetSpan = 'resetspan_'; - return _this; - } - - _createClass(ClearButton, [{ - key: 'onClick', - value: function onClick() { - if (!this.isEnabled()) { - return; - } - this.tf.clearFilters(); - } - - /** - * Build DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - - if (this.initialized) { - return; - } - - var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); - - // reset button is added to defined element - if (!this.btnResetTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); - targetEl.appendChild(resetspan); - - if (!this.btnResetHtml) { - var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); - fltreset.className = tf.btnResetCssClass; - fltreset.appendChild(_dom2.default.text(this.btnResetText)); - resetspan.appendChild(fltreset); - _event2.default.add(fltreset, 'click', function () { - _this2.onClick(); - }); - } else { - resetspan.innerHTML = this.btnResetHtml; - var resetEl = resetspan.firstChild; - _event2.default.add(resetEl, 'click', function () { - _this2.onClick(); - }); - } - this.btnResetEl = resetspan.firstChild; - - this.initialized = true; - } - - /** - * Remove clear button UI - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - - if (!this.initialized) { - return; - } - - var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); - if (resetspan) { - _dom2.default.remove(resetspan); - } - this.btnResetEl = null; - this.initialized = false; - } - }]); - - return ClearButton; - })(_feature.Feature); - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Help = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; - var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; - - var Help = exports.Help = (function (_Feature) { - _inherits(Help, _Feature); - - /** - * Help UI component - * @param {Object} tf TableFilter instance - */ - - function Help(tf) { - _classCallCheck(this, Help); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); - - var f = _this.config; - - //id of custom container element for instructions - _this.tgtId = f.help_instructions_target_id || null; - //id of custom container element for instructions - _this.contTgtId = f.help_instructions_container_target_id || null; - //defines help text - _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; - //defines help innerHtml - _this.instrHtml = f.help_instructions_html || null; - //defines reset button text - _this.btnText = f.help_instructions_btn_text || '?'; - //defines reset button innerHtml - _this.btnHtml = f.help_instructions_btn_html || null; - //defines css class for help button - _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; - //defines css class for help container - _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; - //help button element - _this.btn = null; - //help content div - _this.cont = null; - _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; - - //id prefix for help elements - _this.prfxHelpSpan = 'helpSpan_'; - //id prefix for help elements - _this.prfxHelpDiv = 'helpDiv_'; - return _this; - } - - _createClass(Help, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); - var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); - - //help button is added to defined element - if (!this.tgtId) { - tf.setToolbar(); - } - var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); - targetEl.appendChild(helpspan); - - var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); - - if (!this.btnHtml) { - divContainer.appendChild(helpdiv); - var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); - helplink.className = this.btnCssClass; - helplink.appendChild(_dom2.default.text(this.btnText)); - helpspan.appendChild(helplink); - _event2.default.add(helplink, 'click', function () { - _this2.toggle(); - }); - } else { - helpspan.innerHTML = this.btnHtml; - var helpEl = helpspan.firstChild; - _event2.default.add(helpEl, 'click', function () { - _this2.toggle(); - }); - divContainer.appendChild(helpdiv); - } - - if (!this.instrHtml) { - helpdiv.innerHTML = this.instrText; - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } else { - if (this.contTgtId) { - divContainer.appendChild(helpdiv); - } - helpdiv.innerHTML = this.instrHtml; - if (!this.contTgtId) { - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } - } - helpdiv.innerHTML += this.defaultHtml; - _event2.default.add(helpdiv, 'click', function () { - _this2.toggle(); - }); - - this.cont = helpdiv; - this.btn = helpspan; - this.initialized = true; - } - - /** - * Toggle help pop-up - */ - - }, { - key: 'toggle', - value: function toggle() { - // check only if explicitily set to false as in this case undefined - // signifies the help feature is enabled by default - if (this.enabled === false) { - return; - } - var divDisplay = this.cont.style.display; - if (divDisplay === '' || divDisplay === 'none') { - this.cont.style.display = 'inline'; - } else { - this.cont.style.display = 'none'; - } - } - - /** - * Remove help UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - _dom2.default.remove(this.btn); - this.btn = null; - if (!this.cont) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - this.initialized = false; - } - }]); - - return Help; - })(_feature.Feature); - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AlternateRows = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var AlternateRows = exports.AlternateRows = (function (_Feature) { - _inherits(AlternateRows, _Feature); - - /** - * Alternating rows color - * @param {Object} tf TableFilter instance - */ - - function AlternateRows(tf) { - _classCallCheck(this, AlternateRows); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); - - var config = _this.config; - //defines css class for even rows - _this.evenCss = config.even_row_css_class || 'even'; - //defines css class for odd rows - _this.oddCss = config.odd_row_css_class || 'odd'; - return _this; - } - - /** - * Sets alternating rows color - */ - - _createClass(AlternateRows, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - this.processAll(); - - // Subscribe to events - this.emitter.on(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this2.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.on(['column-sorted'], function () { - return _this2.processAll(); - }); - - this.initialized = true; - } - }, { - key: 'processAll', - value: function processAll() { - if (!this.isEnabled()) { - return; - } - var tf = this.tf; - var validRowsIndex = tf.getValidRows(true); - var noValidRowsIndex = validRowsIndex.length === 0; - //1st index - var beginIndex = noValidRowsIndex ? tf.refRow : 0; - // nb indexes - var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; - var idx = 0; - - //alternates bg color - for (var j = beginIndex; j < indexLen; j++) { - var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; - this.setRowBg(rowIdx, idx); - idx++; - } - } - - /** - * Set/remove row background based on row validation - * @param {Number} rowIdx Row index - * @param {Boolean} isValid Valid row flag - */ - - }, { - key: 'processRow', - value: function processRow(rowIdx, arrIdx, isValid) { - if (isValid) { - this.setRowBg(rowIdx, arrIdx); - } else { - this.removeRowBg(rowIdx); - } - } - - /** - * Sets row background color - * @param {Number} rowIdx Row index - * @param {Number} idx Valid rows collection index needed to calculate bg - * color - */ - - }, { - key: 'setRowBg', - value: function setRowBg(rowIdx, idx) { - if (!this.isEnabled() || isNaN(rowIdx)) { - return; - } - var rows = this.tf.tbl.rows; - var i = isNaN(idx) ? rowIdx : idx; - this.removeRowBg(rowIdx); - - _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); - } - - /** - * Removes row background color - * @param {Number} idx Row index - */ - - }, { - key: 'removeRowBg', - value: function removeRowBg(idx) { - if (isNaN(idx)) { - return; - } - var rows = this.tf.tbl.rows; - _dom2.default.removeClass(rows[idx], this.oddCss); - _dom2.default.removeClass(rows[idx], this.evenCss); - } - - /** - * Removes all alternating backgrounds - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { - this.removeRowBg(i); - } - - // Unsubscribe to events - this.emitter.off(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this3.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.off(['column-sorted'], function () { - return _this3.processAll(); - }); - - this.initialized = false; - } - }]); - - return AlternateRows; - })(_feature.Feature); - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.NoResults = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var NoResults = exports.NoResults = (function (_Feature) { - _inherits(NoResults, _Feature); - - /** - * No results message UI component - * @param {Object} tf TableFilter instance - */ - - function NoResults(tf) { - _classCallCheck(this, NoResults); - - //configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); - - var f = _this.config.no_results_message; - - _this.content = f.content || 'No results'; - _this.customContainer = f.custom_container || null; - _this.customContainerId = f.custom_container_id || null; - _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); - _this.cssClass = f.css_class || 'no-results'; - - _this.cont = null; - - //callback before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //callback after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - //callback before message is hidden - _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; - //callback after message is hidden - _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; - - _this.prfxNoResults = 'nores_'; - return _this; - } - - _createClass(NoResults, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - var tf = this.tf; - var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; - - //container - var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); - cont.className = this.cssClass; - cont.innerHTML = this.content; - - if (this.isExternal) { - target.appendChild(cont); - } else { - target.parentNode.insertBefore(cont, target.nextSibling); - } - - this.cont = cont; - - // subscribe to after-filtering event - this.emitter.on(['after-filtering'], function () { - return _this2.toggle(); - }); - - this.initialized = true; - this.hide(); - } - }, { - key: 'toggle', - value: function toggle() { - if (this.tf.nbVisibleRows > 0) { - this.hide(); - } else { - this.show(); - } - } - }, { - key: 'show', - value: function show() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, this); - } - - this.setWidth(); - this.cont.style.display = 'block'; - - if (this.onAfterShowMsg) { - this.onAfterShowMsg.call(null, this.tf, this); - } - } - }, { - key: 'hide', - value: function hide() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - - this.cont.style.display = 'none'; - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - } - }, { - key: 'setWidth', - value: function setWidth() { - if (!this.initialized || this.isExternal || !this.isEnabled()) { - return; - } - if (this.tf.gridLayout) { - var gridLayout = this.tf.feature('gridLayout'); - this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; - } else { - this.cont.style.width = this.tf.tbl.clientWidth + 'px'; - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - // unsubscribe to after-filtering event - this.emitter.off(['after-filtering'], function () { - return _this3.toggle(); - }); - - this.initialized = false; - } - }]); - - return NoResults; - })(_feature.Feature); - -/***/ } -/******/ ]) -}); -; -//# sourceMappingURL=tablefilter.js.map \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.6",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.emitter.emit("filter-blur",this)},onInpFocus:function(t){var e=o["default"].target(t);this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t)),this.emitter.emit("filter-focus",this)}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new O.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._resetGrid();else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new S.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,s=t.length;s>e;e++){var n=t[e];this.ExtRegistry[n.name]||this.loadExtension(n)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),O=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),S),B=x&&_["default"].isValid(t.replace(r,""),S),M=T&&_["default"].isValid(t.replace(f,""),S),A=k&&_["default"].isValid(t.replace(o,""),S),H=P&&_["default"].isValid(t.replace(c,""),S),j=R&&_["default"].isValid(t.replace(g,""),S),V=void 0,U=void 0;if(_["default"].isValid(e,S))V=_["default"].format(e,S),D?(U=_["default"].format(t.replace(h,""),S),s=U>V):B?(U=_["default"].format(t.replace(r,""),S),s=U>=V):A?(U=_["default"].format(t.replace(o,""),S),s=V>=U):M?(U=_["default"].format(t.replace(f,""),S),s=V>U):H?(U=_["default"].format(t.replace(c,""),S),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),S),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,S)?(U=_["default"].format(t,S),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(O){var z=t.replace(b,"");s=e.lastIndexOf(z,e.length-1)===e.length-1-(z.length-1)&&e.lastIndexOf(z,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var G=t.replace(C,""),W=new RegExp(G);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var O=this.searchArgs[this.singleSearchFlt?0:I],S=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==O){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=O.split(this.orOperator),N=L.length>1?!0:!1,D=O.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(O),E,I),t.call(this,O,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive); +""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var a=this.externalFltTgtIds,r=0,o=a.length;o>r;r++){var h=u["default"].id(a[r]);if(h){var f=this.externalFltEls[r];h.appendChild(f);var d=this.getFilterType(r);this.gridLayout&&""===f.innerHTML&&d!==this.fltTypeInp&&((d===this.fltTypeSlc||d===this.fltTypeMulti)&&t.dropdown.build(r),d===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),O=0;O',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||this.isFirstLoad||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml, +b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index de8259b2..1a28305f 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,2218 +1,8 @@ -webpackJsonp([1],{ +/** + * tablefilter v0.1.6 by Max Guglielmi + * build date: 2016-01-12T06:41:18.898Z + * MIT License + */ -/***/ 26: -/***/ function(module, exports, __webpack_require__) { - - var map = { - "./array": 6, - "./array.js": 6, - "./cookie": 4, - "./cookie.js": 4, - "./date": 7, - "./date.js": 7, - "./dom": 2, - "./dom.js": 2, - "./emitter": 9, - "./emitter.js": 9, - "./event": 1, - "./event.js": 1, - "./extensions/advancedGrid/adapterEzEditTable": 27, - "./extensions/advancedGrid/adapterEzEditTable.js": 27, - "./extensions/advancedGrid/advancedGrid": 28, - "./extensions/advancedGrid/advancedGrid.js": 28, - "./extensions/colOps/colOps": 29, - "./extensions/colOps/colOps.js": 29, - "./extensions/colsVisibility/colsVisibility": 30, - "./extensions/colsVisibility/colsVisibility.js": 30, - "./extensions/filtersVisibility/filtersVisibility": 31, - "./extensions/filtersVisibility/filtersVisibility.js": 31, - "./extensions/sort/adapterSortabletable": 32, - "./extensions/sort/adapterSortabletable.js": 32, - "./extensions/sort/sort": 33, - "./extensions/sort/sort.js": 33, - "./helpers": 8, - "./helpers.js": 8, - "./modules/alternateRows": 24, - "./modules/alternateRows.js": 24, - "./modules/checkList": 18, - "./modules/checkList.js": 18, - "./modules/clearButton": 22, - "./modules/clearButton.js": 22, - "./modules/dropdown": 16, - "./modules/dropdown.js": 16, - "./modules/feature": 12, - "./modules/feature.js": 12, - "./modules/gridLayout": 11, - "./modules/gridLayout.js": 11, - "./modules/help": 23, - "./modules/help.js": 23, - "./modules/highlightKeywords": 14, - "./modules/highlightKeywords.js": 14, - "./modules/loader": 13, - "./modules/loader.js": 13, - "./modules/noResults": 25, - "./modules/noResults.js": 25, - "./modules/paging": 21, - "./modules/paging.js": 21, - "./modules/popupFilter": 15, - "./modules/popupFilter.js": 15, - "./modules/rowsCounter": 19, - "./modules/rowsCounter.js": 19, - "./modules/statusBar": 20, - "./modules/statusBar.js": 20, - "./modules/store": 10, - "./modules/store.js": 10, - "./sort": 17, - "./sort.js": 17, - "./string": 3, - "./string.js": 3, - "./types": 5, - "./types.js": 5 - }; - function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); - }; - function webpackContextResolve(req) { - return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); - }; - webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); - }; - webpackContext.resolve = webpackContextResolve; - module.exports = webpackContext; - webpackContext.id = 26; - - -/***/ }, - -/***/ 27: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterEzEditTable = (function () { - /** - * Adapter module for ezEditTable, an external library providing advanced - * grid features (selection and edition): - * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus - * - * @param {Object} tf TableFilter instance - */ - - function AdapterEzEditTable(tf, cfg) { - _classCallCheck(this, AdapterEzEditTable); - - // ezEditTable config - this.initialized = false; - this.desc = cfg.description || 'ezEditTable adapter'; - this.filename = cfg.filename || 'ezEditTable.js'; - this.vendorPath = cfg.vendor_path; - this.loadStylesheet = Boolean(cfg.load_stylesheet); - this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; - this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; - this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; - // Enable the ezEditTable's scroll into view behaviour if grid layout on - cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; - - this._ezEditTable = null; - this.cfg = cfg; - this.tf = tf; - this.emitter = tf.emitter; - } - - /** - * Conditionally load ezEditTable library and set advanced grid - * @return {[type]} [description] - */ - - _createClass(AdapterEzEditTable, [{ - key: 'init', - value: function init() { - var _this = this; - - var tf = this.tf; - if (window.EditTable) { - this._setAdvancedGrid(); - } else { - var path = this.vendorPath + this.filename; - tf.import(this.filename, path, function () { - _this._setAdvancedGrid(); - }); - } - if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { - tf.import(this.stylesheetName, this.stylesheet, null, 'link'); - } - - // TODO: hack to prevent ezEditTable enter key event hijaking. - // Needs to be fixed in the vendor's library - this.emitter.on(['filter-focus', 'filter-blur'], function () { - return _this.toggle(); - }); - } - - /** - * Instantiate ezEditTable component for advanced grid features - */ - - }, { - key: '_setAdvancedGrid', - value: function _setAdvancedGrid() { - var tf = this.tf; - - //start row for EditTable constructor needs to be calculated - var startRow, - cfg = this.cfg, - thead = _dom2.default.tag(tf.tbl, 'thead'); - - //if thead exists and startRow not specified, startRow is calculated - //automatically by EditTable - if (thead.length > 0 && !cfg.startRow) { - startRow = undefined; - } - //otherwise startRow config property if any or TableFilter refRow - else { - startRow = cfg.startRow || tf.refRow; - } - - cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; - var editable = cfg.editable; - var selectable = cfg.selection; - - if (selectable) { - cfg.default_selection = cfg.default_selection || 'row'; - } - //CSS Styles - cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; - - var _lastValidRowIndex = 0; - var _lastRowIndex = 0; - - if (selectable) { - //Row navigation needs to be calculated according to TableFilter's - //validRowsIndex array - var onAfterSelection = function onAfterSelection(et, selectedElm, e) { - var slc = et.Selection; - //Next valid filtered row needs to be selected - var doSelect = function doSelect(nextRowIndex) { - if (et.defaultSelection === 'row') { - slc.SelectRowByIndex(nextRowIndex); - } else { - et.ClearSelections(); - var cellIndex = selectedElm.cellIndex, - row = tf.tbl.rows[nextRowIndex]; - if (et.defaultSelection === 'both') { - slc.SelectRowByIndex(nextRowIndex); - } - if (row) { - slc.SelectCell(row.cells[cellIndex]); - } - } - //Table is filtered - if (tf.validRowsIndex.length !== tf.getRowsNb()) { - var r = tf.tbl.rows[nextRowIndex]; - if (r) { - r.scrollIntoView(false); - } - if (cell) { - if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { - tf.tblCont.scrollLeft = 100000000; - } else if (cell.cellIndex === 0 && tf.gridLayout) { - tf.tblCont.scrollLeft = 0; - } else { - cell.scrollIntoView(false); - } - } - } - }; - - //table is not filtered - if (!tf.validRowsIndex) { - return; - } - var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, - nextRowIndex, - paging = tf.feature('paging'), - - //pgup/pgdown keys - d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { - //last row - if (row.rowIndex >= validIndexes[validIdxLen - 1]) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - var calcRowIndex = _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[_lastValidRowIndex - d]; - nextRowIndex = v ? v : validIndexes[0]; - } - } - _lastRowIndex = row.rowIndex; - doSelect(nextRowIndex); - } else { - //If filtered row is valid, special calculation for - //pgup/pgdown keys - if (keyCode !== 34 && keyCode !== 33) { - _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); - _lastRowIndex = row.rowIndex; - } else { - if (keyCode === 34) { - //pgdown - //last row - if (_lastValidRowIndex + d <= validIdxLen - 1) { - nextRowIndex = validIndexes[_lastValidRowIndex + d]; - } else { - nextRowIndex = [validIdxLen - 1]; - } - } else { - //pgup - //first row - if (_lastValidRowIndex - d <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - nextRowIndex = validIndexes[_lastValidRowIndex - d]; - } - } - _lastRowIndex = nextRowIndex; - _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); - doSelect(nextRowIndex); - } - } - }; - - //Page navigation has to be enforced whenever selected row is out of - //the current page range - var onBeforeSelection = function onBeforeSelection(et, selectedElm) { - var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; - if (tf.paging) { - if (tf.feature('paging').nbPages > 1) { - var paging = tf.feature('paging'); - //page length is re-assigned in case it has changed - et.nbRowsPerPage = paging.pagingLength; - var validIndexes = tf.validRowsIndex, - validIdxLen = validIndexes.length, - pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); - var rowIndex = row.rowIndex; - - if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { - paging.setPage('last'); - } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { - paging.setPage('first'); - } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { - paging.setPage('next'); - } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { - paging.setPage('previous'); - } - } - } - }; - - //Selected row needs to be visible when paging is activated - if (tf.paging) { - tf.feature('paging').onAfterChangePage = function (paging) { - var advGrid = paging.tf.extension('advancedGrid'); - var et = advGrid._ezEditTable; - var slc = et.Selection; - var row = slc.GetActiveRow(); - if (row) { - row.scrollIntoView(false); - } - var cell = slc.GetActiveCell(); - if (cell) { - cell.scrollIntoView(false); - } - }; - } - - //Rows navigation when rows are filtered is performed with the - //EditTable row selection callback events - if (cfg.default_selection === 'row') { - var fnB = cfg.on_before_selected_row; - cfg.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 = cfg.on_after_selected_row; - cfg.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 = cfg.on_before_selected_cell; - cfg.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 = cfg.on_after_selected_cell; - cfg.on_after_selected_cell = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnC) { - fnC.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - } - } - if (editable) { - //Added or removed rows, TF rows number needs to be re-calculated - var fnE = cfg.on_added_dom_row; - cfg.on_added_dom_row = function () { - tf.nbFilterableRows++; - if (!tf.paging) { - tf.emitter.emit('rows-changed', tf, this); - //tf.feature('rowsCounter').refresh(); - } else { - tf.nbRows++; - tf.nbVisibleRows++; - tf.nbFilterableRows++; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnE) { - fnE.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - if (cfg.actions && cfg.actions['delete']) { - var fnF = cfg.actions['delete'].on_after_submit; - cfg.actions['delete'].on_after_submit = function () { - tf.nbFilterableRows--; - if (!tf.paging) { - // tf.feature('rowsCounter').refresh(); - tf.emitter.emit('rows-changed', tf, this); - } else { - tf.nbRows--; - tf.nbVisibleRows--; - tf.nbFilterableRows--; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(false); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnF) { - fnF.call(null, arguments[0], arguments[1]); - } - }; - } - } - - try { - this._ezEditTable = new EditTable(tf.id, cfg, startRow); - this._ezEditTable.Init(); - } catch (e) { - throw new Error(this.err); - } - - this.initialized = true; - } - - /** - * Reset advanced grid when previously removed - */ - - }, { - key: 'reset', - value: function reset() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.Set(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Set(); - } - } - } - - /** - * Toggle behaviour - */ - - }, { - key: 'toggle', - value: function toggle() { - var ezEditTable = this._ezEditTable; - if (ezEditTable.editable) { - ezEditTable.Editable.Remove(); - } else { - ezEditTable.Editable.Set(); - } - if (ezEditTable.selection) { - ezEditTable.Selection.Remove(); - } else { - ezEditTable.Selection.Set(); - } - } - - /** - * Remove advanced grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.ClearSelections(); - ezEditTable.Selection.Remove(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Remove(); - } - } - - this.emitter.off(['filter-focus', 'filter-blur'], function () { - return _this2.toggle(); - }); - this.initialized = false; - } - }]); - - return AdapterEzEditTable; - })(); - - exports.default = AdapterEzEditTable; - -/***/ }, - -/***/ 28: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterEzEditTable = __webpack_require__(27); - - var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _adapterEzEditTable2.default; - -/***/ }, - -/***/ 29: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColOps = (function () { - - /** - * Column calculations - * @param {Object} tf TableFilter instance - */ - - function ColOps(tf, opts) { - _classCallCheck(this, ColOps); - - //calls function before col operation - this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; - //calls function after col operation - this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; - - this.opts = opts; - this.tf = tf; - } - - _createClass(ColOps, [{ - key: 'init', - value: function init() { - var _this = this; - - // subscribe to events - this.tf.emitter.on(['after-filtering'], function () { - return _this.calc(); - }); - - this.calc(); - } - - /** - * Calculates columns' values - * Configuration options are stored in 'opts' property - * - 'id' contains ids of elements showing result (array) - * - 'col' contains the columns' indexes (array) - * - 'operation' contains operation type (array, values: 'sum', 'mean', - * 'min', 'max', 'median', 'q1', 'q3') - * - 'write_method' array defines which method to use for displaying the - * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' - * - 'tot_row_index' defines in which row results are displayed - * (integers array) - * - * - changes made by Nuovella: - * (1) optimized the routine (now it will only process each column once), - * (2) added calculations for the median, lower and upper quartile. - */ - - }, { - key: 'calc', - value: function calc() { - var tf = this.tf; - if (!tf.isFirstLoad && !tf.hasGrid()) { - return; - } - - if (this.onBeforeOperation) { - this.onBeforeOperation.call(null, tf); - } - - var opts = this.opts, - labelId = opts.id, - colIndex = opts.col, - operation = opts.operation, - outputType = opts.write_method, - totRowIndex = opts.tot_row_index, - excludeRow = opts.exclude_row, - decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; - - //nuovella: determine unique list of columns to operate on - var ucolIndex = [], - ucolMax = 0; - ucolIndex[ucolMax] = colIndex[0]; - - for (var ii = 1; ii < colIndex.length; ii++) { - var saved = 0; - //see if colIndex[ii] is already in the list of unique indexes - for (var jj = 0; jj <= ucolMax; jj++) { - if (ucolIndex[jj] === colIndex[ii]) { - saved = 1; - } - } - //if not saved then, save the index; - if (saved === 0) { - ucolMax++; - ucolIndex[ucolMax] = colIndex[ii]; - } - } - - if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { - var rows = tf.tbl.rows, - colvalues = []; - - for (var ucol = 0; ucol <= ucolMax; ucol++) { - //this retrieves col values - //use ucolIndex because we only want to pass through this loop - //once for each column get the values in this unique column - colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); - - //next: calculate all operations for this column - 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; - - for (var k = 0; k < colIndex.length; k++) { - if (colIndex[k] === ucolIndex[ucol]) { - mThisCol++; - opsThisCol[mThisCol] = _string2.default.lower(operation[k]); - decThisCol[mThisCol] = decimalPrecision[k]; - labThisCol[mThisCol] = labelId[k]; - oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; - - switch (opsThisCol[mThisCol]) { - case 'mean': - meanFlag = 1; - break; - case 'sum': - sumFlag = 1; - break; - case 'min': - minFlag = 1; - break; - case 'max': - maxFlag = 1; - break; - case 'median': - medFlag = 1; - break; - case 'q1': - q1Flag = 1; - break; - case 'q3': - q3Flag = 1; - break; - } - } - } - - for (var j = 0; j < colvalues[ucol].length; j++) { - //sort the list for calculation of median and quartiles - if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { - if (j < colvalues[ucol].length - 1) { - for (k = j + 1; k < colvalues[ucol].length; k++) { - if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { - temp = colvalues[ucol][j]; - colvalues[ucol][j] = colvalues[ucol][k]; - colvalues[ucol][k] = temp; - } - } - } - } - var cvalue = parseFloat(colvalues[ucol][j]); - theList[j] = parseFloat(cvalue); - - if (!isNaN(cvalue)) { - nbvalues++; - if (sumFlag === 1 || meanFlag === 1) { - sumValue += parseFloat(cvalue); - } - if (minFlag === 1) { - if (minValue === null) { - minValue = parseFloat(cvalue); - } else { - minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; - } - } - if (maxFlag === 1) { - if (maxValue === null) { - maxValue = parseFloat(cvalue); - } else { - maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; - } - } - } - } //for j - if (meanFlag === 1) { - meanValue = sumValue / nbvalues; - } - if (medFlag === 1) { - var aux = 0; - if (nbvalues % 2 === 1) { - aux = Math.floor(nbvalues / 2); - medValue = theList[aux]; - } else { - medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; - } - } - var posa; - if (q1Flag === 1) { - posa = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa == nbvalues) { - q1Value = (theList[posa - 1] + theList[posa]) / 2; - } else { - q1Value = theList[posa]; - } - } - if (q3Flag === 1) { - posa = 0.0; - var posb = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa === nbvalues) { - posb = 3 * posa; - q3Value = (theList[posb] + theList[posb - 1]) / 2; - } else { - q3Value = theList[nbvalues - posa - 1]; - } - } - - for (var i = 0; i <= mThisCol; i++) { - switch (opsThisCol[i]) { - case 'mean': - result = meanValue; - break; - case 'sum': - result = sumValue; - break; - case 'min': - result = minValue; - break; - case 'max': - result = maxValue; - break; - case 'median': - result = medValue; - break; - case 'q1': - result = q1Value; - break; - case 'q3': - result = q3Value; - break; - } - - var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; - - //if outputType is defined - if (oTypeThisCol && result) { - result = result.toFixed(precision); - - if (_dom2.default.id(labThisCol[i])) { - switch (_string2.default.lower(oTypeThisCol)) { - case 'innerhtml': - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result; - } - break; - case 'setvalue': - _dom2.default.id(labThisCol[i]).value = result; - break; - case 'createtextnode': - var oldnode = _dom2.default.id(labThisCol[i]).firstChild; - var txtnode = _dom2.default.text(result); - _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); - break; - } //switch - } - } else { - try { - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); - } - } catch (e) {} //catch - } //else - } //for i - - // row(s) with result are always visible - var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; - if (totRow) { - totRow.style.display = ''; - } - } //for ucol - } //if typeof - - if (this.onAfterOperation) { - this.onAfterOperation.call(null, tf); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - // unsubscribe to events - this.tf.emitter.off(['after-filtering'], function () { - return _this2.calc(); - }); - } - }]); - - return ColOps; - })(); - - exports.default = ColOps; - -/***/ }, - -/***/ 30: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColsVisibility = (function () { - - /** - * Columns Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function ColsVisibility(tf, f) { - _classCallCheck(this, ColsVisibility); - - // Configuration object - var cfg = tf.config(); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Columns visibility manager'; - - //show/hide cols span element - this.spanEl = null; - //show/hide cols button element - this.btnEl = null; - //show/hide cols container div element - this.contEl = null; - - //tick to hide or show column - this.tickToHide = f.tick_to_hide === false ? false : true; - //enables/disables cols manager generation - this.manager = f.manager === false ? false : true; - //only if external headers - this.headersTbl = f.headers_table || false; - //only if external headers - this.headersIndex = f.headers_index || 1; - //id of container element - this.contElTgtId = f.container_target_id || null; - //alternative headers text - this.headersText = f.headers_text || null; - //id of button container element - this.btnTgtId = f.btn_target_id || null; - //defines show/hide cols text - this.btnText = f.btn_text || 'Columns▼'; - //defines show/hide cols button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for show/hide cols button - this.btnCssClass = f.btn_css_class || 'colVis'; - //defines close link text - this.btnCloseText = f.btn_close_text || 'Close'; - //defines close button innerHtml - this.btnCloseHtml = f.btn_close_html || null; - //defines css class for close button - this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; - this.stylesheet = f.stylesheet || 'colsVisibility.css'; - //span containing show/hide cols button - this.prfx = 'colVis_'; - //defines css class span containing show/hide cols - this.spanCssClass = f.span_css_class || 'colVisSpan'; - this.prfxCont = this.prfx + 'Cont_'; - //defines css class div containing show/hide cols - this.contCssClass = f.cont_css_class || 'colVisCont'; - //defines css class for cols list (ul) - this.listCssClass = cfg.list_css_class || 'cols_checklist'; - //defines css class for list item (li) - this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; - //defines css class for selected list item (li) - this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; - //text preceding columns list - this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); - this.atStart = f.at_start || null; - this.enableHover = Boolean(f.enable_hover); - //enables select all option - this.enableTickAll = Boolean(f.enable_tick_all); - //text preceding columns list - this.tickAllText = f.tick_all_text || 'Select all:'; - - //array containing hidden columns indexes - this.hiddenCols = []; - this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; - - //callback invoked just after cols manager is loaded - this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; - //calls function before cols manager is opened - this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; - //calls function after cols manager is opened - this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; - //calls function before cols manager is closed - this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; - //calls function after cols manager is closed - this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; - - //callback before col is hidden - this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; - //callback after col is hidden - this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; - //callback before col is displayed - this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; - //callback after col is displayed - this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; - - //Grid layout compatibility - if (tf.gridLayout) { - this.headersTbl = tf.feature('gridLayout').headTbl; //headers table - this.headersIndex = 0; //headers index - this.onAfterColDisplayed = function () {}; - this.onAfterColHidden = function () {}; - } - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - _createClass(ColsVisibility, [{ - key: 'toggle', - value: function toggle() { - var contDisplay = this.contEl.style.display; - var onBeforeOpen = this.onBeforeOpen; - var onBeforeClose = this.onBeforeClose; - var onAfterOpen = this.onAfterOpen; - var onAfterClose = this.onAfterClose; - - if (onBeforeOpen && contDisplay !== 'inline') { - onBeforeOpen.call(null, this); - } - if (onBeforeClose && contDisplay === 'inline') { - onBeforeClose.call(null, this); - } - - this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; - - if (onAfterOpen && contDisplay !== 'inline') { - onAfterOpen.call(null, this); - } - if (onAfterClose && contDisplay === 'inline') { - onAfterClose.call(null, this); - } - } - }, { - key: 'checkItem', - value: function checkItem(lbl) { - var li = lbl.parentNode; - if (!li || !lbl) { - return; - } - var isChecked = lbl.firstChild.checked; - var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; - colIndex = parseInt(colIndex, 10); - if (isChecked) { - _dom2.default.addClass(li, this.listSlcItemCssClass); - } else { - _dom2.default.removeClass(li, this.listSlcItemCssClass); - } - - var hide = false; - if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { - hide = true; - } - this.setHidden(colIndex, hide); - } - }, { - key: 'init', - value: function init() { - if (!this.manager) { - return; - } - this.buildBtn(); - this.buildManager(); - - this.initialized = true; - } - - /** - * Build main button UI - */ - - }, { - key: 'buildBtn', - value: function buildBtn() { - var _this = this; - - if (this.btnEl) { - return; - } - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.spanCssClass; - - //Container element (rdiv or custom element) - if (!this.btnTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); - - if (!this.btnTgtId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - if (!this.btnHtml) { - var btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCssClass; - btn.title = this.desc; - - btn.innerHTML = this.btnText; - span.appendChild(btn); - if (!this.enableHover) { - _event2.default.add(btn, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(btn, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } else { - //Custom html - span.innerHTML = this.btnHtml; - var colVisEl = span.firstChild; - if (!this.enableHover) { - _event2.default.add(colVisEl, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(colVisEl, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } - - this.spanEl = span; - this.btnEl = this.spanEl.firstChild; - - if (this.onLoaded) { - this.onLoaded.call(null, this); - } - } - - /** - * Build columns manager UI - */ - - }, { - key: 'buildManager', - value: function buildManager() { - var _this2 = this; - - var tf = this.tf; - - var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); - container.className = this.contCssClass; - - //Extension description - var extNameLabel = _dom2.default.create('p'); - extNameLabel.innerHTML = this.text; - container.appendChild(extNameLabel); - - //Headers list - var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); - ul.className = this.listCssClass; - - var tbl = this.headersTbl ? this.headersTbl : tf.tbl; - var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); - var headerRow = tbl.rows[headerIndex]; - - //Tick all option - if (this.enableTickAll) { - var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); - _dom2.default.addClass(li, this.listItemCssClass); - ul.appendChild(li); - li.check.checked = !this.tickToHide; - - _event2.default.add(li.check, 'click', function () { - for (var h = 0; h < headerRow.cells.length; h++) { - var itm = _dom2.default.id('col_' + h + '_' + tf.id); - if (itm && li.check.checked !== itm.checked) { - itm.click(); - itm.checked = li.check.checked; - } - } - }); - } - - for (var i = 0; i < headerRow.cells.length; i++) { - var cell = headerRow.cells[i]; - var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); - var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); - _dom2.default.addClass(liElm, this.listItemCssClass); - if (!this.tickToHide) { - _dom2.default.addClass(liElm, this.listSlcItemCssClass); - } - ul.appendChild(liElm); - if (!this.tickToHide) { - liElm.check.checked = true; - } - - _event2.default.add(liElm.check, 'click', function (evt) { - var elm = _event2.default.target(evt); - var lbl = elm.parentNode; - _this2.checkItem(lbl); - }); - } - - //separator - var p = _dom2.default.create('p', ['align', 'center']); - var btn; - //Close link - if (!this.btnCloseHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCloseCssClass; - btn.innerHTML = this.btnCloseText; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - p.appendChild(btn); - } else { - p.innerHTML = this.btnCloseHtml; - btn = p.firstChild; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - } - - container.appendChild(ul); - container.appendChild(p); - - this.btnEl.parentNode.insertBefore(container, this.btnEl); - this.contEl = container; - - if (this.atStart) { - var a = this.atStart; - for (var k = 0; k < a.length; k++) { - var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); - if (itm) { - itm.click(); - } - } - } - } - - /** - * Hide or show specified columns - * @param {Numner} colIndex Column index - * @param {Boolean} hide hide column if true or show if false - */ - - }, { - key: 'setHidden', - value: function setHidden(colIndex, hide) { - var tf = this.tf; - var tbl = tf.tbl; - - if (this.onBeforeColHidden && hide) { - this.onBeforeColHidden.call(null, this, colIndex); - } - if (this.onBeforeColDisplayed && !hide) { - this.onBeforeColDisplayed.call(null, this, colIndex); - } - - this._hideCells(tbl, colIndex, hide); - if (this.headersTbl) { - this._hideCells(this.headersTbl, colIndex, hide); - } - - var hiddenCols = this.hiddenCols; - var itemIndex = hiddenCols.indexOf(colIndex); - if (hide) { - if (itemIndex === -1) { - this.hiddenCols.push(colIndex); - } - } else { - if (itemIndex !== -1) { - this.hiddenCols.splice(itemIndex, 1); - } - } - - var gridLayout; - var headTbl; - var gridColElms; - if (this.onAfterColHidden && hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); - - var headTblW = parseInt(headTbl.style.width, 10); - headTbl.style.width = headTblW - hiddenWidth + 'px'; - tbl.style.width = headTbl.style.width; - } - this.onAfterColHidden.call(null, this, colIndex); - } - - if (this.onAfterColDisplayed && !hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var width = parseInt(gridColElms[colIndex].style.width, 10); - headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; - tf.tbl.style.width = headTbl.style.width; - } - this.onAfterColDisplayed.call(null, this, colIndex); - } - } - - /** - * Show specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'showCol', - value: function showCol(colIndex) { - if (colIndex === undefined || !this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, false); - } - } - - /** - * Hide specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'hideCol', - value: function hideCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, true); - } - } - - /** - * Determine if specified column is hidden - * @param {Number} colIndex Column index - */ - - }, { - key: 'isColHidden', - value: function isColHidden(colIndex) { - if (this.hiddenCols.indexOf(colIndex) !== -1) { - return true; - } - return false; - } - - /** - * Toggle visibility of specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggleCol', - value: function toggleCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - this.showCol(colIndex); - } else { - this.hideCol(colIndex); - } - } - - /** - * Returns the indexes of the columns currently hidden - * @return {Array} column indexes - */ - - }, { - key: 'getHiddenCols', - value: function getHiddenCols() { - return this.hiddenCols; - } - - /** - * Remove the columns manager - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - if (_dom2.default.id(this.contElTgtId)) { - _dom2.default.id(this.contElTgtId).innerHTML = ''; - } else { - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - } - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - this.initialized = false; - } - }, { - key: '_getHeaderText', - value: function _getHeaderText(cell) { - if (!cell.hasChildNodes) { - return ''; - } - - for (var i = 0; i < cell.childNodes.length; i++) { - var n = cell.childNodes[i]; - if (n.nodeType === 3) { - return n.nodeValue; - } else if (n.nodeType === 1) { - if (n.id && n.id.indexOf('popUp') !== -1) { - continue; - } else { - return _dom2.default.getText(n); - } - } - continue; - } - return ''; - } - }, { - key: '_hideCells', - value: function _hideCells(tbl, colIndex, hide) { - for (var i = 0; i < tbl.rows.length; i++) { - var row = tbl.rows[i]; - var cell = row.cells[colIndex]; - if (cell) { - cell.style.display = hide ? 'none' : ''; - } - } - } - }]); - - return ColsVisibility; - })(); - - exports.default = ColsVisibility; - -/***/ }, - -/***/ 31: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var FiltersVisibility = (function () { - - /** - * Filters Row Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function FiltersVisibility(tf, f) { - _classCallCheck(this, FiltersVisibility); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Filters row visibility manager'; - - // Path and image filenames - this.stylesheet = f.stylesheet || 'filtersVisibility.css'; - this.icnExpand = f.expand_icon_name || 'icn_exp.png'; - this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; - - //expand/collapse filters span element - this.contEl = null; - //expand/collapse filters btn element - this.btnEl = null; - - this.icnExpandHtml = 'Expand filters'; - this.icnCollapseHtml = 'Collapse filters'; - this.defaultText = 'Toggle filters'; - - //id of container element - this.targetId = f.target_id || null; - //enables/disables expand/collapse icon - this.enableIcon = f.enable_icon === false ? false : true; - this.btnText = f.btn_text || ''; - - //defines expand/collapse filters text - this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; - this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; - - //defines expand/collapse filters button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for expand/collapse filters button - this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; - //defines css class span containing expand/collapse filters - this.contCssClass = f.cont_css_class || 'expClpFlt'; - this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); - - this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; - - // Prefix - this.prfx = 'fltsVis_'; - - //callback before filters row is shown - this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; - //callback after filters row is shown - this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; - //callback before filters row is hidden - this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; - //callback after filters row is hidden - this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - /** - * Initialise extension - */ - - _createClass(FiltersVisibility, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - this.buildUI(); - this.initialized = true; - } - - /** - * Build UI elements - */ - - }, { - key: 'buildUI', - value: function buildUI() { - var _this = this; - - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.contCssClass; - - //Container element (rdiv or custom element) - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); - - if (!this.targetId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - var btn = undefined; - if (!this.btnHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); - btn.className = this.btnCssClass; - btn.title = this.btnText || this.defaultText; - btn.innerHTML = this.collapseBtnHtml; - span.appendChild(btn); - } else { - //Custom html - span.innerHTML = this.btnHtml; - btn = span.firstChild; - } - - _event2.default.add(btn, 'click', function () { - return _this.toggle(); - }); - - this.contEl = span; - this.btnEl = btn; - - if (!this.visibleAtStart) { - this.toggle(); - } - } - - /** - * Toggle filters visibility - */ - - }, { - key: 'toggle', - value: function toggle() { - var tf = this.tf; - var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; - var fltRow = tbl.rows[this.filtersRowIndex]; - var fltRowDisplay = fltRow.style.display; - - if (this.onBeforeShow && fltRowDisplay !== '') { - this.onBeforeShow.call(this, this); - } - if (this.onBeforeHide && fltRowDisplay === '') { - this.onBeforeHide.call(null, this); - } - - fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; - if (this.enableIcon && !this.btnHtml) { - this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; - } - - if (this.onAfterShow && fltRowDisplay !== '') { - this.onAfterShow.call(null, this); - } - if (this.onAfterHide && fltRowDisplay === '') { - this.onAfterHide.call(null, this); - } - } - - /** - * Destroy the UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - this.initialized = false; - } - }]); - - return FiltersVisibility; - })(); - - exports.default = FiltersVisibility; - -/***/ }, - -/***/ 32: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _date = __webpack_require__(7); - - var _date2 = _interopRequireDefault(_date); - - var _helpers = __webpack_require__(8); - - var _helpers2 = _interopRequireDefault(_helpers); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterSortableTable = (function () { - - /** - * SortableTable Adapter module - * @param {Object} tf TableFilter instance - */ - - function AdapterSortableTable(tf, opts) { - _classCallCheck(this, AdapterSortableTable); - - this.initialized = false; - this.name = opts.name; - this.desc = opts.description || 'Sortable table'; - - //indicates if tables was sorted - this.sorted = false; - - this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; - this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; - this.asyncSort = Boolean(opts.async_sort); - this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; - - // edit .sort-arrow.descending / .sort-arrow.ascending in - // tablefilter.css to reflect any path change - this.imgPath = opts.images_path || tf.themesPath; - this.imgBlank = opts.image_blank || 'blank.png'; - this.imgClassName = opts.image_class_name || 'sort-arrow'; - this.imgAscClassName = opts.image_asc_class_name || 'ascending'; - this.imgDescClassName = opts.image_desc_class_name || 'descending'; - //cell attribute storing custom key - this.customKey = opts.custom_key || 'data-tf-sortKey'; - - // callback invoked after sort is loaded and instanciated - this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; - // callback invoked before table is sorted - this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; - // callback invoked after table is sorted - this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(AdapterSortableTable, [{ - key: 'init', - value: function init() { - var tf = this.tf; - var adpt = this; - - // SortableTable class sanity check (sortabletable.js) - if (_types2.default.isUndef(SortableTable)) { - throw new Error('SortableTable class not found.'); - } - - this.overrideSortableTable(); - this.setSortTypes(); - - //Column sort at start - var sortColAtStart = adpt.sortColAtStart; - if (sortColAtStart) { - this.stt.sort(sortColAtStart[0], sortColAtStart[1]); - } - - if (this.onSortLoaded) { - this.onSortLoaded.call(null, tf, this); - } - - /*** SortableTable callbacks ***/ - this.stt.onbeforesort = function () { - if (adpt.onBeforeSort) { - adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); - } - - /*** sort behaviour for paging ***/ - if (tf.paging) { - tf.feature('paging').disable(); - } - }; - - this.stt.onsort = function () { - adpt.sorted = true; - - //sort behaviour for paging - if (tf.paging) { - var paginator = tf.feature('paging'); - // recalculate valid rows index as sorting may have change it - tf.getValidRows(true); - paginator.enable(); - paginator.setPage(paginator.getPage()); - } - - if (adpt.onAfterSort) { - adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); - } - - adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn); - }; - - this.initialized = true; - } - - /** - * Sort specified column - * @param {Number} colIdx Column index - * @param {Boolean} desc Optional: descending manner - */ - - }, { - key: 'sortByColumnIndex', - value: function sortByColumnIndex(colIdx, desc) { - this.stt.sort(colIdx, desc); - } - }, { - key: 'overrideSortableTable', - value: function overrideSortableTable() { - var adpt = this, - tf = this.tf; - - /** - * Overrides headerOnclick method in order to handle th event - * @param {Object} e [description] - */ - SortableTable.prototype.headerOnclick = function (evt) { - if (!adpt.initialized) { - return; - } - - // find Header element - var el = evt.target || evt.srcElement; - - while (el.tagName !== 'TD' && el.tagName !== 'TH') { - el = el.parentNode; - } - - this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); - }; - - /** - * Overrides getCellIndex IE returns wrong cellIndex when columns are - * hidden - * @param {Object} oTd TD element - * @return {Number} Cell index - */ - SortableTable.getCellIndex = function (oTd) { - var cells = oTd.parentNode.cells, - l = cells.length, - i = undefined; - for (i = 0; cells[i] != oTd && i < l; i++) {} - return i; - }; - - /** - * Overrides initHeader in order to handle filters row position - * @param {Array} oSortTypes - */ - SortableTable.prototype.initHeader = function (oSortTypes) { - var stt = this; - if (!stt.tHead) { - if (tf.gridLayout) { - stt.tHead = tf.feature('gridLayout').headTbl.tHead; - } else { - return; - } - } - - stt.headersRow = tf.headersRow; - var cells = stt.tHead.rows[stt.headersRow].cells; - stt.sortTypes = oSortTypes || []; - var l = cells.length; - var img = undefined, - c = undefined; - - for (var i = 0; i < l; i++) { - c = cells[i]; - if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { - c.style.cursor = 'pointer'; - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - c.appendChild(img); - if (stt.sortTypes[i] !== null) { - c.setAttribute('_sortType', stt.sortTypes[i]); - } - _event2.default.add(c, 'click', stt._headerOnclick); - } else { - c.setAttribute('_sortType', oSortTypes[i]); - c._sortType = 'None'; - } - } - stt.updateHeaderArrows(); - }; - - /** - * Overrides updateHeaderArrows in order to handle arrows indicators - */ - SortableTable.prototype.updateHeaderArrows = function () { - var stt = this; - var cells = undefined, - l = undefined, - img = undefined; - - // external headers - if (adpt.asyncSort && adpt.triggerIds.length > 0) { - var triggers = adpt.triggerIds; - cells = []; - l = triggers.length; - for (var j = 0; j < triggers.length; j++) { - cells.push(_dom2.default.id(triggers[j])); - } - } else { - if (!this.tHead) { - return; - } - cells = stt.tHead.rows[stt.headersRow].cells; - l = cells.length; - } - for (var i = 0; i < l; i++) { - var cellAttr = cells[i].getAttribute('_sortType'); - if (cellAttr !== null && cellAttr !== 'None') { - img = cells[i].lastChild || cells[i]; - if (img.nodeName.toLowerCase() !== 'img') { - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - cells[i].appendChild(img); - } - if (i === stt.sortColumn) { - img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); - } else { - img.className = adpt.imgClassName; - } - } - } - }; - - /** - * Overrides getRowValue for custom key value feature - * @param {Object} oRow Row element - * @param {String} sType - * @param {Number} nColumn - * @return {String} - */ - SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { - var stt = this; - // if we have defined a custom getRowValue use that - var sortTypeInfo = stt._sortTypeInfo[sType]; - if (sortTypeInfo && sortTypeInfo.getRowValue) { - return sortTypeInfo.getRowValue(oRow, nColumn); - } - var c = oRow.cells[nColumn]; - var s = SortableTable.getInnerText(c); - return stt.getValueFromString(s, sType); - }; - - /** - * Overrides getInnerText in order to avoid Firefox unexpected sorting - * behaviour with untrimmed text elements - * @param {Object} oNode DOM element - * @return {String} DOM element inner text - */ - SortableTable.getInnerText = function (oNode) { - if (!oNode) { - return; - } - if (oNode.getAttribute(adpt.customKey)) { - return oNode.getAttribute(adpt.customKey); - } else { - return _dom2.default.getText(oNode); - } - }; - } - }, { - key: 'addSortType', - value: function addSortType() { - var args = arguments; - SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); - } - }, { - key: 'setSortTypes', - value: function setSortTypes() { - var _this = this; - - var tf = this.tf, - sortTypes = this.sortTypes, - _sortTypes = []; - - for (var i = 0; i < tf.nbCells; i++) { - var colType = undefined; - - if (sortTypes[i]) { - colType = sortTypes[i].toLowerCase(); - if (colType === 'none') { - colType = 'None'; - } - } else { - // resolve column types - if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { - colType = tf.colNbFormat[i].toLowerCase(); - } else if (tf.hasColDateType && tf.colDateType[i] !== null) { - colType = tf.colDateType[i].toLowerCase() + 'date'; - } else { - colType = 'String'; - } - } - _sortTypes.push(colType); - } - - //Public TF method to add sort type - - //Custom sort types - this.addSortType('number', Number); - this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); - this.addSortType('date', SortableTable.toDate); - this.addSortType('string'); - this.addSortType('us', usNumberConverter); - this.addSortType('eu', euNumberConverter); - this.addSortType('dmydate', dmyDateConverter); - this.addSortType('ymddate', ymdDateConverter); - this.addSortType('mdydate', mdyDateConverter); - this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); - this.addSortType('ipaddress', ipAddress, sortIP); - - this.stt = new SortableTable(tf.tbl, _sortTypes); - - /*** external table headers adapter ***/ - if (this.asyncSort && this.triggerIds.length > 0) { - (function () { - var triggers = _this.triggerIds; - for (var j = 0; j < triggers.length; j++) { - if (triggers[j] === null) { - continue; - } - var trigger = _dom2.default.id(triggers[j]); - if (trigger) { - trigger.style.cursor = 'pointer'; - - _event2.default.add(trigger, 'click', function (evt) { - var elm = evt.target; - if (!_this.tf.sort) { - return; - } - _this.stt.asyncSort(triggers.indexOf(elm.id)); - }); - trigger.setAttribute('_sortType', _sortTypes[j]); - } - } - })(); - } - } - - /** - * Destroy sort - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - this.sorted = false; - this.initialized = false; - this.stt.destroy(); - - var ids = tf.getFiltersId(); - for (var idx = 0; idx < ids.length; idx++) { - var header = tf.getHeaderElement(idx); - var img = _dom2.default.tag(header, 'img'); - - if (img.length === 1) { - header.removeChild(img[0]); - } - } - } - }]); - - return AdapterSortableTable; - })(); - - //Converters - - exports.default = AdapterSortableTable; - function usNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'us'); - } - function euNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'eu'); - } - function dateConverter(s, format) { - return _date2.default.format(s, format); - } - function dmyDateConverter(s) { - return dateConverter(s, 'DMY'); - } - function mdyDateConverter(s) { - return dateConverter(s, 'MDY'); - } - function ymdDateConverter(s) { - return dateConverter(s, 'YMD'); - } - function ddmmmyyyyDateConverter(s) { - return dateConverter(s, 'DDMMMYYYY'); - } - - function ipAddress(value) { - var vals = value.split('.'); - for (var x in vals) { - var val = vals[x]; - while (3 > val.length) { - val = '0' + val; - } - vals[x] = val; - } - return vals.join('.'); - } - - function sortIP(a, b) { - var aa = ipAddress(a.value.toLowerCase()); - var bb = ipAddress(b.value.toLowerCase()); - if (aa == bb) { - return 0; - } else if (aa < bb) { - return -1; - } else { - return 1; - } - } - -/***/ }, - -/***/ 33: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterSortabletable = __webpack_require__(32); - - var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - if (!window.SortableTable) { - __webpack_require__(34); - } // import 'script!sortabletable'; - - exports.default = _adapterSortabletable2.default; - -/***/ }, - -/***/ 34: -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") - -/***/ }, - -/***/ 35: -/***/ function(module, exports) { - - /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra - */ - module.exports = function(src) { - if (typeof execScript === "function") - execScript(src); - else - eval.call(null, src); - } - -/***/ }, - -/***/ 36: -/***/ function(module, exports) { - - module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" - -/***/ } - -}); -//# sourceMappingURL=tf-1.js.map \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"toggle",value:function(){var e=this._ezEditTable;e.editable?e.Editable.Remove():e.Editable.Set(),e.selection?e.Selection.Remove():e.Selection.Set()}},{key:"destroy",value:function(){var e=this,t=this._ezEditTable;t&&(this.cfg.selection&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return e.toggle()}),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/src/modules/checkList.js b/src/modules/checkList.js index 81f65156..01cac0e5 100644 --- a/src/modules/checkList.js +++ b/src/modules/checkList.js @@ -50,9 +50,11 @@ export class CheckList extends Feature{ // TODO: move event here onChange(evt){ let elm = evt.target; - this.tf.activeFilterId = elm.getAttribute('id'); - this.tf.activeFlt = Dom.id(this.tf.activeFilterId); - this.tf.Evt.onSlcChange.call(this.tf, evt); + let tf = this.tf; + tf.activeFilterId = elm.getAttribute('id'); + tf.activeFlt = Dom.id(tf.activeFilterId); + tf.filter(); + // this.tf.Evt.onSlcChange.call(this.tf, evt); } optionClick(evt){ @@ -132,7 +134,7 @@ export class CheckList extends Feature{ let ul = Dom.create( 'ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); ul.className = this.checkListCssClass; - Event.add(ul, 'change', (evt) => this.onChange(evt)); + Event.add(ul, 'change', (evt)=> this.onChange(evt)); let rows = tf.tbl.rows; this.isCustom = tf.isCustomOptions(colIndex); @@ -289,7 +291,7 @@ export class CheckList extends Feature{ li.check.disabled = true; li.disabled = true; } else { - Event.add(li.check, 'click', (evt) => this.optionClick(evt)); + Event.add(li.check, 'click', (evt)=> this.optionClick(evt)); } ul.appendChild(li); @@ -313,9 +315,7 @@ export class CheckList extends Feature{ li0.className = this.checkListItemCssClass; ul.appendChild(li0); - Event.add(li0.check, 'click', (evt) => { - this.optionClick(evt); - }); + Event.add(li0.check, 'click', (evt)=> this.optionClick(evt)); if(!this.enableCheckListResetFilter){ li0.style.display = 'none'; @@ -326,7 +326,7 @@ export class CheckList extends Feature{ tf.fltIds[colIndex]+'_1', tf.emOperator, tf.emptyText); li1.className = this.checkListItemCssClass; ul.appendChild(li1); - Event.add(li1.check, 'click', (evt) => this.optionClick(evt)); + Event.add(li1.check, 'click', (evt)=> this.optionClick(evt)); chkCt++; } @@ -338,7 +338,7 @@ export class CheckList extends Feature{ ); li2.className = this.checkListItemCssClass; ul.appendChild(li2); - Event.add(li2.check, 'click', (evt) => this.optionClick(evt)); + Event.add(li2.check, 'click', (evt)=> this.optionClick(evt)); chkCt++; } return chkCt; diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index 7d3c24b8..752d0191 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -53,6 +53,14 @@ export class Dropdown extends Feature{ this.emitter.emit('filter-focus', tf, this); } + onSlcChange() { + // if(!this.activeFlt){ return; } + // if(this.popupFilters){ Event.stop(e); } + if(this.tf.onSlcChange){ + this.tf.filter(); + } + } + /** * Initialize drop-down filter * @param {Number} colIndex Column index @@ -95,8 +103,9 @@ export class Dropdown extends Feature{ slc.appendChild(opt0); } - Event.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); - Event.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); + //Event.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); + Event.add(slc, 'change', ()=> this.onSlcChange()); + // Event.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); Event.add(slc, 'focus', (e)=> this.onSlcFocus(e)); this.initialized = true; diff --git a/src/tablefilter.js b/src/tablefilter.js index 1fd88caa..655745f0 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -484,29 +484,6 @@ export class TableFilter { Event.stop(e); } this.emitter.emit('filter-focus', this); - }, - // set focused drop-down filter as active - // onSlcFocus(e) { - // let elm = Event.target(e); - // this.activeFilterId = elm.getAttribute('id'); - // this.activeFlt = Dom.id(this.activeFilterId); - // // select is populated when element has focus - // if(this.loadFltOnDemand && elm.getAttribute('filled')==='0'){ - // let ct = elm.getAttribute('ct'); - // console.log('onSlcFocus'); - // this.Mod.dropdown.build(ct); - // } - // if(this.popupFilters){ - // Event.cancel(e); - // Event.stop(e); - // } - // this.emitter.emit('filter-focus', this); - // }, - // filter columns on drop-down filter change - onSlcChange(e) { - if(!this.activeFlt){ return; } - if(this.popupFilters){ Event.stop(e); } - if(this.onSlcChange){ this.filter(); } } }; } diff --git a/test/test-popup-filter.js b/test/test-popup-filter.js index f6031440..366c85c9 100644 --- a/test/test-popup-filter.js +++ b/test/test-popup-filter.js @@ -160,11 +160,11 @@ test('Properties', function() { 'function', 'Feature enable method'); }); -// module('Tear-down'); -// test('TableFilter removed', function() { -// tf.destroy(); -// var fltIcn1 = popupFilter.popUpFltImgs[3]; -// deepEqual(fltIcn1, undefined, 'Filter icon is removed'); -// deepEqual(id(tf.fltIds[3]), null, 'Filter is removed'); -// deepEqual(tf.hasGrid(), false, 'Filters removed'); -// }); +module('Tear-down'); +test('TableFilter removed', function() { + tf.destroy(); + var fltIcn1 = popupFilter.popUpFltImgs[3]; + deepEqual(fltIcn1, undefined, 'Filter icon is removed'); + deepEqual(id(tf.fltIds[3]), null, 'Filter is removed'); + deepEqual(tf.hasGrid(), false, 'Filters removed'); +}); From 671bd18ee63ba23bd35dbe1126973cce86fae1e6 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Wed, 13 Jan 2016 15:22:46 +1100 Subject: [PATCH 26/41] Added unit tests for select filter with disabled onchange event --- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 7759 ++++++++++++++++- dist/tablefilter/tf-1.js | 2224 ++++- src/modules/checkList.js | 1 - src/tablefilter.js | 12 +- test/test-disable-filter-onchange.html | 78 + test/test-disable-filter-onchange.js | 40 + 12 files changed, 10096 insertions(+), 30 deletions(-) create mode 100644 test/test-disable-filter-onchange.html create mode 100644 test/test-disable-filter-onchange.js diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 64004c3f..1d7ecdc6 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-12T06:41:18.983Z + * build date: 2016-01-13T03:56:48.756Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 9e6e51d3..4916eff5 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-12T06:41:18.983Z + * build date: 2016-01-13T03:56:48.756Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 146f56b8..34f71d8e 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-12T06:41:18.983Z + * build date: 2016-01-13T03:56:48.756Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 401dfb92..1ac83aa3 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-12T06:41:18.983Z + * build date: 2016-01-13T03:56:48.756Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index eb9b4cd1..4521b6e3 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-12T06:41:18.983Z + * build date: 2016-01-13T03:56:48.756Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index b52babb7..17fd2f88 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-12T06:41:18.983Z + * build date: 2016-01-13T03:56:48.756Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 0e55ab64..32402f81 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,7751 @@ -/** - * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-12T06:41:18.898Z - * MIT License - */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else { + var a = factory(); + for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; + } +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ var parentJsonpFunction = window["webpackJsonp"]; +/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, callbacks = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) +/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); +/******/ while(callbacks.length) +/******/ callbacks.shift().call(null, __webpack_require__); +/******/ +/******/ }; +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // object to store loaded and loading chunks +/******/ // "0" means "already loaded" +/******/ // Array means "loading", array contains callbacks +/******/ var installedChunks = { +/******/ 0:0 +/******/ }; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // This file contains only the entry chunk. +/******/ // The chunk loading function for additional chunks +/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { +/******/ // "0" is the signal for "already loaded" +/******/ if(installedChunks[chunkId] === 0) +/******/ return callback.call(null, __webpack_require__); +/******/ +/******/ // an array means "currently loading". +/******/ if(installedChunks[chunkId] !== undefined) { +/******/ installedChunks[chunkId].push(callback); +/******/ } else { +/******/ // start chunk loading +/******/ installedChunks[chunkId] = [callback]; +/******/ var head = document.getElementsByTagName('head')[0]; +/******/ var script = document.createElement('script'); +/******/ script.type = 'text/javascript'; +/******/ script.charset = 'utf-8'; +/******/ script.async = true; +/******/ +/******/ script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js"; +/******/ head.appendChild(script); +/******/ } +/******/ }; +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.6",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.emitter.emit("filter-blur",this)},onInpFocus:function(t){var e=o["default"].target(t);this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.popupFilters&&(o["default"].cancel(t),o["default"].stop(t)),this.emitter.emit("filter-focus",this)}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store=new T.Store(this),e.store.init()),this.gridLayout&&(e.gridLayout=new k.GridLayout(this),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new O.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._resetGrid();else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new S.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),(this.paging||e.paging)&&(e.paging||(e.paging=new L.Paging(this),e.paging.init()),e.paging.reset()),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,s=t.length;s>e;e++){var n=t[e];this.ExtRegistry[n.name]||this.loadExtension(n)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),O=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),S),B=x&&_["default"].isValid(t.replace(r,""),S),M=T&&_["default"].isValid(t.replace(f,""),S),A=k&&_["default"].isValid(t.replace(o,""),S),H=P&&_["default"].isValid(t.replace(c,""),S),j=R&&_["default"].isValid(t.replace(g,""),S),V=void 0,U=void 0;if(_["default"].isValid(e,S))V=_["default"].format(e,S),D?(U=_["default"].format(t.replace(h,""),S),s=U>V):B?(U=_["default"].format(t.replace(r,""),S),s=U>=V):A?(U=_["default"].format(t.replace(o,""),S),s=V>=U):M?(U=_["default"].format(t.replace(f,""),S),s=V>U):H?(U=_["default"].format(t.replace(c,""),S),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),S),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,S)?(U=_["default"].format(t,S),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(O){var z=t.replace(b,"");s=e.lastIndexOf(z,e.length-1)===e.length-1-(z.length-1)&&e.lastIndexOf(z,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var G=t.replace(C,""),W=new RegExp(G);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var O=this.searchArgs[this.singleSearchFlt?0:I],S=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==O){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=O.split(this.orOperator),N=L.length>1?!0:!1,D=O.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(O),E,I),t.call(this,O,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive); -""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"_resetGrid",value:function(){if(!this.isFirstLoad){var t=this.Mod,e=this.tbl,i=e.rows,s=this.filtersRowIndex,n=i[s];if(!this.gridLayout){if(e.tHead){var l=e.tHead.insertRow(this.filtersRowIndex);e.tHead.replaceChild(this.fltGridEl,l)}else n.parentNode.insertBefore(this.fltGridEl,n);u["default"].addClass(e,this.prfxTf)}if(this.isExternalFlt)for(var a=this.externalFltTgtIds,r=0,o=a.length;o>r;r++){var h=u["default"].id(a[r]);if(h){var f=this.externalFltEls[r];h.appendChild(f);var d=this.getFilterType(r);this.gridLayout&&""===f.innerHTML&&d!==this.fltTypeInp&&((d===this.fltTypeSlc||d===this.fltTypeMulti)&&t.dropdown.build(r),d===this.fltTypeCheckList&&t.checkList.build(r))}}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=i.length,this.popupFilters&&(this.headersRow++,t.popupFilter.reset()),this._hasGrid=!0}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),O=0;O',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||this.isFirstLoad||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml, -b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!this.isEnabled()&&(this.enable(),this.init(),e.resetValues(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + // Features + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.TableFilter = undefined; + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + var _emitter = __webpack_require__(9); + + var _store = __webpack_require__(10); + + var _gridLayout = __webpack_require__(11); + + var _loader = __webpack_require__(13); + + var _highlightKeywords = __webpack_require__(14); + + var _popupFilter = __webpack_require__(15); + + var _dropdown = __webpack_require__(16); + + var _checkList = __webpack_require__(18); + + var _rowsCounter = __webpack_require__(19); + + var _statusBar = __webpack_require__(20); + + var _paging = __webpack_require__(21); + + var _clearButton = __webpack_require__(22); + + var _help = __webpack_require__(23); + + var _alternateRows = __webpack_require__(24); + + var _noResults = __webpack_require__(25); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var global = window, + doc = global.document; + + var TableFilter = exports.TableFilter = (function () { + + /** + * TableFilter object constructor + * requires `table` or `id` arguments, `row` and `configuration` optional + * @param {DOMElement} table Table DOM element + * @param {String} id Table id + * @param {Number} row index indicating the 1st row + * @param {Object} configuration object + */ + + function TableFilter() { + var _this = this; + + _classCallCheck(this, TableFilter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (args.length === 0) { + return; + } + + this.id = null; + this.version = '0.1.6'; + this.year = new Date().getFullYear(); + this.tbl = null; + this.startRow = null; + this.refRow = null; + this.headersRow = null; + this.cfg = {}; + this.nbFilterableRows = null; + this.nbRows = null; + this.nbCells = null; + this._hasGrid = false; + + // TODO: use for-of with babel plug-in + args.forEach(function (arg) { + // for (let arg of args) { + var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); + if (argtype === 'object' && arg && arg.nodeName === 'TABLE') { + _this.tbl = arg; + _this.id = arg.id || 'tf_' + new Date().getTime() + '_'; + } else if (argtype === 'string') { + _this.id = arg; + _this.tbl = _dom2.default.id(arg); + } else if (argtype === 'number') { + _this.startRow = arg; + } else if (argtype === 'object') { + _this.cfg = arg; + } + // } + }); + + if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) { + throw new Error('Could not instantiate TableFilter: HTML table not found.'); + } + + // configuration object + var f = this.cfg; + + this.emitter = new _emitter.Emitter(); + + //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 || 'tablefilter/'; + + /*** filter types ***/ + this.fltTypeInp = 'input'; + this.fltTypeSlc = 'select'; + this.fltTypeMulti = 'multiple'; + this.fltTypeCheckList = 'checklist'; + this.fltTypeNone = 'none'; + + /*** filters' grid properties ***/ + + //enables/disables filter grid + this.fltGrid = f.grid === false ? false : true; + + //enables/disables grid layout (fixed headers) + this.gridLayout = Boolean(f.grid_layout); + + this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index; + this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index; + + //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 valid rows indexes (rows visible upon filtering) + this.validRowsIndex = []; + //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; + + //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.stylePath = f.style_path || this.basePath + 'style/'; + this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows); + //defines widths of columns + this.hasColWidths = _types2.default.isArray(f.col_widths); + this.colWidths = this.hasColWidths ? f.col_widths : null; + //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'; + + /*** filters' grid behaviours ***/ + //enables/disables enter key + this.enterKey = f.enter_key === false ? false : true; + //calls function before filtering starts + this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null; + //calls function after filtering + this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null; + //enables/disables case sensitivity + this.caseSensitive = Boolean(f.case_sensitive); + //has exact match per column + this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match); + this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : []; + //enables/disbles exact match for search + this.exactMatch = Boolean(f.exact_match); + //refreshes drop-down lists upon validation + this.linkedFilters = Boolean(f.linked_filters); + //wheter excluded options are disabled + this.disableExcludedOptions = Boolean(f.disable_excluded_options); + //stores active filter element + this.activeFlt = null; + //id of active filter + this.activeFilterId = null; + //enables always visible rows + this.hasVisibleRows = Boolean(f.rows_always_visible); + //array containing always visible rows + this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; + //enables/disables external filters generation + this.isExternalFlt = Boolean(f.external_flt_grid); + //array containing ids of external elements containing filters + this.externalFltTgtIds = f.external_flt_grid_ids || []; + //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null; + //enables/disables single filter search + this.singleSearchFlt = Boolean(f.single_filter); + //calls function after row is validated + this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null; + //input watermark text array + this.watermark = f.watermark || ''; + this.isWatermarkArray = _types2.default.isArray(this.watermark); + //id of toolbar container element + this.toolBarTgtId = f.toolbar_target_id || null; + //enables/disables help div + this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions); + //popup filters + this.popupFilters = Boolean(f.popup_filters); + //active columns color + this.markActiveColumns = Boolean(f.mark_active_columns); + //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null; + //calls function after active column header is marked + this.onAfterActiveColumn = _types2.default.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 || 'Clear'; + //enables/disables empty option in combo-box filters + this.enableEmptyOption = Boolean(f.enable_empty_option); + //defines empty option text + this.emptyText = f.empty_text || '(Empty)'; + //enables/disables non empty option in combo-box filters + this.enableNonEmptyOption = Boolean(f.enable_non_empty_option); + //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 = Boolean(f.sort_num_asc); + this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null; + //enables/disables descending numeric options sorting + this.isSortNumDesc = Boolean(f.sort_num_desc); + this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null; + //Select filters are populated on demand + this.loadFltOnDemand = Boolean(f.load_filters_on_demand); + this.hasCustomOptions = _types2.default.isObj(f.custom_options); + this.customOptions = f.custom_options; + + /*** 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 || '^[¥£€$]'; + this.separator = f.separator || ','; + + /*** rows counter ***/ + //show/hides rows counter + this.rowsCounter = Boolean(f.rows_counter); + + /*** status bar ***/ + //show/hides status bar + this.statusBar = Boolean(f.status_bar); + + /*** loader ***/ + //enables/disables loader/spinner indicator + this.loader = Boolean(f.loader); + + /*** validation - reset buttons/links ***/ + //show/hides filter's validation button + this.displayBtn = Boolean(f.btn); + //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 = Boolean(f.btn_reset); + //defines css class for reset button + this.btnResetCssClass = f.btn_reset_css_class || 'reset'; + //callback function before filters are cleared + this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null; + //callback function after filters are cleared + this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null; + + /*** paging ***/ + //enables/disables table paging + this.paging = Boolean(f.paging); + this.nbVisibleRows = 0; //nb visible rows + this.nbHiddenRows = 0; //nb hidden rows + + /*** autofilter on typing ***/ + //enables/disables auto filtering, table is filtered when user stops + //typing + this.autoFilter = Boolean(f.auto_filter); + //onkeyup delay timer (msecs) + this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900; + //typing indicator + this.isUserTyping = null; + this.autoFilterTimer = null; + + /*** keyword highlighting ***/ + //enables/disables keyword highlighting + this.highlightKeywords = Boolean(f.highlight_keywords); + + /*** No results feature ***/ + this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message); + + /*** 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 = _types2.default.isArray(f.col_number_format); + //array containing columns nb formats + this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null; + //enables date type per column + this.hasColDateType = _types2.default.isArray(f.col_date_type); + //array containing columns date type + this.colDateType = this.hasColDateType ? f.col_date_type : null; + + /*** 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_'; + //filter values cookie + this.prfxCookieFltsValues = 'tf_flts_'; + //page nb cookie + this.prfxCookiePageNb = 'tf_pgnb_'; + //page length cookie + this.prfxCookiePageLen = 'tf_pglen_'; + + /*** cookies ***/ + this.hasStoredValues = false; + //remembers filters values on page load + this.rememberGridValues = Boolean(f.remember_grid_values); + //cookie storing filter values + this.fltsValuesCookie = this.prfxCookieFltsValues + this.id; + //remembers page nb on page load + this.rememberPageNb = this.paging && f.remember_page_number; + //cookie storing page nb + this.pgNbCookie = this.prfxCookiePageNb + this.id; + //remembers page length on page load + this.rememberPageLen = this.paging && f.remember_page_length; + //cookie storing page length + this.pgLenCookie = this.prfxCookiePageLen + this.id; + + /*** extensions ***/ + //imports external script + this.extensions = f.extensions; + this.hasExtensions = _types2.default.isArray(this.extensions); + + /*** themes ***/ + this.enableDefaultTheme = Boolean(f.enable_default_theme); + //imports themes + this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes); + this.themes = f.themes || []; + //themes path + this.themesPath = f.themes_path || this.stylePath + 'themes/'; + + // Features registry + this.Mod = {}; + + // Extensions registry + this.ExtRegistry = {}; + + /*** TF events ***/ + this.Evt = { + // Detect key + + detectKey: function detectKey(e) { + if (!this.enterKey) { + return; + } + if (e) { + var key = _event2.default.keyCode(e); + if (key === 13) { + this.filter(); + _event2.default.cancel(e); + _event2.default.stop(e); + } else { + this.isUserTyping = true; + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + } + }, + + // if auto-filter on, detect user is typing and filter columns + onKeyUp: function onKeyUp(e) { + if (!this.autoFilter) { + return; + } + var key = _event2.default.keyCode(e); + this.isUserTyping = false; + + function filter() { + /*jshint validthis:true */ + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + if (!this.isUserTyping) { + this.filter(); + this.isUserTyping = null; + } + } + + if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) { + if (this.autoFilterTimer === null) { + this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay); + } + } else { + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + }, + + // if auto-filter on, detect user is typing + onKeyDown: function onKeyDown() { + if (!this.autoFilter) { + return; + } + this.isUserTyping = true; + }, + + // if auto-filter on, clear interval on filter blur + onInpBlur: function onInpBlur() { + if (this.autoFilter) { + this.isUserTyping = false; + global.clearInterval(this.autoFilterTimer); + } + this.emitter.emit('filter-blur', this); + }, + + // set focused text-box filter as active + onInpFocus: function onInpFocus(e) { + var elm = _event2.default.target(e); + this.activeFilterId = elm.getAttribute('id'); + this.activeFlt = _dom2.default.id(this.activeFilterId); + // if(this.popupFilters){ + // Event.cancel(e); + // Event.stop(e); + // } + this.emitter.emit('filter-focus', this); + } + }; + } + + /** + * Initialise features and layout + */ + + _createClass(TableFilter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this._hasGrid) { + return; + } + + var Mod = this.Mod; + var n = this.singleSearchFlt ? 1 : this.nbCells, + inpclass = undefined; + + //loads stylesheet if not imported + this.import(this.stylesheetId, this.stylesheet, null, 'link'); + + //loads theme + if (this.hasThemes) { + this.loadThemes(); + } + + if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { + Mod.store = new _store.Store(this); + Mod.store.init(); + } + + if (this.gridLayout) { + Mod.gridLayout = new _gridLayout.GridLayout(this); + Mod.gridLayout.init(); + } + + if (this.loader) { + if (!Mod.loader) { + Mod.loader = new _loader.Loader(this); + } + Mod.loader.init(); + } + + if (this.highlightKeywords) { + Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this); + Mod.highlightKeyword.init(); + } + + if (this.popupFilters) { + if (!Mod.popupFilter) { + Mod.popupFilter = new _popupFilter.PopupFilter(this); + } + Mod.popupFilter.init(); + } + + //filters grid is not generated + if (!this.fltGrid) { + this._initNoFilters(); + } else { + if (this.isFirstLoad) { + var fltrow = this._insertFiltersRow(); + + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.tbl.rows.length; + + // Generate filters + for (var i = 0; i < n; i++) { + this.emitter.emit('before-filter-init', this, i); + + var fltcell = _dom2.default.create(this.fltCellTag), + col = this.getFilterType(i); + + if (this.singleSearchFlt) { + fltcell.colSpan = this.nbCells; + } + if (!this.gridLayout) { + fltrow.appendChild(fltcell); + } + inpclass = i == n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass; + + //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 (!Mod.dropdown) { + Mod.dropdown = new _dropdown.Dropdown(this); + } + Mod.dropdown.init(i, this.isExternalFlt, fltcell); + } + // checklist + else if (col === this.fltTypeCheckList) { + if (!Mod.checkList) { + Mod.checkList = new _checkList.CheckList(this); + } + Mod.checkList.init(i, this.isExternalFlt, fltcell); + } else { + this._buildInputFilter(i, inpclass, fltcell); + } + + // this adds submit button + if (i == n - 1 && this.displayBtn) { + this._buildSubmitButton(i, fltcell); + } + + this.emitter.emit('after-filter-init', this, i); + } // for i + } else { + this._resetGrid(); + } //if isFirstLoad + } //if this.fltGrid + + /* Features */ + if (this.hasVisibleRows) { + this.emitter.on(['after-filtering'], function () { + return _this2.enforceVisibility(); + }); + this.enforceVisibility(); + } + if (this.rowsCounter) { + Mod.rowsCounter = new _rowsCounter.RowsCounter(this); + Mod.rowsCounter.init(); + } + if (this.statusBar) { + Mod.statusBar = new _statusBar.StatusBar(this); + Mod.statusBar.init(); + } + if (this.paging || Mod.paging) { + if (!Mod.paging) { + Mod.paging = new _paging.Paging(this); + Mod.paging.init(); + } + Mod.paging.reset(); + } + if (this.btnReset) { + Mod.clearButton = new _clearButton.ClearButton(this); + Mod.clearButton.init(); + } + if (this.help) { + if (!Mod.help) { + Mod.help = new _help.Help(this); + } + Mod.help.init(); + } + if (this.hasColWidths && !this.gridLayout) { + this.setColWidths(); + } + if (this.alternateRows) { + Mod.alternateRows = new _alternateRows.AlternateRows(this); + Mod.alternateRows.init(); + } + if (this.noResults) { + if (!Mod.noResults) { + Mod.noResults = new _noResults.NoResults(this); + } + Mod.noResults.init(); + } + + 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) { + _dom2.default.addClass(this.tbl, this.prfxTf); + } + + /* Loads extensions */ + if (this.hasExtensions) { + this.initExtensions(); + } + + // Subscribe to events + if (this.markActiveColumns) { + this.emitter.on(['before-filtering'], function () { + return _this2.clearActiveColumns(); + }); + this.emitter.on(['cell-processed'], function (tf, colIndex) { + return _this2.markActiveColumn(colIndex); + }); + } + if (this.linkedFilters) { + this.emitter.on(['after-filtering'], function () { + return _this2.linkFilters(); + }); + } + + if (this.onFiltersLoaded) { + this.onFiltersLoaded.call(null, this); + } + + this.emitter.emit('initialized', this); + } + + /** + * Insert filters row at initialization + */ + + }, { + key: '_insertFiltersRow', + value: function _insertFiltersRow() { + if (this.gridLayout) { + return; + } + var fltrow = undefined; + + var thead = _dom2.default.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.headersRow++; + } + + fltrow.className = this.fltsRowCssClass; + + if (this.isExternalFlt) { + fltrow.style.display = 'none'; + } + + this.emitter.emit('filters-row-inserted', this, fltrow); + return fltrow; + } + + /** + * Initialize filtersless table + */ + + }, { + key: '_initNoFilters', + value: function _initNoFilters() { + if (this.fltGrid) { + return; + } + this.refRow = this.refRow > 0 ? this.refRow - 1 : 0; + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.nbFilterableRows + this.refRow; + } + + /** + * Build input filter type + * @param {Number} colIndex Column index + * @param {String} cssClass Css class applied to filter + * @param {DOMElement} container Container DOM element + */ + + }, { + key: '_buildInputFilter', + value: function _buildInputFilter(colIndex, cssClass, container) { + var col = this.getFilterType(colIndex); + var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; + var inptype = col === this.fltTypeInp ? 'text' : 'hidden'; + var inp = _dom2.default.create(this.fltTypeInp, ['id', this.prfxFlt + colIndex + '_' + this.id], ['type', inptype], ['ct', colIndex]); + + if (inptype !== 'hidden' && this.watermark) { + inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark); + } + inp.className = cssClass || this.fltCssClass; + _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this)); + + //filter is appended in custom element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(inp); + this.externalFltEls.push(inp); + } else { + container.appendChild(inp); + } + + this.fltIds.push(inp.id); + + _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this)); + _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this)); + _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this)); + _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this)); + } + + /** + * Build submit button + * @param {Number} colIndex Column index + * @param {DOMElement} container Container DOM element + */ + + }, { + key: '_buildSubmitButton', + value: function _buildSubmitButton(colIndex, container) { + var _this3 = this; + + var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; + var btn = _dom2.default.create(this.fltTypeInp, ['id', this.prfxValButton + colIndex + '_' + this.id], ['type', 'button'], ['value', this.btnText]); + btn.className = this.btnCssClass; + + //filter is appended in custom element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(btn); + } else { + container.appendChild(btn); + } + + _event2.default.add(btn, 'click', function () { + return _this3.filter(); + }); + } + + /** + * Return a feature instance for a given name + * @param {String} name Name of the feature + * @return {Object} + */ + + }, { + key: 'feature', + value: function feature(name) { + return this.Mod[name]; + } + + /** + * Initialise all the extensions defined in the configuration object + */ + + }, { + key: 'initExtensions', + value: function initExtensions() { + var exts = this.extensions; + // Set config's publicPath dynamically for Webpack... + __webpack_require__.p = this.basePath; + + this.emitter.emit('before-loading-extensions', this); + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + if (!this.ExtRegistry[ext.name]) { + this.loadExtension(ext); + } + } + this.emitter.emit('after-loading-extensions', this); + } + + /** + * Load an extension module + * @param {Object} ext Extension config object + */ + + }, { + key: 'loadExtension', + value: function loadExtension(ext) { + var _this4 = this; + + if (!ext || !ext.name) { + return; + } + + var name = ext.name; + var path = ext.path; + var modulePath = undefined; + + if (name && path) { + modulePath = ext.path + name; + } else { + name = name.replace('.js', ''); + modulePath = 'extensions/{}/{}'.replace(/{}/g, name); + } + + // Require pattern for Webpack + __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) { + var inst = new mod.default(_this4, ext); + inst.init(); + _this4.ExtRegistry[name] = inst; + }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}); + } + + /** + * Get an extension instance + * @param {String} name Name of the extension + * @return {Object} Extension instance + */ + + }, { + key: 'extension', + value: function extension(name) { + return this.ExtRegistry[name]; + } + + /** + * Check passed extension name exists + * @param {String} name Name of the extension + * @return {Boolean} + */ + + }, { + key: 'hasExtension', + value: function hasExtension(name) { + return !_types2.default.isEmpty(this.ExtRegistry[name]); + } + + /** + * Destroy all the extensions defined in the configuration object + */ + + }, { + key: 'destroyExtensions', + value: function destroyExtensions() { + var exts = this.extensions; + + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + var extInstance = this.ExtRegistry[ext.name]; + if (extInstance) { + extInstance.destroy(); + this.ExtRegistry[ext.name] = null; + } + } + } + + /** + * Load themes defined in the configuration object + */ + + }, { + key: 'loadThemes', + value: function loadThemes() { + var themes = this.themes; + this.emitter.emit('before-loading-themes', this); + + //Default theme config + if (this.enableDefaultTheme) { + var defaultTheme = { name: 'default' }; + this.themes.push(defaultTheme); + } + if (_types2.default.isArray(themes)) { + for (var i = 0, len = themes.length; i < len; i++) { + var theme = themes[i]; + var name = theme.name; + var path = theme.path; + var styleId = this.prfxTf + name; + if (name && !path) { + path = this.themesPath + name + '/' + name + '.css'; + } else if (!name && theme.path) { + name = 'theme{0}'.replace('{0}', i); + } + + if (!this.isImported(path, 'link')) { + this.import(styleId, path, null, 'link'); + } + } + } + + //Some elements need to be overriden for default 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; + + this.emitter.emit('after-loading-themes', this); + } + + /** + * Return stylesheet DOM element for a given theme name + * @return {DOMElement} stylesheet element + */ + + }, { + key: 'getStylesheet', + value: function getStylesheet() { + var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; + + return _dom2.default.id(this.prfxTf + name); + } + + /** + * Destroy filter grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this5 = this; + + if (!this._hasGrid) { + return; + } + var rows = this.tbl.rows, + Mod = this.Mod; + + if (this.isExternalFlt && !this.popupFilters) { + this.removeExternalFlts(); + } + if (this.infDiv) { + this.removeToolbar(); + } + if (this.highlightKeywords) { + Mod.highlightKeyword.unhighlightAll(); + } + if (this.markActiveColumns) { + this.clearActiveColumns(); + this.emitter.off(['before-filtering'], function () { + return _this5.clearActiveColumns(); + }); + this.emitter.off(['cell-processed'], function (tf, colIndex) { + return _this5.markActiveColumn(colIndex); + }); + } + if (this.hasExtensions) { + this.destroyExtensions(); + } + + for (var j = this.refRow; j < this.nbRows; j++) { + // validate row + this.validateRow(j, true); + + //removes alternating colors + if (this.alternateRows) { + Mod.alternateRows.removeRowBg(j); + } + } //for j + + if (this.fltGrid && !this.gridLayout) { + this.fltGridEl = rows[this.filtersRowIndex]; + this.tbl.deleteRow(this.filtersRowIndex); + } + + // Destroy modules + Object.keys(Mod).forEach(function (key) { + var feature = Mod[key]; + if (feature && _types2.default.isFn(feature.destroy)) { + feature.destroy(); + } + }); + + // unsubscribe to events + if (this.hasVisibleRows) { + this.emitter.off(['after-filtering'], function () { + return _this5.enforceVisibility(); + }); + } + if (this.linkedFilters) { + this.emitter.off(['after-filtering'], function () { + return _this5.linkFilters(); + }); + } + + _dom2.default.removeClass(this.tbl, this.prfxTf); + this.nbHiddenRows = 0; + this.validRowsIndex = []; + this.activeFlt = null; + this._hasGrid = false; + } + + /** + * Generate container element for paging, reset button, rows counter etc. + */ + + }, { + key: 'setToolbar', + value: function setToolbar() { + if (this.infDiv) { + return; + } + + /*** container div ***/ + var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); + infdiv.className = this.infDivCssClass; + + //custom container + if (this.toolBarTgtId) { + _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); + } + //grid-layout + else if (this.gridLayout) { + var gridLayout = this.Mod.gridLayout; + gridLayout.tblMainCont.appendChild(infdiv); + infdiv.className = gridLayout.gridInfDivCssClass; + } + //default location: just above the table + else { + var cont = _dom2.default.create('caption'); + cont.appendChild(infdiv); + this.tbl.insertBefore(cont, this.tbl.firstChild); + } + this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); + + /*** left div containing rows # displayer ***/ + var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); + ldiv.className = this.lDivCssClass; + infdiv.appendChild(ldiv); + this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); + + /*** right div containing reset button + + nb results per page select ***/ + var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); + rdiv.className = this.rDivCssClass; + infdiv.appendChild(rdiv); + this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); + + /*** mid div containing paging elements ***/ + var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); + mdiv.className = this.mDivCssClass; + infdiv.appendChild(mdiv); + this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); + + // Enable help instructions by default if topbar is generated and not + // explicitely set to false + if (_types2.default.isUndef(this.help)) { + if (!this.Mod.help) { + this.Mod.help = new _help.Help(this); + } + this.Mod.help.init(); + this.help = true; + } + } + + /** + * Remove toolbar container element + */ + + }, { + key: 'removeToolbar', + value: function removeToolbar() { + if (!this.infDiv) { + return; + } + _dom2.default.remove(this.infDiv); + this.infDiv = null; + + var tbl = this.tbl; + var captions = _dom2.default.tag(tbl, 'caption'); + if (captions.length > 0) { + [].forEach.call(captions, function (elm) { + tbl.removeChild(elm); + }); + } + } + + /** + * Remove all the external column filters + */ + + }, { + key: 'removeExternalFlts', + value: function removeExternalFlts() { + if (!this.isExternalFlt) { + return; + } + var ids = this.externalFltTgtIds, + len = ids.length; + for (var ct = 0; ct < len; ct++) { + var externalFltTgtId = ids[ct], + externalFlt = _dom2.default.id(externalFltTgtId); + if (externalFlt) { + externalFlt.innerHTML = ''; + } + } + } + + /** + * Check if given column implements a filter with custom options + * @param {Number} colIndex Column's index + * @return {Boolean} + */ + + }, { + key: 'isCustomOptions', + value: function isCustomOptions(colIndex) { + return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; + } + + /** + * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the + * custom options values and texts + * @param {Number} colIndex Column's index + * @return {Array} + */ + + }, { + key: 'getCustomOptions', + value: function getCustomOptions(colIndex) { + if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { + return; + } + + var customOptions = this.customOptions; + var cols = customOptions.cols; + var optTxt = [], + optArray = []; + var index = cols.indexOf(colIndex); + var slcValues = customOptions.values[index]; + var slcTexts = customOptions.texts[index]; + var slcSort = customOptions.sorts[index]; + + for (var r = 0, len = slcValues.length; r < len; r++) { + optArray.push(slcValues[r]); + if (slcTexts[r]) { + optTxt.push(slcTexts[r]); + } else { + optTxt.push(slcValues[r]); + } + } + if (slcSort) { + optArray.sort(); + optTxt.sort(); + } + return [optArray, optTxt]; + } + + /** + * Reset persisted filter values + */ + + }, { + key: 'resetValues', + value: function resetValues() { + var _this6 = this; + + //only loadFltOnDemand + if (this.rememberGridValues) { + if (this.loadFltOnDemand) { + this._resetGridValues(this.fltsValuesCookie); + } else { + var fltValues = this.Mod.store.getFilterValues(this.fltsValuesCookie); + fltValues.forEach(function (val, idx) { + if (val !== ' ') { + _this6.setFilterValue(idx, val); + } + }); + } + } + this.filter(); + } + + /** + * Reset persisted filter values when load filters on demand feature is + * enabled + * @param {String} name cookie name storing filter values + */ + + }, { + key: '_resetGridValues', + value: function _resetGridValues(name) { + if (!this.loadFltOnDemand) { + return; + } + var fltsValues = this.Mod.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 = undefined, + opt = undefined; + var fltType = this.getFilterType(i); + // if loadFltOnDemand, drop-down needs to contain stored + // value(s) for filtering + if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { + var slc = _dom2.default.id(this.fltIds[i]); + slc.options[0].selected = false; + + //selects + if (slcFltsIndex.indexOf(i) != -1) { + opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + //multiple select + if (multiFltsIndex.indexOf(i) != -1) { + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + opt = _dom2.default.createOpt(s[j], s[j], true); + slc.appendChild(opt); + this.hasStoredValues = true; + } + } // if multiFltsIndex + } else if (fltType === this.fltTypeCheckList) { + var checkList = this.Mod.checkList; + var divChk = checkList.checkListDiv[i]; + divChk.title = divChk.innerHTML; + divChk.innerHTML = ''; + + var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); + ul.className = checkList.checkListCssClass; + + var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); + li0.className = checkList.checkListItemCssClass; + ul.appendChild(li0); + + divChk.appendChild(ul); + + s = fltsValues[i].split(' ' + this.orOperator + ' '); + for (var j = 0, len = s.length; j < len; j++) { + if (s[j] === '') { + continue; + } + var li = _dom2.default.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; + } + } else if (fltType === this.fltTypeInp) { + this.setFilterValue(i, fltsValues[i]); + } + } //end for + + if (!this.hasStoredValues && this.paging) { + this.Mod.paging.setPagingInfo(); + } + } //end if + } + + /** + * Filter the table by retrieving the data from each cell in every single + * row and comparing it to the search term for current column. A row is + * hidden when all the search terms are not found in inspected row. + * + * TODO: Reduce complexity of this massive method + */ + + }, { + key: 'filter', + value: function filter() { + if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { + return; + } + //invoke onbefore callback + if (this.onBeforeFilter) { + this.onBeforeFilter.call(null, this); + } + this.emitter.emit('before-filtering', this); + + var row = this.tbl.rows, + Mod = this.Mod, + hiddenrows = 0; + + this.validRowsIndex = []; + // search args re-init + this.searchArgs = this.getFiltersValue(); + + var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); + + //keyword highlighting + function highlight(str, ok, cell) { + /*jshint validthis:true */ + if (this.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 = _dom2.default.getText(cell); + } + if (w !== '') { + Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); + } + } + } + + //looks for search argument in current row + function hasArg(sA, cellData, j) { + /*jshint validthis:true */ + var occurence = undefined, + removeNbFormat = _helpers2.default.removeNbFormat; + + //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); + var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); + var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); + var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); + var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); + var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); + + var dte1 = undefined, + dte2 = undefined; + //dates + if (_date2.default.isValid(cellData, dtType)) { + dte1 = _date2.default.format(cellData, dtType); + // lower date + if (isLDate) { + dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); + occurence = dte1 < dte2; + } + // lower equal date + else if (isLEDate) { + dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); + occurence = dte1 <= dte2; + } + // greater equal date + else if (isGEDate) { + dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); + occurence = dte1 >= dte2; + } + // greater date + else if (isGDate) { + dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); + occurence = dte1 > dte2; + } + // different date + else if (isDFDate) { + dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); + occurence = dte1.toString() != dte2.toString(); + } + // equal date + else if (isEQDate) { + dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } else if (_date2.default.isValid(sA, dtType)) { + dte2 = _date2.default.format(sA, dtType); + occurence = dte1.toString() === dte2.toString(); + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } else { + //first numbers need to be formated + if (this.hasColNbFormat && this.colNbFormat[j]) { + numCellData = removeNbFormat(cellData, this.colNbFormat[j]); + nbFormat = this.colNbFormat[j]; + } else { + if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { + numCellData = removeNbFormat(cellData, 'us'); + nbFormat = 'us'; + } else { + numCellData = removeNbFormat(cellData, 'eu'); + nbFormat = 'eu'; + } + } + + // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, + // rgx:) + // lower equal + if (hasLE) { + occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); + } + //greater equal + else if (hasGE) { + occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); + } + //lower + else if (hasLO) { + occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); + } + //greater + else if (hasGR) { + occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); + } + //different + else if (hasDF) { + occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; + } + //like + else if (hasLK) { + occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); + } + //equal + else if (hasEQ) { + occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); + } + //starts with + else if (hasST) { + occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; + } + //ends with + else if (hasEN) { + var searchArg = sA.replace(re_en, ''); + occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; + } + //empty + else if (hasEM) { + occurence = _string2.default.isEmpty(cellData); + } + //non-empty + else if (hasNM) { + occurence = !_string2.default.isEmpty(cellData); + } + //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(cellData); + } catch (e) { + occurence = false; + } + } else { + occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); + } + } //else + return occurence; + } //fn + + for (var k = this.refRow; k < this.nbRows; k++) { + /*** if table already filtered some rows are not visible ***/ + if (this.getRowDisplay(row[k]) === '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 = true, + + //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]; + var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; + if (sA === '') { + continue; + } + + var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); + + //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 = undefined, + occur = false, + s = hasMultiOrSA ? sAOrSplit : sAAndSplit; + for (var w = 0, len = s.length; w < len; w++) { + cS = _string2.default.trim(s[w]); + occur = hasArg.call(this, cS, cellData, j); + highlight.call(this, cS, occur, cell[j]); + if (hasMultiOrSA && occur) { + break; + } + if (hasMultiAndSA && !occur) { + break; + } + } + occurence[j] = occur; + } + //single search parameter + else { + occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); + highlight.call(this, sA, occurence[j], cell[j]); + } //else single param + + if (!occurence[j]) { + isRowValid = false; + } + if (this.singleSearchFlt && occurence[j]) { + singleFltRowValid = true; + } + + this.emitter.emit('cell-processed', this, j, cell[j]); + } //for j + + if (this.singleSearchFlt && singleFltRowValid) { + isRowValid = true; + } + + if (!isRowValid) { + this.validateRow(k, false); + hiddenrows++; + } else { + this.validateRow(k, true); + } + + this.emitter.emit('row-processed', this, k, this.validRowsIndex.length, isRowValid); + } // for k + + this.nbVisibleRows = this.validRowsIndex.length; + this.nbHiddenRows = hiddenrows; + + //invokes onafterfilter callback + if (this.onAfterFilter) { + this.onAfterFilter.call(null, this); + } + + this.emitter.emit('after-filtering', this); + } + + /** + * Return the data of a specified colum + * @param {Number} colIndex Column index + * @param {Boolean} includeHeaders Optional: include headers row + * @param {Boolean} num Optional: return unformatted number + * @param {Array} exclude Optional: list of row indexes to be excluded + * @return {Array} Flat list of data for a column + */ + + }, { + key: 'getColValues', + value: function getColValues(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; + + if (!this.fltGrid) { + return; + } + var row = this.tbl.rows, + colValues = []; + + if (includeHeaders) { + colValues.push(this.getHeadersText()[colIndex]); + } + + for (var i = this.refRow; i < this.nbRows; i++) { + var isExludedRow = false; + // checks if current row index appears in exclude array + if (exclude.length > 0) { + isExludedRow = exclude.indexOf(i) != -1; + } + 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 !== '') { + continue; + } + var cellData = this.getCellData(cell[j]), + nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, + data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; + colValues.push(data); + } + } + } + return colValues; + } + + /** + * Return the filter's value of a specified column + * @param {Number} index Column index + * @return {String} Filter value + */ + + }, { + key: 'getFilterValue', + value: function getFilterValue(index) { + if (!this.fltGrid) { + return; + } + var fltValue = undefined, + flt = this.getFilterElement(index); + if (!flt) { + return ''; + } + + var fltColType = this.getFilterType(index); + if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { + fltValue = flt.value; + } + //mutiple select + else if (fltColType === this.fltTypeMulti) { + fltValue = ''; + for (var j = 0, len = flt.options.length; j < len; 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; + } + + /** + * Return the filters' values + * @return {Array} List of filters' values + */ + + }, { + key: 'getFiltersValue', + value: function getFiltersValue() { + if (!this.fltGrid) { + return; + } + var searchArgs = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); + } + return searchArgs; + } + + /** + * Return the ID of the filter of a specified column + * @param {Number} index Column's index + * @return {String} ID of the filter element + */ + + }, { + key: 'getFilterId', + value: function getFilterId(index) { + if (!this.fltGrid) { + return; + } + return this.fltIds[index]; + } + + /** + * Return the list of ids of filters matching a specified type. + * Note: hidden filters are also returned + * + * @param {String} type Filter type string ('input', 'select', 'multiple', + * 'checklist') + * @param {Boolean} bool If true returns columns indexes instead of IDs + * @return {[type]} List of element IDs or column indexes + */ + + }, { + key: 'getFiltersByType', + value: function getFiltersByType(type, bool) { + if (!this.fltGrid) { + return; + } + var arr = []; + for (var i = 0, len = this.fltIds.length; i < len; i++) { + var fltType = this.getFilterType(i); + if (fltType === _string2.default.lower(type)) { + var a = bool ? i : this.fltIds[i]; + arr.push(a); + } + } + return arr; + } + + /** + * Return the filter's DOM element for a given column + * @param {Number} index Column's index + * @return {DOMElement} + */ + + }, { + key: 'getFilterElement', + value: function getFilterElement(index) { + var fltId = this.fltIds[index]; + return _dom2.default.id(fltId); + } + + /** + * Return the number of cells for a given row index + * @param {Number} rowIndex Index of the row + * @return {Number} Number of cells + */ + + }, { + key: 'getCellsNb', + value: function getCellsNb() { + var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; + + var tr = this.tbl.rows[rowIndex]; + return tr.cells.length; + } + + /** + * Return the number of filterable rows starting from reference row if + * defined + * @param {Boolean} includeHeaders Include the headers row + * @return {Number} Number of filterable rows + */ + + }, { + key: 'getRowsNb', + value: function getRowsNb(includeHeaders) { + var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, + ntrs = this.tbl.rows.length; + if (includeHeaders) { + s = 0; + } + return parseInt(ntrs - s, 10); + } + + /** + * Return the data of a given cell + * @param {DOMElement} cell Cell's DOM object + * @return {String} + */ + + }, { + key: 'getCellData', + value: function getCellData(cell) { + var idx = cell.cellIndex; + //Check for customCellData callback + if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { + return this.customCellData.call(null, this, cell, idx); + } else { + return _dom2.default.getText(cell); + } + } + + /** + * Return the table data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getTableData', + value: function getTableData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + + var rows = this.tbl.rows; + var tblData = []; + if (includeHeaders) { + var headers = this.getHeadersText(excludeHiddenCols); + tblData.push([this.getHeadersRowIndex(), headers]); + } + for (var k = this.refRow; k < this.nbRows; k++) { + var rowData = [k, []]; + var cells = rows[k].cells; + for (var j = 0, len = cells.length; j < len; j++) { + if (excludeHiddenCols && this.hasExtension('colsVisibility')) { + if (this.extension('colsVisibility').isColHidden(j)) { + continue; + } + } + var cellData = this.getCellData(cells[j]); + rowData[1].push(cellData); + } + tblData.push(rowData); + } + return tblData; + } + + /** + * Return the filtered data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @param {Boolean} includeHeaders Optional: include headers row + * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns + * @return {Array} + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredData', + value: function getFilteredData() { + var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + + if (!this.validRowsIndex) { + return []; + } + var rows = this.tbl.rows, + filteredData = []; + if (includeHeaders) { + var headers = this.getHeadersText(excludeHiddenCols); + filteredData.push([this.getHeadersRowIndex(), headers]); + } + + var validRows = this.getValidRows(true); + for (var i = 0; i < validRows.length; i++) { + var rData = [this.validRowsIndex[i], []], + cells = rows[this.validRowsIndex[i]].cells; + for (var k = 0; k < cells.length; k++) { + if (excludeHiddenCols && this.hasExtension('colsVisibility')) { + if (this.extension('colsVisibility').isColHidden(k)) { + continue; + } + } + var cellData = this.getCellData(cells[k]); + rData[1].push(cellData); + } + filteredData.push(rData); + } + return filteredData; + } + + /** + * Return the filtered data for a given column index + * @param {Number} colIndex Colmun's index + * @param {Boolean} includeHeaders Optional: include headers row + * @return {Array} Flat list of values ['val0','val1','val2'...] + * + * TODO: provide an API returning data in JSON format + */ + + }, { + key: 'getFilteredDataCol', + value: function getFilteredDataCol(colIndex) { + var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + + if (_types2.default.isUndef(colIndex)) { + return []; + } + var data = this.getFilteredData(), + colData = []; + if (includeHeaders) { + colData.push(this.getHeadersText()[colIndex]); + } + for (var i = 0, len = data.length; i < len; 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; + } + + /** + * Get the display value of a row + * @param {RowElement} DOM element of the row + * @return {String} Usually 'none' or '' + */ + + }, { + key: 'getRowDisplay', + value: function getRowDisplay(row) { + if (!_types2.default.isObj(row)) { + return null; + } + return row.style.display; + } + + /** + * Validate/invalidate row by setting the 'validRow' attribute on the row + * @param {Number} rowIndex Index of the row + * @param {Boolean} isValid + */ + + }, { + key: 'validateRow', + value: function validateRow(rowIndex, isValid) { + var row = this.tbl.rows[rowIndex]; + if (!row || typeof isValid !== 'boolean') { + return; + } + + // always visible rows are valid + if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { + isValid = true; + } + + var displayFlag = isValid ? '' : 'none', + validFlag = isValid ? 'true' : 'false'; + row.style.display = displayFlag; + + if (this.paging) { + row.setAttribute('validRow', validFlag); + } + + if (isValid) { + if (this.validRowsIndex.indexOf(rowIndex) === -1) { + this.validRowsIndex.push(rowIndex); + } + + if (this.onRowValidated) { + this.onRowValidated.call(null, this, rowIndex); + } + + this.emitter.emit('row-validated', this, rowIndex); + } + } + + /** + * Validate all filterable rows + */ + + }, { + key: 'validateAllRows', + value: function validateAllRows() { + if (!this._hasGrid) { + return; + } + this.validRowsIndex = []; + for (var k = this.refRow; k < this.nbFilterableRows; k++) { + this.validateRow(k, true); + } + } + + /** + * Set search value to a given filter + * @param {Number} index Column's index + * @param {String} searcharg Search term + */ + + }, { + key: 'setFilterValue', + value: function setFilterValue(index) { + var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; + + if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { + return; + } + var slc = this.getFilterElement(index), + fltColType = this.getFilterType(index); + + if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { + slc.value = searcharg; + } + //multiple selects + else if (fltColType === this.fltTypeMulti) { + var s = searcharg.split(' ' + this.orOperator + ' '); + // let ct = 0; //keywords counter + for (var j = 0, len = slc.options.length; j < len; j++) { + var option = slc.options[j]; + if (s === '' || s[0] === '') { + option.selected = false; + } + if (option.value === '') { + option.selected = false; + } + if (option.value !== '' && _array2.default.has(s, option.value, true)) { + option.selected = true; + } //if + } //for j + } + //checklist + else if (fltColType === this.fltTypeCheckList) { + searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); + var sarg = searcharg.split(' ' + this.orOperator + ' '); + var lisNb = _dom2.default.tag(slc, 'li').length; + + slc.setAttribute('value', ''); + slc.setAttribute('indexes', ''); + + for (var k = 0; k < lisNb; k++) { + var li = _dom2.default.tag(slc, 'li')[k], + lbl = _dom2.default.tag(li, 'label')[0], + chk = _dom2.default.tag(li, 'input')[0], + lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); + if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { + chk.checked = true; + this.Mod.checkList.setCheckListValues(chk); + } else { + chk.checked = false; + this.Mod.checkList.setCheckListValues(chk); + } + } + } + } + + /** + * Set them columns' widths as per configuration + * @param {Number} rowIndex Optional row index to apply the widths to + * @param {Element} tbl DOM element + */ + + }, { + key: 'setColWidths', + value: function setColWidths(rowIndex, tbl) { + if (!this.fltGrid || !this.hasColWidths) { + return; + } + tbl = tbl || this.tbl; + var rIndex = undefined; + if (rowIndex === undefined) { + rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; + } else { + rIndex = rowIndex; + } + + setWidths.call(this); + + function setWidths() { + /*jshint validthis:true */ + var nbCols = this.nbCells; + var colWidths = this.colWidths; + var colTags = _dom2.default.tag(tbl, 'col'); + var tblHasColTag = colTags.length > 0; + var frag = !tblHasColTag ? doc.createDocumentFragment() : null; + for (var k = 0; k < nbCols; k++) { + var col = undefined; + if (tblHasColTag) { + col = colTags[k]; + } else { + col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); + frag.appendChild(col); + } + col.style.width = colWidths[k]; + } + if (!tblHasColTag) { + tbl.insertBefore(frag, tbl.firstChild); + } + } + } + + /** + * Makes defined rows always visible + */ + + }, { + key: 'enforceVisibility', + value: function enforceVisibility() { + if (!this.hasVisibleRows) { + return; + } + for (var i = 0, len = this.visibleRows.length; i < len; i++) { + var row = this.visibleRows[i]; + //row index cannot be > nrows + if (row <= this.nbRows) { + this.validateRow(row, true); + } + } + } + + /** + * Clear all the filters' values + */ + + }, { + key: 'clearFilters', + value: function clearFilters() { + if (!this.fltGrid) { + return; + } + + this.emitter.emit('before-clearing-filters', this); + + if (this.onBeforeReset) { + this.onBeforeReset.call(null, this, this.getFiltersValue()); + } + for (var i = 0, len = this.fltIds.length; i < len; i++) { + this.setFilterValue(i, ''); + } + // if(this.linkedFilters){ + // this.linkFilters(); + // } + if (this.rememberPageLen) { + _cookie2.default.remove(this.pgLenCookie); + } + if (this.rememberPageNb) { + _cookie2.default.remove(this.pgNbCookie); + } + if (this.onAfterReset) { + this.onAfterReset.call(null, this); + } + + this.filter(); + + this.emitter.emit('after-clearing-filters', this); + } + + /** + * Clears filtered columns visual indicator (background color) + */ + + }, { + key: 'clearActiveColumns', + value: function clearActiveColumns() { + for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { + _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); + } + } + + /** + * Mark currently filtered column + * @param {Number} colIndex Column index + */ + + }, { + key: 'markActiveColumn', + value: function markActiveColumn(colIndex) { + var header = this.getHeaderElement(colIndex); + if (_dom2.default.hasClass(header, this.activeColumnsCssClass)) { + return; + } + if (this.onBeforeActiveColumn) { + this.onBeforeActiveColumn.call(null, this, colIndex); + } + _dom2.default.addClass(header, this.activeColumnsCssClass); + if (this.onAfterActiveColumn) { + this.onAfterActiveColumn.call(null, this, colIndex); + } + } + + /** + * Refresh the filters subject to linking ('select', 'multiple', + * 'checklist' type) + */ + + }, { + key: 'linkFilters', + value: function linkFilters() { + if (!this.linkedFilters || !this.activeFilterId) { + return; + } + 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); + + var activeFlt = this.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(this.prfxFlt)[1]; + var slcSelectedValue = undefined; + for (var i = 0, len = slcIndex.length; i < len; i++) { + var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); + slcSelectedValue = this.getFilterValue(slcIndex[i]); + + // Welcome to cyclomatic complexity hell :) + // TODO: simplify/refactor if statement + if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; + } else { + curSlc.innerHTML = ''; + } + + //1st option needs to be inserted + if (this.loadFltOnDemand) { + var opt0 = _dom2.default.createOpt(this.displayAllText, ''); + if (curSlc) { + curSlc.appendChild(opt0); + } + } + + if (slcA3.indexOf(slcIndex[i]) != -1) { + this.Mod.checkList.build(slcIndex[i]); + } else { + this.Mod.dropdown.build(slcIndex[i], true); + } + + this.setFilterValue(slcIndex[i], slcSelectedValue); + } + } // for i + } + + /** + * Re-generate the filters grid bar when previously removed + */ + + }, { + key: '_resetGrid', + value: function _resetGrid() { + if (this.isFirstLoad) { + return; + } + + var Mod = this.Mod; + var tbl = this.tbl; + var rows = tbl.rows; + var filtersRowIndex = this.filtersRowIndex; + var filtersRow = rows[filtersRowIndex]; + + // grid was removed, grid row element is stored in fltGridEl property + if (!this.gridLayout) { + // If table has a thead ensure the filters row is appended in the + // thead element + if (tbl.tHead) { + var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); + tbl.tHead.replaceChild(this.fltGridEl, tempRow); + } else { + filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); + } + + _dom2.default.addClass(tbl, this.prfxTf); + } + + // filters are appended in external placeholders elements + if (this.isExternalFlt) { + var externalFltTgtIds = this.externalFltTgtIds; + for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { + var extFlt = _dom2.default.id(externalFltTgtIds[ct]); + + if (!extFlt) { + continue; + } + + var externalFltEl = this.externalFltEls[ct]; + extFlt.appendChild(externalFltEl); + var colFltType = this.getFilterType(ct); + //IE special treatment for gridLayout, appended filters are + //empty + if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { + if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { + Mod.dropdown.build(ct); + } + if (colFltType === this.fltTypeCheckList) { + Mod.checkList.build(ct); + } + } + } + } + + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = rows.length; + + if (this.popupFilters) { + this.headersRow++; + Mod.popupFilter.reset(); + } + + this._hasGrid = true; + } + + /** + * Determines if passed filter column implements exact query match + * @param {Number} colIndex [description] + * @return {Boolean} [description] + */ + + }, { + key: 'isExactMatch', + value: function isExactMatch(colIndex) { + var fltType = this.getFilterType(colIndex); + return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; + } + + /** + * Check if passed script or stylesheet is already imported + * @param {String} filePath Ressource path + * @param {String} type Possible values: 'script' or 'link' + * @return {Boolean} + */ + + }, { + key: 'isImported', + value: function isImported(filePath, type) { + var imported = false, + importType = !type ? 'script' : type, + attr = importType == 'script' ? 'src' : 'href', + files = _dom2.default.tag(doc, importType); + for (var i = 0, len = files.length; i < len; i++) { + if (files[i][attr] === undefined) { + continue; + } + if (files[i][attr].match(filePath)) { + imported = true; + break; + } + } + return imported; + } + + /** + * Import script or stylesheet + * @param {String} fileId Ressource ID + * @param {String} filePath Ressource path + * @param {Function} callback Callback + * @param {String} type Possible values: 'script' or 'link' + */ + + }, { + key: 'import', + value: function _import(fileId, filePath, callback, type) { + var ftype = !type ? 'script' : type, + imported = this.isImported(filePath, ftype); + if (imported) { + return; + } + var o = this, + isLoaded = false, + file = undefined, + head = _dom2.default.tag(doc, 'head')[0]; + + if (_string2.default.lower(ftype) === 'link') { + file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); + } else { + file = _dom2.default.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: ' + filePath); + }; + head.appendChild(file); + } + + /** + * Check if table has filters grid + * @return {Boolean} + */ + + }, { + key: 'hasGrid', + value: function hasGrid() { + return this._hasGrid; + } + + /** + * Get list of filter IDs + * @return {[type]} [description] + */ + + }, { + key: 'getFiltersId', + value: function getFiltersId() { + return this.fltIds || []; + } + + /** + * Get filtered (valid) rows indexes + * @param {Boolean} reCalc Force calculation of filtered rows list + * @return {Array} List of row indexes + */ + + }, { + key: 'getValidRows', + value: function getValidRows(reCalc) { + 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; + } + + /** + * Get the index of the row containing the filters + * @return {Number} + */ + + }, { + key: 'getFiltersRowIndex', + value: function getFiltersRowIndex() { + return this.filtersRowIndex; + } + + /** + * Get the index of the headers row + * @return {Number} + */ + + }, { + key: 'getHeadersRowIndex', + value: function getHeadersRowIndex() { + return this.headersRow; + } + + /** + * Get the row index from where the filtering process start (1st filterable + * row) + * @return {Number} + */ + + }, { + key: 'getStartRowIndex', + value: function getStartRowIndex() { + return this.refRow; + } + + /** + * Get the index of the last row + * @return {Number} + */ + + }, { + key: 'getLastRowIndex', + value: function getLastRowIndex() { + if (!this._hasGrid) { + return; + } + return this.nbRows - 1; + } + + /** + * Get the header DOM element for a given column index + * @param {Number} colIndex Column index + * @return {Object} + */ + + }, { + key: 'getHeaderElement', + value: function getHeaderElement(colIndex) { + var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; + var tHead = _dom2.default.tag(table, 'thead'); + var headersRow = this.headersRow; + var header = undefined; + for (var i = 0; i < this.nbCells; i++) { + if (i !== colIndex) { + continue; + } + if (tHead.length === 0) { + header = table.rows[headersRow].cells[i]; + } + if (tHead.length === 1) { + header = tHead[0].rows[headersRow].cells[i]; + } + break; + } + return header; + } + + /** + * Return the list of headers' text + * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns + * @return {Array} list of headers' text + */ + + }, { + key: 'getHeadersText', + value: function getHeadersText() { + var excludeHiddenCols = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var headers = []; + for (var j = 0; j < this.nbCells; j++) { + if (excludeHiddenCols && this.hasExtension('colsVisibility')) { + if (this.extension('colsVisibility').isColHidden(j)) { + continue; + } + } + var header = this.getHeaderElement(j); + var headerText = _dom2.default.getText(header); + headers.push(headerText); + } + return headers; + } + + /** + * Return the filter type for a specified column + * @param {Number} colIndex Column's index + * @return {String} + */ + + }, { + key: 'getFilterType', + value: function getFilterType(colIndex) { + var colType = this.cfg['col_' + colIndex]; + return !colType ? this.fltTypeInp : _string2.default.lower(colType); + } + + /** + * Get the total number of filterable rows + * @return {Number} + */ + + }, { + key: 'getFilterableRowsNb', + value: function getFilterableRowsNb() { + return this.getRowsNb(false); + } + + /** + * Get the configuration object (literal object) + * @return {Object} + */ + + }, { + key: 'config', + value: function config() { + return this.cfg; + } + }]); + + return TableFilter; + })(); + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * DOM event utilities + */ + + exports.default = { + 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; + } + }, + target: function target(evt) { + return evt && evt.target || window.event && window.event.srcElement; + }, + keyCode: function keyCode(evt) { + return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; + } + }; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * DOM utilities + */ + + exports.default = { + + /** + * Returns text + text of children of given node + * @param {NodeElement} node + * @return {String} + */ + + getText: function getText(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 + */ + create: function create(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]); + } + } + } + return el; + }, + + /** + * Removes passed node from DOM + * @param {DOMElement} node + * @return {DOMElement} old node reference + */ + remove: function remove(node) { + return node.parentNode.removeChild(node); + }, + + /** + * Returns a text node with given text + * @param {String} txt + * @return {Object} + */ + text: function text(txt) { + return document.createTextNode(txt); + }, + hasClass: function hasClass(ele, cls) { + if (!ele) { + return false; + } + + if (supportsClassList()) { + return ele.classList.contains(cls); + } + return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); + }, + addClass: function addClass(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; + } + }, + removeClass: function removeClass(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 + */ + createOpt: function createOpt(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 + */ + createCheckItem: function createCheckItem(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; + }, + id: function id(key) { + return document.getElementById(key); + }, + tag: function tag(o, tagname) { + return o.getElementsByTagName(tagname); + } + }; + + // HTML5 classList API + + function supportsClassList() { + return document.documentElement.classList; + } + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * String utilities + */ + + exports.default = { + lower: function lower(text) { + return text.toLowerCase(); + }, + upper: function upper(text) { + return text.toUpperCase(); + }, + trim: function trim(text) { + if (text.trim) { + return text.trim(); + } + return text.replace(/^\s*|\s*$/g, ''); + }, + isEmpty: function isEmpty(text) { + return this.trim(text) === ''; + }, + rgxEsc: function rgxEsc(text) { + var chars = /[-\/\\^$*+?.()|[\]{}]/g; + var escMatch = '\\$&'; + return String(text).replace(chars, escMatch); + }, + matchCase: function matchCase(text, caseSensitive) { + if (!caseSensitive) { + return this.lower(text); + } + return text; + }, + + /** + * Checks if passed data contains the searched term + * @param {String} term Searched term + * @param {String} data Data string + * @param {Boolean} exactMatch Exact match + * @param {Boolean} caseSensitive Case sensitive + * @return {Boolean} + */ + contains: function contains(term, data) { + var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; + + // Improved by Cedric Wartel (cwl) automatic exact match for selects and + // special characters are now filtered + var regexp = undefined, + modifier = caseSensitive ? 'g' : 'gi'; + if (exactMatch) { + regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); + } else { + regexp = new RegExp(this.rgxEsc(term), modifier); + } + return regexp.test(data); + } + }; + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Cookie utilities + */ + + exports.default = { + write: function write(name, value, hours) { + var expire = ''; + if (hours) { + expire = new Date(new Date().getTime() + hours * 3600000); + expire = '; expires=' + expire.toGMTString(); + } + document.cookie = name + '=' + escape(value) + expire; + }, + read: function read(name) { + var cookieValue = '', + search = name + '='; + if (document.cookie.length > 0) { + var cookie = document.cookie, + offset = cookie.indexOf(search); + if (offset !== -1) { + offset += search.length; + var end = cookie.indexOf(';', offset); + if (end === -1) { + end = cookie.length; + } + cookieValue = unescape(cookie.substring(offset, end)); + } + } + return cookieValue; + }, + remove: function remove(name) { + this.write(name, '', -1); + }, + valueToArray: function valueToArray(name, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.read(name); + //creates an array with filters' values + var arr = val.split(separator); + return arr; + }, + getValueByIndex: function getValueByIndex(name, index, separator) { + if (!separator) { + separator = ','; + } + //reads the cookie + var val = this.valueToArray(name, separator); + return val[index]; + } + }; + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + /** + * Types utilities + */ + + var UNDEFINED = void 0; + + exports.default = { + /** + * Check if argument is an object or a global object + * @param {String or Object} v + * @return {Boolean} + */ + + isObj: function isObj(v) { + var isO = false; + if (typeof v === 'string') { + if (window[v] && _typeof(window[v]) === 'object') { + isO = true; + } + } else { + if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { + isO = true; + } + } + return isO; + }, + + /** + * Check if argument is a function + * @param {Function} fn + * @return {Boolean} + */ + isFn: function isFn(fn) { + return fn && fn.constructor == Function; + }, + + /** + * Check if argument is an array + * @param {Array} obj + * @return {Boolean} + */ + isArray: function isArray(obj) { + return obj && obj.constructor == Array; + }, + + /** + * Determine if argument is undefined + * @param {Any} o + * @return {Boolean} + */ + isUndef: function isUndef(o) { + return o === UNDEFINED; + }, + + /** + * Determine if argument is null + * @param {Any} o + * @return {Boolean} + */ + isNull: function isNull(o) { + return o === null; + }, + + /** + * Determine if argument is empty (undefined, null or empty string) + * @param {Any} o + * @return {Boolean} + */ + isEmpty: function isEmpty(o) { + return this.isUndef(o) || this.isNull(o) || o.length === 0; + } + }; + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + has: function has(arr, val, caseSensitive) { + var sCase = caseSensitive === undefined ? false : caseSensitive; + for (var i = 0; i < arr.length; i++) { + if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { + return true; + } + } + return false; + } + }; /** + * Array utilities + */ + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Date utilities + */ + + exports.default = { + 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 = undefined, + reg2 = undefined; + // 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 = undefined, + dd = undefined, + yy = undefined; + // 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(dateStr, formatStr) { + if (!formatStr) { + formatStr = 'DMY'; + } + if (!dateStr || dateStr === '') { + return new Date(1001, 0, 1); + } + var oDate = undefined; + var parts = undefined; + + switch (formatStr.toUpperCase()) { + case 'DDMMMYYYY': + parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); + oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); + break; + case 'DMY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'MDY': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + case 'YMD': + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + default: + //in case format is not correct + /* jshint ignore:start */ + 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]); + /* jshint ignore:end */ + break; + } + return oDate; + } + }; + + function y2kDate(yr) { + if (yr === undefined) { + return 0; + } + if (yr.length > 2) { + return yr; + } + var y = undefined; + //>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; + } + + function mmm2mm(mmm) { + if (mmm === undefined) { + return 0; + } + var mondigit = undefined; + 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; + } + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + removeNbFormat: function removeNbFormat(data, format) { + if (!data) { + return; + } + if (!format) { + format = 'us'; + } + var n = data; + if (_string2.default.lower(format) === 'us') { + n = +n.replace(/[^\d\.-]/g, ''); + } else { + n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); + } + return n; + } + }; /** + * Misc helpers + */ + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + "use strict"; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Event emitter class + */ + + var Emitter = exports.Emitter = (function () { + function Emitter() { + _classCallCheck(this, Emitter); + + /** + * Events object + * @type {Object} + */ + this.events = {}; + } + + /** + * Subscribe to an event + * @param {Array} evts Collection of event names + * @param {Function} fn Function invoked when event is emitted + */ + + _createClass(Emitter, [{ + key: "on", + value: function on(evts, fn) { + var _this = this; + + evts.forEach(function (evt) { + _this.events[evt] = _this.events[evt] || []; + _this.events[evt].push(fn); + }); + } + + /** + * Unsubscribe to an event + * @param {Array} evts Collection of event names + * @param {Function} fn Function invoked when event is emitted + */ + + }, { + key: "off", + value: function off(evts, fn) { + var _this2 = this; + + evts.forEach(function (evt) { + if (evt in _this2.events) { + _this2.events[evt].splice(_this2.events[evt].indexOf(fn), 1); + } + }); + } + + /** + * Emit an event + * @param {String} evt Event name followed by any other argument passed to + * the invoked function + */ + + }, { + key: "emit", + value: function emit(evt /*, args...*/) { + if (evt in this.events) { + for (var i = 0; i < this.events[evt].length; i++) { + this.events[evt][i].apply(this, [].slice.call(arguments, 1)); + } + } + } + }]); + + return Emitter; + })(); + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Store = undefined; + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Store = exports.Store = (function () { + + /** + * Store, persistence manager + * @param {Object} tf TableFilter instance + * + * TODO: use localStorage and fallback to cookie persistence + */ + + function Store(tf) { + _classCallCheck(this, Store); + + var f = tf.config(); + + this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(Store, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on(['after-filtering'], function () { + return _this.saveFilterValues(_this.tf.fltsValuesCookie); + }); + } + + /** + * Store filters' values in cookie + * @param {String} cookie name + */ + + }, { + key: 'saveFilterValues', + value: function saveFilterValues(name) { + var tf = this.tf; + var fltValues = []; + + if (!tf.rememberGridValues) { + return; + } + + //store filters' values + for (var i = 0; i < tf.fltIds.length; i++) { + var value = tf.getFilterValue(i); + if (value === '') { + value = ' '; + } + fltValues.push(value); + } + //adds array size + fltValues.push(tf.fltIds.length); + + //writes cookie + _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); + } + + /** + * Retrieve filters' values from cookie + * @param {String} cookie name + * @return {Array} + */ + + }, { + key: 'getFilterValues', + value: function getFilterValues(name) { + var flts = _cookie2.default.read(name); + var rgx = new RegExp(this.tf.separator, 'g'); + // filters' values array + return flts.split(rgx); + } + + /** + * Store page number in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageNb', + value: function savePageNb(name) { + if (!this.tf.rememberPageNb) { + return; + } + _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); + } + + /** + * Retrieve page number from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageNb', + value: function getPageNb(name) { + return _cookie2.default.read(name); + } + + /** + * Store page length in cookie + * @param {String} cookie name + */ + + }, { + key: 'savePageLength', + value: function savePageLength(name) { + if (!this.tf.rememberPageLen) { + return; + } + _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); + } + + /** + * Retrieve page length from cookie + * @param {String} cookie name + * @return {String} + */ + + }, { + key: 'getPageLength', + value: function getPageLength(name) { + return _cookie2.default.read(name); + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off(['after-filtering'], function () { + return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); + }); + } + }]); + + return Store; + })(); + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.GridLayout = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var GridLayout = exports.GridLayout = (function (_Feature) { + _inherits(GridLayout, _Feature); + + /** + * Grid layout, table with fixed headers + * @param {Object} tf TableFilter instance + */ + + function GridLayout(tf) { + _classCallCheck(this, GridLayout); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); + + var f = _this.config; + + //defines grid width + _this.gridWidth = f.grid_width || null; + //defines grid height + _this.gridHeight = f.grid_height || null; + //defines css class for main container + _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; + //defines css class for div containing table + _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; + //defines css class for div containing headers' table + _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; + //defines css class for div containing rows counter, paging etc. + _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; + //defines which row contains column headers + _this.gridHeadRowIndex = f.grid_headers_row_index || 0; + //array of headers row indexes to be placed in header table + _this.gridHeadRows = f.grid_headers_rows || [0]; + //generate filters in table headers + _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; + //default col width + _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; + + _this.gridColElms = []; + + //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_'; + + _this.sourceTblHtml = tf.tbl.outerHTML; + return _this; + } + + /** + * Generates a grid with fixed headers + */ + + _createClass(GridLayout, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + var f = this.config; + var tbl = tf.tbl; + + if (this.initialized) { + return; + } + + // Override reference rows indexes + tf.refRow = _types2.default.isNull(tf.startRow) ? 0 : tf.startRow; + tf.headersRow = 0; + tf.filtersRowIndex = 1; + + tf.isExternalFlt = true; + + // default width of 100px if column widths not set + if (!tf.hasColWidths) { + tf.colWidths = []; + for (var k = 0; k < tf.nbCells; k++) { + var colW = undefined, + cell = tbl.rows[this.gridHeadRowIndex].cells[k]; + if (cell.width !== '') { + colW = cell.width; + } else if (cell.style.width !== '') { + colW = parseInt(cell.style.width, 10); + } else { + colW = this.gridDefaultColWidth; + } + tf.colWidths[k] = colW; + } + tf.hasColWidths = true; + } + tf.setColWidths(this.gridHeadRowIndex); + + var tblW = undefined; //initial table width + if (tbl.width !== '') { + tblW = tbl.width; + } else if (tbl.style.width !== '') { + tblW = parseInt(tbl.style.width, 10); + } else { + tblW = tbl.clientWidth; + } + + //Main container: it will contain all the elements + this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); + this.tblMainCont.className = this.gridMainContCssClass; + if (this.gridWidth) { + this.tblMainCont.style.width = this.gridWidth; + } + tbl.parentNode.insertBefore(this.tblMainCont, tbl); + + //Table container: div wrapping content table + this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); + this.tblCont.className = this.gridContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.tblCont.style.width = '100%'; + } else { + this.tblCont.style.width = this.gridWidth; + } + } + if (this.gridHeight) { + this.tblCont.style.height = this.gridHeight; + } + tbl.parentNode.insertBefore(this.tblCont, tbl); + var t = _dom2.default.remove(tbl); + this.tblCont.appendChild(t); + + //In case table width is expressed in % + if (tbl.style.width === '') { + tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; + } + + var d = _dom2.default.remove(this.tblCont); + this.tblMainCont.appendChild(d); + + //Headers table container: div wrapping headers table + this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); + this.headTblCont.className = this.gridHeadContCssClass; + if (this.gridWidth) { + if (this.gridWidth.indexOf('%') != -1) { + this.headTblCont.style.width = '100%'; + } else { + this.headTblCont.style.width = this.gridWidth; + } + } + + //Headers table + this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); + var tH = _dom2.default.create('tHead'); + + //1st row should be headers row, ids are added if not set + //Those ids are used by the sort feature + var hRow = tbl.rows[this.gridHeadRowIndex]; + var sortTriggers = []; + for (var n = 0; n < tf.nbCells; n++) { + var c = hRow.cells[n]; + var thId = c.getAttribute('id'); + if (!thId || thId === '') { + thId = this.prfxGridTh + n + '_' + tf.id; + c.setAttribute('id', thId); + } + sortTriggers.push(thId); + } + + //Filters row is created + var filtersRow = _dom2.default.create('tr'); + if (this.gridEnableFilters && tf.fltGrid) { + tf.externalFltTgtIds = []; + for (var j = 0; j < tf.nbCells; j++) { + var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; + var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); + filtersRow.appendChild(cl); + tf.externalFltTgtIds[j] = fltTdId; + } + } + //Headers row are moved from content table to headers table + for (var i = 0; i < this.gridHeadRows.length; i++) { + var headRow = tbl.rows[this.gridHeadRows[0]]; + tH.appendChild(headRow); + } + this.headTbl.appendChild(tH); + if (tf.filtersRowIndex === 0) { + tH.insertBefore(filtersRow, hRow); + } else { + tH.appendChild(filtersRow); + } + + this.headTblCont.appendChild(this.headTbl); + this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); + + //THead needs to be removed in content table for sort feature + var thead = _dom2.default.tag(tbl, 'thead'); + if (thead.length > 0) { + tbl.removeChild(thead[0]); + } + + //Headers table style + this.headTbl.style.tableLayout = 'fixed'; + tbl.style.tableLayout = 'fixed'; + this.headTbl.cellPadding = tbl.cellPadding; + this.headTbl.cellSpacing = tbl.cellSpacing; + // this.headTbl.style.width = tbl.style.width; + + //content table without headers needs col widths to be reset + tf.setColWidths(0, this.headTbl); + + //Headers container width + // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; + + tbl.style.width = ''; + // + this.headTbl.style.width = tbl.clientWidth + 'px'; + // + + //scroll synchronisation + _event2.default.add(this.tblCont, 'scroll', function (evt) { + var elm = _event2.default.target(evt); + var scrollLeft = elm.scrollLeft; + _this2.headTblCont.scrollLeft = scrollLeft; + //New pointerX calc taking into account scrollLeft + // if(!o.isPointerXOverwritten){ + // try{ + // o.Evt.pointerX = function(evt){ + // let e = evt || global.event; + // let bdScrollLeft = tf_StandardBody().scrollLeft + + // scrollLeft; + // return (e.pageX + scrollLeft) || + // (e.clientX + bdScrollLeft); + // }; + // o.isPointerXOverwritten = true; + // } catch(err) { + // o.isPointerXOverwritten = false; + // } + // } + }); + + //Configure sort extension if any + var sort = (f.extensions || []).filter(function (itm) { + return itm.name === 'sort'; + }); + if (sort.length === 1) { + sort[0].async_sort = true; + sort[0].trigger_ids = sortTriggers; + } + + //Cols generation for all browsers excepted IE<=7 + this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; + + //Col elements are enough to keep column widths after sorting and + //filtering + var createColTags = function createColTags() { + for (var k = tf.nbCells - 1; k >= 0; k--) { + var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); + tbl.insertBefore(col, tbl.firstChild); + col.style.width = tf.colWidths[k]; + this.gridColElms[k] = col; + } + this.tblHasColTag = true; + }; + + if (!this.tblHasColTag) { + createColTags.call(this); + } else { + var cols = _dom2.default.tag(tbl, 'col'); + for (var ii = 0; ii < tf.nbCells; ii++) { + cols[ii].setAttribute('id', tf.id + '_col_' + ii); + cols[ii].style.width = tf.colWidths[ii]; + this.gridColElms.push(cols[ii]); + } + } + + var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; + f.on_after_col_resized = function (o, colIndex) { + if (!colIndex) { + return; + } + var w = o.crWColsRow.cells[colIndex].style.width; + var col = o.gridColElms[colIndex]; + col.style.width = w; + + var thCW = o.crWColsRow.cells[colIndex].clientWidth; + var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; + + if (thCW != tdCW) { + o.headTbl.style.width = tbl.clientWidth + 'px'; + } + + if (afterColResizedFn) { + afterColResizedFn.call(null, o, colIndex); + } + }; + + if (tf.popupFilters) { + filtersRow.style.display = 'none'; + } + + if (tbl.clientWidth !== this.headTbl.clientWidth) { + tbl.style.width = this.headTbl.clientWidth + 'px'; + } + + this.initialized = true; + } + + /** + * Removes the grid layout + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + var tbl = tf.tbl; + + if (!this.initialized) { + return; + } + var t = _dom2.default.remove(tbl); + this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); + _dom2.default.remove(this.tblMainCont); + + this.tblMainCont = null; + this.headTblCont = null; + this.headTbl = null; + this.tblCont = null; + + tbl.outerHTML = this.sourceTblHtml; + //needed to keep reference of table element for future usage + this.tf.tbl = t; + + this.initialized = false; + } + }]); + + return GridLayout; + })(_feature.Feature); + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var NOTIMPLEMENTED = 'Not implemented.'; + + var Feature = exports.Feature = (function () { + function Feature(tf, feature) { + _classCallCheck(this, Feature); + + this.tf = tf; + this.feature = feature; + this.enabled = tf[feature]; + this.config = tf.config(); + this.emitter = tf.emitter; + this.initialized = false; + } + + _createClass(Feature, [{ + key: 'init', + value: function init() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + } + }, { + key: 'destroy', + value: function destroy() { + throw new Error(NOTIMPLEMENTED); + } + }, { + key: 'enable', + value: function enable() { + this.enabled = true; + } + }, { + key: 'disable', + value: function disable() { + this.enabled = false; + } + }, { + key: 'isEnabled', + value: function isEnabled() { + return this.enabled; + } + }]); + + return Feature; + })(); + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Loader = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var Loader = exports.Loader = (function (_Feature) { + _inherits(Loader, _Feature); + + /** + * Loading message/spinner + * @param {Object} tf TableFilter instance + */ + + function Loader(tf) { + _classCallCheck(this, Loader); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); + + var f = _this.config; + + //id of container element + _this.loaderTgtId = f.loader_target_id || null; + //div containing loader + _this.loaderDiv = null; + //defines loader text + _this.loaderText = f.loader_text || 'Loading...'; + //defines loader innerHtml + _this.loaderHtml = f.loader_html || null; + //defines css class for loader div + _this.loaderCssClass = f.loader_css_class || 'loader'; + //delay for hiding loader + _this.loaderCloseDelay = 250; + //callback function before loader is displayed + _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; + //callback function after loader is closed + _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; + //loader div + _this.prfxLoader = 'load_'; + return _this; + } + + _createClass(Loader, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + var emitter = this.emitter; + + var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); + containerDiv.className = this.loaderCssClass; + + var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); + if (!this.loaderTgtId) { + targetEl.insertBefore(containerDiv, tf.tbl); + } else { + targetEl.appendChild(containerDiv); + } + this.loaderDiv = containerDiv; + if (!this.loaderHtml) { + this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); + } else { + this.loaderDiv.innerHTML = this.loaderHtml; + } + + this.show('none'); + + // Subscribe to events + emitter.on(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { + return _this2.show(''); + }); + emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this2.show('none'); + }); + + this.initialized = true; + } + }, { + key: 'show', + value: function show(p) { + var _this3 = this; + + if (!this.isEnabled() /*|| this.loaderDiv.style.display === p*/) { + return; + } + + var displayLoader = function displayLoader() { + if (!_this3.loaderDiv) { + return; + } + if (_this3.onShowLoader && p !== 'none') { + _this3.onShowLoader.call(null, _this3); + } + _this3.loaderDiv.style.display = p; + if (_this3.onHideLoader && p === 'none') { + _this3.onHideLoader.call(null, _this3); + } + }; + + var t = p === 'none' ? this.loaderCloseDelay : 1; + global.setTimeout(displayLoader, t); + } + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + if (!this.initialized) { + return; + } + + var emitter = this.emitter; + + _dom2.default.remove(this.loaderDiv); + this.loaderDiv = null; + + // Unsubscribe to events + emitter.off(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { + return _this4.show(''); + }); + emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this4.show('none'); + }); + + this.initialized = false; + } + }]); + + return Loader; + })(_feature.Feature); + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.HighlightKeyword = undefined; + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var HighlightKeyword = exports.HighlightKeyword = (function () { + + /** + * HighlightKeyword, highlight matched keyword + * @param {Object} tf TableFilter instance + */ + + function HighlightKeyword(tf) { + _classCallCheck(this, HighlightKeyword); + + var f = tf.config(); + //defines css class for highlighting + this.highlightCssClass = f.highlight_css_class || 'keyword'; + this.highlightedNodes = []; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(HighlightKeyword, [{ + key: 'init', + value: function init() { + var _this = this; + + this.emitter.on(['before-filtering'], function () { + return _this.unhighlightAll(); + }); + } + + /** + * highlight occurences of searched term in passed node + * @param {Node} node + * @param {String} word Searched term + * @param {String} cssClass Css class name + */ + + }, { + key: 'highlight', + value: function highlight(node, word, cssClass) { + // Iterate into this nodes childNodes + if (node.hasChildNodes) { + var children = node.childNodes; + for (var i = 0; i < children.length; i++) { + this.highlight(children[i], word, cssClass); + } + } + + if (node.nodeType === 3) { + var tempNodeVal = _string2.default.lower(node.nodeValue); + var tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) != -1) { + var pn = node.parentNode; + if (pn && pn.className != cssClass) { + // word not highlighted yet + var nv = node.nodeValue, + ni = tempNodeVal.indexOf(tempWordVal), + + // Create a load of replacement nodes + before = _dom2.default.text(nv.substr(0, ni)), + docWordVal = nv.substr(ni, word.length), + after = _dom2.default.text(nv.substr(ni + word.length)), + hiwordtext = _dom2.default.text(docWordVal), + hiword = _dom2.default.create('span'); + hiword.className = cssClass; + hiword.appendChild(hiwordtext); + pn.insertBefore(before, node); + pn.insertBefore(hiword, node); + pn.insertBefore(after, node); + pn.removeChild(node); + this.highlightedNodes.push(hiword.firstChild); + } + } + } + } + + /** + * Removes highlight to nodes matching passed string + * @param {String} word + * @param {String} cssClass Css class to remove + */ + + }, { + key: 'unhighlight', + value: function unhighlight(word, cssClass) { + var arrRemove = []; + var highlightedNodes = this.highlightedNodes; + for (var i = 0; i < highlightedNodes.length; i++) { + var n = highlightedNodes[i]; + if (!n) { + continue; + } + var tempNodeVal = _string2.default.lower(n.nodeValue), + tempWordVal = _string2.default.lower(word); + if (tempNodeVal.indexOf(tempWordVal) !== -1) { + var pn = n.parentNode; + if (pn && pn.className === cssClass) { + var prevSib = pn.previousSibling, + nextSib = pn.nextSibling; + if (!prevSib || !nextSib) { + continue; + } + nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; + prevSib.nodeValue = ''; + n.nodeValue = ''; + arrRemove.push(i); + } + } + } + for (var k = 0; k < arrRemove.length; k++) { + highlightedNodes.splice(arrRemove[k], 1); + } + } + + /** + * Clear all occurrences of highlighted nodes + */ + + }, { + key: 'unhighlightAll', + value: function unhighlightAll() { + if (!this.tf.highlightKeywords || !this.tf.searchArgs) { + return; + } + for (var y = 0; y < this.tf.searchArgs.length; y++) { + this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); + } + this.highlightedNodes = []; + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + this.emitter.off(['before-filtering'], function () { + return _this2.unhighlightAll(); + }); + } + }]); + + return HighlightKeyword; + })(); + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.PopupFilter = undefined; + + var _feature = __webpack_require__(12); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var PopupFilter = exports.PopupFilter = (function (_Feature) { + _inherits(PopupFilter, _Feature); + + /** + * Pop-up filter component + * @param {Object} tf TableFilter instance + */ + + function PopupFilter(tf) { + _classCallCheck(this, PopupFilter); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); + + var f = _this.config; + + // Enable external filters + tf.isExternalFlt = true; + tf.externalFltTgtIds = []; + + //filter icon path + _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; + //active filter icon path + _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; + _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; + //defines css class for popup div containing filter + _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; + //callback function before popup filtes is opened + _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; + //callback function after popup filtes is opened + _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; + //callback function before popup filtes is closed + _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; + //callback function after popup filtes is closed + _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; + + //stores filters spans + _this.popUpFltSpans = []; + //stores filters icons + _this.popUpFltImgs = []; + //stores filters containers + _this.popUpFltElms = _this.popUpFltElmCache || []; + _this.popUpFltAdjustToContainer = true; + + //id prefix for pop-up filter span + _this.prfxPopUpSpan = 'popUpSpan_'; + //id prefix for pop-up div containing filter + _this.prfxPopUpDiv = 'popUpDiv_'; + return _this; + } + + _createClass(PopupFilter, [{ + key: 'onClick', + value: function onClick(e) { + var evt = e || global.event, + elm = evt.target.parentNode, + colIndex = parseInt(elm.getAttribute('ci'), 10); + + this.closeAll(colIndex); + this.toggle(colIndex); + + if (this.popUpFltAdjustToContainer) { + var popUpDiv = this.popUpFltElms[colIndex], + header = this.tf.getHeaderElement(colIndex), + headerWidth = header.clientWidth * 0.95; + popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; + } + _event2.default.cancel(evt); + _event2.default.stop(evt); + } + + /** + * Initialize DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + // Override headers row index if no grouped headers + if (tf.headersRow <= 1) { + tf.headersRow = 0; + } + + for (var i = 0; i < tf.nbCells; i++) { + if (tf.getFilterType(i) === tf.fltTypeNone) { + continue; + } + var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); + popUpSpan.innerHTML = this.popUpImgFltHtml; + var header = tf.getHeaderElement(i); + header.appendChild(popUpSpan); + _event2.default.add(popUpSpan, 'click', function (evt) { + _this2.onClick(evt); + }); + this.popUpFltSpans[i] = popUpSpan; + this.popUpFltImgs[i] = popUpSpan.firstChild; + } + + // subscribe to events + this.emitter.on(['before-filtering'], function () { + return _this2.buildIcons(); + }); + this.emitter.on(['after-filtering'], function () { + return _this2.closeAll(); + }); + this.emitter.on(['cell-processed'], function (tf, cellIndex) { + return _this2.buildIcon(cellIndex, true); + }); + this.emitter.on(['filters-row-inserted'], function () { + return _this2.tf.headersRow++; + }); + this.emitter.on(['before-filter-init'], function (tf, colIndex) { + return _this2.build(colIndex); + }); + + this.initialized = true; + } + + /** + * Reset previously destroyed feature + */ + + }, { + key: 'reset', + value: function reset() { + this.enable(); + this.init(); + this.buildAll(); + } + + /** + * Build all pop-up filters elements + */ + + }, { + key: 'buildAll', + value: function buildAll() { + for (var i = 0; i < this.popUpFltElmCache.length; i++) { + this.build(i, this.popUpFltElmCache[i]); + } + } + + /** + * Build a specified pop-up filter elements + * @param {Number} colIndex Column index + * @param {Object} div Optional container DOM element + */ + + }, { + key: 'build', + value: function build(colIndex, div) { + var tf = this.tf; + var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; + popUpDiv.className = this.popUpDivCssClass; + tf.externalFltTgtIds.push(popUpDiv.id); + var header = tf.getHeaderElement(colIndex); + header.insertBefore(popUpDiv, header.firstChild); + _event2.default.add(popUpDiv, 'click', function (evt) { + _event2.default.stop(evt); + }); + this.popUpFltElms[colIndex] = popUpDiv; + } + + /** + * Toogle visibility of specified filter + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggle', + value: function toggle(colIndex) { + var tf = this.tf, + popUpFltElm = this.popUpFltElms[colIndex]; + + if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { + if (this.onBeforePopUpOpen) { + this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'block'; + if (tf.getFilterType(colIndex) === tf.fltTypeInp) { + var flt = tf.getFilterElement(colIndex); + if (flt) { + flt.focus(); + } + } + if (this.onAfterPopUpOpen) { + this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } else { + if (this.onBeforePopUpClose) { + this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + popUpFltElm.style.display = 'none'; + if (this.onAfterPopUpClose) { + this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); + } + } + } + + /** + * Close all filters excepted for the specified one if any + * @param {Number} exceptIdx Column index of the filter to not close + */ + + }, { + key: 'closeAll', + value: function closeAll(exceptIdx) { + for (var i = 0; i < this.popUpFltElms.length; i++) { + if (i === exceptIdx) { + continue; + } + var popUpFltElm = this.popUpFltElms[i]; + if (popUpFltElm) { + popUpFltElm.style.display = 'none'; + } + } + } + + /** + * Build all the icons representing the pop-up filters + */ + + }, { + key: 'buildIcons', + value: function buildIcons() { + for (var i = 0; i < this.popUpFltImgs.length; i++) { + this.buildIcon(i, false); + } + } + + /** + * Apply specified icon state + * @param {Number} colIndex Column index + * @param {Boolean} active Apply active state + */ + + }, { + key: 'buildIcon', + value: function buildIcon(colIndex, active) { + if (this.popUpFltImgs[colIndex]) { + this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; + } + } + + /** + * Remove pop-up filters + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + this.popUpFltElmCache = []; + for (var i = 0; i < this.popUpFltElms.length; i++) { + var popUpFltElm = this.popUpFltElms[i], + popUpFltSpan = this.popUpFltSpans[i], + popUpFltImg = this.popUpFltImgs[i]; + if (popUpFltElm) { + _dom2.default.remove(popUpFltElm); + this.popUpFltElmCache[i] = popUpFltElm; + } + popUpFltElm = null; + if (popUpFltSpan) { + _dom2.default.remove(popUpFltSpan); + } + popUpFltSpan = null; + if (popUpFltImg) { + _dom2.default.remove(popUpFltImg); + } + popUpFltImg = null; + } + this.popUpFltElms = []; + this.popUpFltSpans = []; + this.popUpFltImgs = []; + + // unsubscribe to events + this.emitter.off(['before-filtering'], function () { + return _this3.buildIcons(); + }); + this.emitter.off(['after-filtering'], function () { + return _this3.closeAll(); + }); + this.emitter.off(['cell-processed'], function (tf, cellIndex) { + return _this3.buildIcon(cellIndex, true); + }); + this.emitter.off(['filters-row-inserted'], function () { + return _this3.tf.headersRow++; + }); + this.emitter.off(['before-filter-init'], function (tf, colIndex) { + return _this3.build(colIndex); + }); + + this.initialized = false; + } + }]); + + return PopupFilter; + })(_feature.Feature); + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Dropdown = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Dropdown = exports.Dropdown = (function (_Feature) { + _inherits(Dropdown, _Feature); + + /** + * Dropdown UI component + * @param {Object} tf TableFilter instance + */ + + function Dropdown(tf) { + _classCallCheck(this, Dropdown); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Dropdown).call(this, tf, 'dropdown')); + + var f = tf.config(); + + _this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; + //defines empty option text + _this.nonEmptyText = f.non_empty_text || '(Non empty)'; + //sets select filling method: 'innerHTML' or 'createElement' + _this.slcFillingMethod = f.slc_filling_method || 'createElement'; + //IE only, tooltip text appearing on select before it is populated + _this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; + //tooltip text appearing on multiple select + _this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; + + _this.isCustom = null; + _this.opts = null; + _this.optsTxt = null; + _this.slcInnerHtml = null; + return _this; + } + + _createClass(Dropdown, [{ + key: 'onSlcFocus', + value: function onSlcFocus(e) { + var elm = _event2.default.target(e); + var tf = this.tf; + tf.activeFilterId = elm.getAttribute('id'); + tf.activeFlt = _dom2.default.id(tf.activeFilterId); + // select is populated when element has focus + if (tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + this.build(ct); + } + // if(tf.popupFilters){ + // Event.cancel(e); + // Event.stop(e); + // } + this.emitter.emit('filter-focus', tf, this); + } + }, { + key: 'onSlcChange', + value: function onSlcChange() { + // if(!this.activeFlt){ return; } + // if(this.popupFilters){ Event.stop(e); } + if (this.tf.onSlcChange) { + this.tf.filter(); + } + } + + /** + * Initialize drop-down filter + * @param {Number} colIndex Column index + * @param {Boolean} isExternal External filter flag + * @param {DOMElement} container Dom element containing the filter + */ + + }, { + key: 'init', + value: function init(colIndex, isExternal, container) { + var _this2 = this; + + var tf = this.tf; + var col = tf.getFilterType(colIndex); + var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; + + var slc = _dom2.default.create(tf.fltTypeSlc, ['id', tf.prfxFlt + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); + + if (col === tf.fltTypeMulti) { + slc.multiple = tf.fltTypeMulti; + slc.title = this.multipleSlcTooltip; + } + slc.className = _string2.default.lower(col) === tf.fltTypeSlc ? tf.fltCssClass : tf.fltMultiCssClass; + + //filter is appended in container element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(slc); + tf.externalFltEls.push(slc); + } else { + container.appendChild(slc); + } + + tf.fltIds.push(slc.id); + + if (!tf.loadFltOnDemand) { + this.build(colIndex); + } else { + //1st option is created here since build isn't invoked + var opt0 = _dom2.default.createOpt(tf.displayAllText, ''); + slc.appendChild(opt0); + } + + //Event.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); + _event2.default.add(slc, 'change', function () { + return _this2.onSlcChange(); + }); + // Event.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); + _event2.default.add(slc, 'focus', function (e) { + return _this2.onSlcFocus(e); + }); + + this.initialized = true; + } + + /** + * Build drop-down filter UI + * @param {Number} colIndex Column index + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Boolean} isExternal Render in external container + * @param {String} extSlcId External container id + */ + + }, { + key: 'build', + value: function build(colIndex) { + var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; + var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.emitter.emit('before-populating-filter', tf, colIndex); + + this.opts = []; + this.optsTxt = []; + this.slcInnerHtml = ''; + + var slcId = tf.fltIds[colIndex]; + if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { + return; + } + var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), + rows = tf.tbl.rows, + matchCase = tf.matchCase; + + //custom select test + this.isCustom = tf.isCustomOptions(colIndex); + + //custom selects text + var activeFlt = undefined; + if (isLinked && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + var excludedOpts = null, + filteredDataCol = null; + if (isLinked && tf.disableExcludedOptions) { + excludedOpts = []; + filteredDataCol = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cell = rows[k].cells, + nchilds = cell.length; + + // checks if row has exact cell # + if (nchilds !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < nchilds; j++) { + // WTF: cyclomatic complexity hell + if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cell[j]), + + //Vary Peter's patch + cell_string = _string2.default.matchCase(cell_data, matchCase); + + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, matchCase)) { + this.opts.push(cell_data); + } + + if (isLinked && tf.disableExcludedOptions) { + var filteredCol = filteredDataCol[j]; + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { + excludedOpts.push(cell_data); + } + } + } //if colIndex==j + } //for j + } //for k + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (excludedOpts) { + excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + } + } + + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (excludedOpts) { + excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (excludedOpts) { + excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (excludedOpts) { + excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + //populates drop-down + this.addOptions(colIndex, slc, isLinked, excludedOpts); + + this.emitter.emit('after-populating-filter', tf, colIndex, slc); + } + + /** + * Add drop-down options + * @param {Number} colIndex Column index + * @param {Object} slc Select Dom element + * @param {Boolean} isLinked Enable linked refresh behaviour + * @param {Array} excludedOpts Array of excluded options + * @param {Array} fltsValues Collection of persisted filter values + * @param {Array} fltArr Collection of persisted filter values + */ + + }, { + key: 'addOptions', + value: function addOptions(colIndex, slc, isLinked, excludedOpts /*, fltsValues, fltArr*/) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod), + slcValue = slc.value; + + slc.innerHTML = ''; + slc = this.addFirstOption(slc); + + for (var y = 0; y < this.opts.length; y++) { + if (this.opts[y] === '') { + continue; + } + var val = this.opts[y]; //option value + var lbl = this.isCustom ? this.optsTxt[y] : val; //option text + var isDisabled = false; + if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + isDisabled = true; + } + + if (fillMethod === 'innerhtml') { + var slcAttr = ''; + if (tf.loadFltOnDemand && slcValue === this.opts[y]) { + slcAttr = 'selected="selected"'; + } + this.slcInnerHtml += ''; + } else { + var opt = undefined; + //fill select on demand + if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { + opt = _dom2.default.createOpt(lbl, val, true); + } else { + opt = _dom2.default.createOpt(lbl, val, false); + } + if (isDisabled) { + opt.disabled = true; + } + slc.appendChild(opt); + } + } // for y + + if (fillMethod === 'innerhtml') { + slc.innerHTML += this.slcInnerHtml; + } + slc.setAttribute('filled', '1'); + } + + /** + * Add drop-down header option + * @param {Object} slc Select DOM element + */ + + }, { + key: 'addFirstOption', + value: function addFirstOption(slc) { + var tf = this.tf, + fillMethod = _string2.default.lower(this.slcFillingMethod); + + if (fillMethod === 'innerhtml') { + this.slcInnerHtml += ''; + } else { + var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); + if (!this.enableSlcResetFilter) { + opt0.style.display = 'none'; + } + slc.appendChild(opt0); + if (tf.enableEmptyOption) { + var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); + slc.appendChild(opt1); + } + if (tf.enableNonEmptyOption) { + var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); + slc.appendChild(opt2); + } + } + return slc; + } + }, { + key: 'destroy', + value: function destroy() {} + }]); + + return Dropdown; + })(_feature.Feature); + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = { + ignoreCase: function ignoreCase(a, b) { + var x = _string2.default.lower(a); + var y = _string2.default.lower(b); + return x < y ? -1 : x > y ? 1 : 0; + } + }; + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.CheckList = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _sort = __webpack_require__(17); + + var _sort2 = _interopRequireDefault(_sort); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var CheckList = exports.CheckList = (function (_Feature) { + _inherits(CheckList, _Feature); + + /** + * Checklist UI component + * @param {Object} tf TableFilter instance + */ + + function CheckList(tf) { + _classCallCheck(this, CheckList); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CheckList).call(this, tf, 'checkList')); + + var f = tf.config(); + + _this.checkListDiv = []; //checklist container div + //defines css class for div containing checklist filter + _this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; + //defines css class for checklist filters + _this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; + //defines css class for checklist item (li) + _this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; + //defines css class for selected checklist item (li) + _this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; + //Load on demand text + _this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; + //defines css class for checklist filters + _this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; + _this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; + //checklist filter container div + _this.prfxCheckListDiv = 'chkdiv_'; + + _this.isCustom = null; + _this.opts = null; + _this.optsTxt = null; + _this.excludedOpts = null; + return _this; + } + + _createClass(CheckList, [{ + key: 'onChange', + value: function onChange(evt) { + var elm = evt.target; + var tf = this.tf; + tf.activeFilterId = elm.getAttribute('id'); + tf.activeFlt = _dom2.default.id(tf.activeFilterId); + tf.filter(); + // this.tf.Evt.onSlcChange.call(this.tf, evt); + } + }, { + key: 'optionClick', + value: function optionClick(evt) { + this.setCheckListValues(evt.target); + this.onChange(evt); + } + }, { + key: 'onCheckListClick', + value: function onCheckListClick(evt) { + var _this2 = this; + + var elm = _event2.default.target(evt); + if (this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { + var ct = elm.getAttribute('ct'); + var div = this.checkListDiv[ct]; + this.build(ct); + _event2.default.remove(div, 'click', function (evt) { + return _this2.onCheckListClick(evt); + }); + } + } + + /** + * Initialize checklist filter + * @param {Number} colIndex Column index + * @param {Boolean} isExternal External filter flag + * @param {DOMElement} container Dom element containing the filter + */ + + }, { + key: 'init', + value: function init(colIndex, isExternal, container) { + var _this3 = this; + + var tf = this.tf; + var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; + + var divCont = _dom2.default.create('div', ['id', this.prfxCheckListDiv + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); + divCont.className = this.checkListDivCssClass; + + //filter is appended in desired element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(divCont); + tf.externalFltEls.push(divCont); + } else { + container.appendChild(divCont); + } + + this.checkListDiv[colIndex] = divCont; + tf.fltIds.push(tf.prfxFlt + colIndex + '_' + tf.id); + + if (!tf.loadFltOnDemand) { + this.build(colIndex); + } else { + _event2.default.add(divCont, 'click', function (evt) { + return _this3.onCheckListClick(evt); + }); + divCont.appendChild(_dom2.default.text(this.activateCheckListTxt)); + } + + this.initialized = true; + } + + /** + * Build checklist UI + * @param {Number} colIndex Column index + * @param {Boolean} isExternal Render in external container + * @param {String} extFltId External container id + */ + + }, { + key: 'build', + value: function build(colIndex) { + var _this4 = this; + + var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; + var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; + + var tf = this.tf; + colIndex = parseInt(colIndex, 10); + + this.emitter.emit('before-populating-filter', tf, colIndex); + + this.opts = []; + this.optsTxt = []; + + var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; + if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { + return; + } + + var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); + var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); + ul.className = this.checkListCssClass; + _event2.default.add(ul, 'change', function (evt) { + return _this4.onChange(evt); + }); + + var rows = tf.tbl.rows; + this.isCustom = tf.isCustomOptions(colIndex); + + var activeFlt = undefined; + if (tf.linkedFilters && tf.activeFilterId) { + activeFlt = tf.activeFilterId.split('_')[0]; + activeFlt = activeFlt.split(tf.prfxFlt)[1]; + } + + var filteredDataCol = []; + if (tf.linkedFilters && tf.disableExcludedOptions) { + this.excludedOpts = []; + } + + for (var k = tf.refRow; k < tf.nbRows; k++) { + // always visible rows don't need to appear on selects as always + // valid + if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { + continue; + } + + var cells = rows[k].cells; + var ncells = cells.length; + + // checks if row has exact cell # + if (ncells !== tf.nbCells || this.isCustom) { + continue; + } + + // this loop retrieves cell data + for (var j = 0; j < ncells; j++) { + // WTF: cyclomatic complexity hell :) + if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { + var cell_data = tf.getCellData(cells[j]); + //Vary Peter's patch + var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); + // checks if celldata is already in array + if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { + this.opts.push(cell_data); + } + var filteredCol = filteredDataCol[j]; + if (tf.linkedFilters && tf.disableExcludedOptions) { + if (!filteredCol) { + filteredCol = tf.getFilteredDataCol(j); + } + if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { + this.excludedOpts.push(cell_data); + } + } + } + } + } + + //Retrieves custom values + if (this.isCustom) { + var customValues = tf.getCustomOptions(colIndex); + this.opts = customValues[0]; + this.optsTxt = customValues[1]; + } + + if (tf.sortSlc && !this.isCustom) { + if (!tf.matchCase) { + this.opts.sort(_sort2.default.ignoreCase); + if (this.excludedOpts) { + this.excludedOpts.sort(_sort2.default.ignoreCase); + } + } else { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + } + } + //asc sort + if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortAsc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortAsc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortAsc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + //desc sort + if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { + try { + this.opts.sort(numSortDesc); + if (this.excludedOpts) { + this.excludedOpts.sort(numSortDesc); + } + if (this.isCustom) { + this.optsTxt.sort(numSortDesc); + } + } catch (e) { + this.opts.sort(); + if (this.excludedOpts) { + this.excludedOpts.sort(); + } + if (this.isCustom) { + this.optsTxt.sort(); + } + } //in case there are alphanumeric values + } + + this.addChecks(colIndex, ul, tf.separator); + + if (tf.loadFltOnDemand) { + flt.innerHTML = ''; + } + flt.appendChild(ul); + flt.setAttribute('filled', '1'); + + this.emitter.emit('after-populating-filter', tf, colIndex, flt); + } + + /** + * Add checklist options + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addChecks', + value: function addChecks(colIndex, ul) { + var _this5 = this; + + var tf = this.tf; + var chkCt = this.addTChecks(colIndex, ul); + + for (var y = 0; y < this.opts.length; y++) { + var val = this.opts[y]; //item value + var lbl = this.isCustom ? this.optsTxt[y] : val; //item text + var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); + li.className = this.checkListItemCssClass; + if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { + _dom2.default.addClass(li, this.checkListItemDisabledCssClass); + li.check.disabled = true; + li.disabled = true; + } else { + _event2.default.add(li.check, 'click', function (evt) { + return _this5.optionClick(evt); + }); + } + ul.appendChild(li); + + if (val === '') { + //item is hidden + li.style.display = 'none'; + } + } + } + + /** + * Add checklist header option + * @param {Number} colIndex Column index + * @param {Object} ul Ul element + */ + + }, { + key: 'addTChecks', + value: function addTChecks(colIndex, ul) { + var _this6 = this; + + var tf = this.tf; + var chkCt = 1; + var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); + li0.className = this.checkListItemCssClass; + ul.appendChild(li0); + + _event2.default.add(li0.check, 'click', function (evt) { + return _this6.optionClick(evt); + }); + + if (!this.enableCheckListResetFilter) { + li0.style.display = 'none'; + } + + if (tf.enableEmptyOption) { + var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); + li1.className = this.checkListItemCssClass; + ul.appendChild(li1); + _event2.default.add(li1.check, 'click', function (evt) { + return _this6.optionClick(evt); + }); + chkCt++; + } + + if (tf.enableNonEmptyOption) { + var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); + li2.className = this.checkListItemCssClass; + ul.appendChild(li2); + _event2.default.add(li2.check, 'click', function (evt) { + return _this6.optionClick(evt); + }); + chkCt++; + } + return chkCt; + } + + /** + * Store checked options in DOM element attribute + * @param {Object} o checklist option DOM element + */ + + }, { + key: 'setCheckListValues', + value: function setCheckListValues(o) { + if (!o) { + return; + } + var tf = this.tf; + var chkValue = o.value; //checked item value + var chkIndex = parseInt(o.id.split('_')[2], 10); + var filterTag = 'ul', + itemTag = 'li'; + var n = o; + + //ul tag search + while (_string2.default.lower(n.nodeName) !== filterTag) { + n = n.parentNode; + } + + var li = n.childNodes[chkIndex]; + var colIndex = n.getAttribute('colIndex'); + var fltValue = n.getAttribute('value'); //filter value (ul tag) + var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) + + if (o.checked) { + //show all item + if (chkValue === '') { + if (fltIndexes && fltIndexes !== '') { + //items indexes + var indSplit = fltIndexes.split(tf.separator); + //checked items loop + for (var u = 0; u < indSplit.length; u++) { + //checked item + var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); + if (cChk) { + cChk.checked = false; + _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); + } + } + } + n.setAttribute('value', ''); + n.setAttribute('indexes', ''); + } else { + fltValue = fltValue ? fltValue : ''; + chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); + chkIndex = fltIndexes + chkIndex + tf.separator; + n.setAttribute('value', chkValue); + n.setAttribute('indexes', chkIndex); + //1st option unchecked + if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { + _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; + } + } + + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); + _dom2.default.addClass(li, this.checkListSlcItemCssClass); + } + } else { + //removes values and indexes + if (chkValue !== '') { + var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); + fltValue = fltValue.replace(replaceValue, ''); + n.setAttribute('value', _string2.default.trim(fltValue)); + + var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); + fltIndexes = fltIndexes.replace(replaceIndex, ''); + n.setAttribute('indexes', fltIndexes); + } + if (_string2.default.lower(li.nodeName) === itemTag) { + _dom2.default.removeClass(li, this.checkListSlcItemCssClass); + } + } + } + }, { + key: 'destroy', + value: function destroy() {} + }]); + + return CheckList; + })(_feature.Feature); + +/***/ }, +/* 19 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.RowsCounter = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var RowsCounter = exports.RowsCounter = (function (_Feature) { + _inherits(RowsCounter, _Feature); + + /** + * Rows counter + * @param {Object} tf TableFilter instance + */ + + function RowsCounter(tf) { + _classCallCheck(this, RowsCounter); + + // TableFilter configuration + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); + + var f = _this.config; + + //id of custom container element + _this.rowsCounterTgtId = f.rows_counter_target_id || null; + //element containing tot nb rows + _this.rowsCounterDiv = null; + //element containing tot nb rows label + _this.rowsCounterSpan = null; + //defines rows counter text + _this.rowsCounterText = f.rows_counter_text || 'Rows: '; + _this.fromToTextSeparator = f.from_to_text_separator || '-'; + _this.overText = f.over_text || ' / '; + //defines css class rows counter + _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; + //rows counter div + _this.prfxCounter = 'counter_'; + //nb displayed rows label + _this.prfxTotRows = 'totrows_span_'; + //label preceding nb rows label + _this.prfxTotRowsTxt = 'totRowsTextSpan_'; + //callback raised before counter is refreshed + _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; + //callback raised after counter is refreshed + _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; + return _this; + } + + _createClass(RowsCounter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + //rows counter container + var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); + countDiv.className = this.totRowsCssClass; + //rows counter label + var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); + var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); + countText.appendChild(_dom2.default.text(this.rowsCounterText)); + + // counter is added to defined element + if (!this.rowsCounterTgtId) { + tf.setToolbar(); + } + var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); + + //default container: 'lDiv' + if (!this.rowsCounterTgtId) { + countDiv.appendChild(countText); + countDiv.appendChild(countSpan); + targetEl.appendChild(countDiv); + } else { + //custom container, no need to append statusDiv + targetEl.appendChild(countText); + targetEl.appendChild(countSpan); + } + this.rowsCounterDiv = countDiv; + this.rowsCounterSpan = countSpan; + + // subscribe to events + this.emitter.on(['after-filtering', 'grouped-by-page'], function () { + return _this2.refresh(tf.nbVisibleRows); + }); + this.emitter.on(['rows-changed'], function () { + return _this2.refresh(); + }); + + this.initialized = true; + this.refresh(); + } + }, { + key: 'refresh', + value: function refresh(p) { + if (!this.initialized || !this.isEnabled()) { + return; + } + + var tf = this.tf; + + if (this.onBeforeRefreshCounter) { + this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); + } + + var totTxt; + if (!tf.paging) { + if (p && p !== '') { + totTxt = p; + } else { + totTxt = tf.nbFilterableRows - tf.nbHiddenRows; + } + } else { + var paging = tf.feature('paging'); + if (paging) { + //paging start row + var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); + var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; + totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; + } + } + + this.rowsCounterSpan.innerHTML = totTxt; + if (this.onAfterRefreshCounter) { + this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + + if (!this.rowsCounterTgtId && this.rowsCounterDiv) { + _dom2.default.remove(this.rowsCounterDiv); + } else { + _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; + } + this.rowsCounterSpan = null; + this.rowsCounterDiv = null; + + // unsubscribe to events + this.emitter.off(['after-filtering', 'grouped-by-page'], function () { + return _this3.refresh(tf.nbVisibleRows); + }); + this.emitter.off(['rows-changed'], function () { + return _this3.refresh(); + }); + + this.initialized = false; + } + }]); + + return RowsCounter; + })(_feature.Feature); + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.StatusBar = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var global = window; + + var StatusBar = exports.StatusBar = (function (_Feature) { + _inherits(StatusBar, _Feature); + + /** + * Status bar UI component + * @param {Object} tf TableFilter instance + */ + + function StatusBar(tf) { + _classCallCheck(this, StatusBar); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); + + var f = _this.config; + + //id of custom container element + _this.statusBarTgtId = f.status_bar_target_id || null; + //element containing status bar label + _this.statusBarDiv = null; + //status bar + _this.statusBarSpan = null; + //status bar label + _this.statusBarSpanText = null; + //defines status bar text + _this.statusBarText = f.status_bar_text || ''; + //defines css class status bar + _this.statusBarCssClass = f.status_bar_css_class || 'status'; + //delay for status bar clearing + _this.statusBarCloseDelay = 250; + + //calls function before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //calls function after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + + //status messages + _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 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)...'; + + // status bar div + _this.prfxStatus = 'status_'; + // status bar label + _this.prfxStatusSpan = 'statusSpan_'; + // text preceding status bar label + _this.prfxStatusTxt = 'statusText_'; + return _this; + } + + _createClass(StatusBar, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + var emitter = this.emitter; + + //status bar container + var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); + statusDiv.className = this.statusBarCssClass; + + //status bar label + var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); + //preceding text + var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); + statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); + + // target element container + if (!this.statusBarTgtId) { + tf.setToolbar(); + } + var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); + + //default container: 'lDiv' + if (!this.statusBarTgtId) { + statusDiv.appendChild(statusSpanText); + statusDiv.appendChild(statusSpan); + targetEl.appendChild(statusDiv); + } else { + // custom container, no need to append statusDiv + targetEl.appendChild(statusSpanText); + targetEl.appendChild(statusSpan); + } + + this.statusBarDiv = statusDiv; + this.statusBarSpan = statusSpan; + this.statusBarSpanText = statusSpanText; + + // Subscribe to events + emitter.on(['before-filtering'], function () { + return _this2.message(_this2.msgFilter); + }); + emitter.on(['before-populating-filter'], function () { + return _this2.message(_this2.msgPopulate); + }); + emitter.on(['before-changing-page'], function () { + return _this2.message(_this2.msgChangePage); + }); + emitter.on(['before-clearing-filters'], function () { + return _this2.message(_this2.msgClear); + }); + emitter.on(['before-changing-results-per-page'], function () { + return _this2.message(_this2.msgChangeResults); + }); + emitter.on(['before-reset-page'], function () { + return _this2.message(_this2.msgResetPage); + }); + emitter.on(['before-reset-page-length'], function () { + return _this2.message(_this2.msgResetPageLength); + }); + emitter.on(['before-loading-extensions'], function () { + return _this2.message(_this2.msgLoadExtensions); + }); + emitter.on(['before-loading-themes'], function () { + return _this2.message(_this2.msgLoadThemes); + }); + + emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this2.message(''); + }); + + this.initialized = true; + } + }, { + key: 'message', + value: function message() { + var _this3 = this; + + var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; + + if (!this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, t); + } + + var d = t === '' ? this.statusBarCloseDelay : 1; + global.setTimeout(function () { + if (!_this3.initialized) { + return; + } + _this3.statusBarSpan.innerHTML = t; + if (_this3.onAfterShowMsg) { + _this3.onAfterShowMsg.call(null, _this3.tf, t); + } + }, d); + } + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + if (!this.initialized) { + return; + } + + var emitter = this.emitter; + + this.statusBarDiv.innerHTML = ''; + _dom2.default.remove(this.statusBarDiv); + this.statusBarSpan = null; + this.statusBarSpanText = null; + this.statusBarDiv = null; + + // Unsubscribe to events + emitter.off(['before-filtering'], function () { + return _this4.message(_this4.msgFilter); + }); + emitter.off(['before-populating-filter'], function () { + return _this4.message(_this4.msgPopulate); + }); + emitter.off(['before-changing-page'], function () { + return _this4.message(_this4.msgChangePage); + }); + emitter.off(['before-clearing-filters'], function () { + return _this4.message(_this4.msgClear); + }); + emitter.off(['before-changing-results-per-page'], function () { + return _this4.message(_this4.msgChangeResults); + }); + emitter.off(['before-reset-page'], function () { + return _this4.message(_this4.msgResetPage); + }); + emitter.off(['before-reset-page-length'], function () { + return _this4.message(_this4.msgResetPageLength); + }); + emitter.off(['before-loading-extensions'], function () { + return _this4.message(_this4.msgLoadExtensions); + }); + emitter.off(['before-loading-themes'], function () { + return _this4.message(_this4.msgLoadThemes); + }); + + emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { + return _this4.message(''); + }); + + this.initialized = false; + } + }]); + + return StatusBar; + })(_feature.Feature); + +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Paging = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var Paging = exports.Paging = (function (_Feature) { + _inherits(Paging, _Feature); + + /** + * Pagination component + * @param {Object} tf TableFilter instance + */ + + function Paging(tf) { + _classCallCheck(this, Paging); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); + + var f = _this.config; + + //css class for paging buttons (previous,next,etc.) + _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; + //stores paging select element + _this.pagingSlc = null; + //results per page select element + _this.resultsPerPageSlc = null; + //id of container element + _this.pagingTgtId = f.paging_target_id || null; + //defines table paging length + _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; + //id of container element + _this.resultsPerPageTgtId = f.results_per_page_target_id || null; + //css class for paging select element + _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; + //css class for paging input element + _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; + //stores results per page text and values + _this.resultsPerPage = f.results_per_page || null; + //enables/disables results per page drop-down + _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); + //defines css class for results per page select + _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; + //css class for label preceding results per page select + _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; + //1st row index of current page + _this.startPagingRow = 0; + //total nb of pages + _this.nbPages = 0; + //current page nb + _this.currentPageNb = 1; + //defines next page button text + _this.btnNextPageText = f.btn_next_page_text || '>'; + //defines previous page button text + _this.btnPrevPageText = f.btn_prev_page_text || '<'; + //defines last page button text + _this.btnLastPageText = f.btn_last_page_text || '>|'; + //defines first page button text + _this.btnFirstPageText = f.btn_first_page_text || '|<'; + //defines next page button html + _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); + //defines last page button html + _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); + //defines previous page button html + _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); + //defines text preceeding page selector drop-down + _this.pageText = f.page_text || ' Page '; + //defines text after page selector drop-down + _this.ofText = f.of_text || ' of '; + //css class for span containing tot nb of pages + _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; + //enables/disables paging buttons + _this.hasPagingBtns = f.paging_btns === false ? false : true; + //defines previous page button html + _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; + //calls function before page is changed + _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; + //calls function before page is changed + _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; + + //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_'; + + var start_row = tf.refRow; + var nrows = tf.nbRows; + //calculates page nb + _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); + + //Paging elements events + var o = _this; + // Paging DOM events + _this.evt = { + slcIndex: function slcIndex() { + return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; + }, + nbOpts: function nbOpts() { + return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; + }, + next: function next() { + var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; + o.changePage(nextIndex); + }, + prev: function prev() { + var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); + o.changePage(prevIndex); + }, + last: function last() { + o.changePage(o.evt.nbOpts()); + }, + first: function first() { + o.changePage(0); + }, + _detectKey: function _detectKey(e) { + var key = _event2.default.keyCode(e); + if (key === 13) { + if (tf.sorted) { + tf.filter(); + o.changePage(o.evt.slcIndex()); + } else { + o.changePage(); + } + this.blur(); + } + }, + + slcPagesChange: null, + nextEvt: null, + prevEvt: null, + lastEvt: null, + firstEvt: null + }; + return _this; + } + + /** + * Initialize DOM elements + */ + + _createClass(Paging, [{ + key: 'init', + value: function init() { + var _this2 = this; + + var slcPages; + var tf = this.tf; + var evt = this.evt; + + if (this.initialized) { + return; + } + + // Check resultsPerPage is in expected format and initialise the + // results per page component + if (this.hasResultsPerPage) { + if (this.resultsPerPage.length < 2) { + this.hasResultsPerPage = false; + } else { + this.pagingLength = this.resultsPerPage[1][0]; + this.setResultsPerPage(); + } + } + + evt.slcPagesChange = function (event) { + var slc = event.target; + _this2.changePage(slc.selectedIndex); + }; + + // Paging drop-down list selector + if (this.pageSelectorType === tf.fltTypeSlc) { + slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); + slcPages.className = this.pgSlcCssClass; + _event2.default.add(slcPages, 'change', evt.slcPagesChange); + } + + // Paging input selector + if (this.pageSelectorType === tf.fltTypeInp) { + slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); + slcPages.className = this.pgInpCssClass; + _event2.default.add(slcPages, 'keypress', evt._detectKey); + } + + // btns containers + var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); + var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); + var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); + var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); + + if (this.hasPagingBtns) { + // Next button + if (!this.btnNextPageHtml) { + var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); + btn_next.className = this.btnPageCssClass; + _event2.default.add(btn_next, 'click', evt.next); + btnNextSpan.appendChild(btn_next); + } else { + btnNextSpan.innerHTML = this.btnNextPageHtml; + _event2.default.add(btnNextSpan, 'click', evt.next); + } + // Previous button + if (!this.btnPrevPageHtml) { + var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); + btn_prev.className = this.btnPageCssClass; + _event2.default.add(btn_prev, 'click', evt.prev); + btnPrevSpan.appendChild(btn_prev); + } else { + btnPrevSpan.innerHTML = this.btnPrevPageHtml; + _event2.default.add(btnPrevSpan, 'click', evt.prev); + } + // Last button + if (!this.btnLastPageHtml) { + var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); + btn_last.className = this.btnPageCssClass; + _event2.default.add(btn_last, 'click', evt.last); + btnLastSpan.appendChild(btn_last); + } else { + btnLastSpan.innerHTML = this.btnLastPageHtml; + _event2.default.add(btnLastSpan, 'click', evt.last); + } + // First button + if (!this.btnFirstPageHtml) { + var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); + btn_first.className = this.btnPageCssClass; + _event2.default.add(btn_first, 'click', evt.first); + btnFirstSpan.appendChild(btn_first); + } else { + btnFirstSpan.innerHTML = this.btnFirstPageHtml; + _event2.default.add(btnFirstSpan, 'click', evt.first); + } + } + + // paging elements (buttons+drop-down list) are added to defined element + if (!this.pagingTgtId) { + tf.setToolbar(); + } + var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + targetEl.appendChild(btnFirstSpan); + targetEl.appendChild(btnPrevSpan); + + var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); + pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); + pgBeforeSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgBeforeSpan); + targetEl.appendChild(slcPages); + var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); + pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); + pgAfterSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgAfterSpan); + var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); + pgspan.className = this.nbPgSpanCssClass; + pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); + targetEl.appendChild(pgspan); + targetEl.appendChild(btnNextSpan); + targetEl.appendChild(btnLastSpan); + this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); + + if (!tf.rememberGridValues) { + this.setPagingInfo(); + } + if (!tf.fltGrid) { + tf.validateAllRows(); + this.setPagingInfo(tf.validRowsIndex); + } + + this.emitter.on(['after-filtering'], function () { + return _this2.resetPagingInfo(); + }); + this.emitter.on(['initialized'], function () { + return _this2.resetValues(); + }); + + this.initialized = true; + } + + /** + * Reset paging when filters are already instantiated + * @param {Boolean} filterTable Execute filtering once paging instanciated + */ + + }, { + key: 'reset', + value: function reset() { + var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var tf = this.tf; + if (!tf.hasGrid() || this.isEnabled()) { + return; + } + this.enable(); + this.init(); + tf.resetValues(); + if (filterTable) { + tf.filter(); + } + } + + /** + * Reset paging info from scratch after a filtering process + */ + + }, { + key: 'resetPagingInfo', + value: function resetPagingInfo() { + this.startPagingRow = 0; + this.currentPageNb = 1; + this.setPagingInfo(this.tf.validRowsIndex); + } + + /** + * Calculate number of pages based on valid rows + * Refresh paging select according to number of pages + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'setPagingInfo', + value: function setPagingInfo(validRows) { + var tf = this.tf; + var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + //store valid rows indexes + tf.validRowsIndex = validRows || tf.getValidRows(true); + + //calculate nb of pages + this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); + //refresh page nb span + pgspan.innerHTML = this.nbPages; + //select clearing shortcut + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.innerHTML = ''; + } + + if (this.nbPages > 0) { + mdiv.style.visibility = 'visible'; + if (this.pageSelectorType === tf.fltTypeSlc) { + for (var z = 0; z < this.nbPages; z++) { + var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); + this.pagingSlc.options[z] = opt; + } + } else { + //input type + this.pagingSlc.value = this.currentPageNb; + } + } else { + /*** if no results paging select and buttons are hidden ***/ + mdiv.style.visibility = 'hidden'; + } + this.groupByPage(tf.validRowsIndex); + } + + /** + * Group table rows by page and display valid rows + * @param {Array} validRows Collection of valid rows + */ + + }, { + key: 'groupByPage', + value: function groupByPage(validRows) { + var tf = this.tf; + var rows = tf.tbl.rows; + var startPagingRow = parseInt(this.startPagingRow, 10); + var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); + + //store valid rows indexes + if (validRows) { + tf.validRowsIndex = validRows; + } + + //this loop shows valid rows of current page + for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { + var validRowIdx = tf.validRowsIndex[h]; + var r = rows[validRowIdx]; + var isRowValid = r.getAttribute('validRow'); + var rowDisplayed = false; + + if (h >= startPagingRow && h < endPagingRow) { + if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { + r.style.display = ''; + rowDisplayed = true; + } + } else { + r.style.display = 'none'; + } + this.emitter.emit('row-paged', tf, validRowIdx, h, rowDisplayed); + } + + tf.nbVisibleRows = tf.validRowsIndex.length; + + // broadcast grouping by page + this.emitter.emit('grouped-by-page', tf, this); + } + + /** + * Return the current page number + * @return {Number} Page number + */ + + }, { + key: 'getPage', + value: function getPage() { + return this.currentPageNb; + } + + /** + * Show page based on passed param value (string or number): + * @param {String} or {Number} cmd possible string values: 'next', + * 'previous', 'last', 'first' or page number as per param + */ + + }, { + key: 'setPage', + value: function setPage(cmd) { + var tf = this.tf; + if (!tf.hasGrid() || !this.isEnabled()) { + return; + } + var btnEvt = this.evt, + cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); + if (cmdtype === 'string') { + switch (_string2.default.lower(cmd)) { + case 'next': + btnEvt.next(); + break; + case 'previous': + btnEvt.prev(); + break; + case 'last': + btnEvt.last(); + break; + case 'first': + btnEvt.first(); + break; + default: + btnEvt.next(); + break; + } + } else if (cmdtype === 'number') { + this.changePage(cmd - 1); + } + } + + /** + * Generates UI elements for the number of results per page drop-down + */ + + }, { + key: 'setResultsPerPage', + value: function setResultsPerPage() { + var _this3 = this; + + var tf = this.tf; + var evt = this.evt; + + if (!tf.hasGrid() && !tf.isFirstLoad) { + return; + } + if (this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + + evt.slcResultsChange = function (ev) { + _this3.changeResultsPerPage(); + ev.target.blur(); + }; + + var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); + slcR.className = this.resultsSlcCssClass; + var slcRText = this.resultsPerPage[0], + slcROpts = this.resultsPerPage[1]; + var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); + slcRSpan.className = this.resultsSpanCssClass; + + // results per page select is added to external element + if (!this.resultsPerPageTgtId) { + tf.setToolbar(); + } + var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); + slcRSpan.appendChild(_dom2.default.text(slcRText)); + + var help = tf.feature('help'); + if (help && help.btn) { + help.btn.parentNode.insertBefore(slcRSpan, help.btn); + help.btn.parentNode.insertBefore(slcR, help.btn); + } else { + targetEl.appendChild(slcRSpan); + targetEl.appendChild(slcR); + } + + for (var r = 0; r < slcROpts.length; r++) { + var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); + slcR.options[r] = currOpt; + } + _event2.default.add(slcR, 'change', evt.slcResultsChange); + this.resultsPerPageSlc = slcR; + } + + /** + * Remove number of results per page UI elements + */ + + }, { + key: 'removeResultsPerPage', + value: function removeResultsPerPage() { + var tf = this.tf; + if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { + return; + } + var slcR = this.resultsPerPageSlc, + slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); + if (slcR) { + _dom2.default.remove(slcR); + } + if (slcRSpan) { + _dom2.default.remove(slcRSpan); + } + this.resultsPerPageSlc = null; + } + + /** + * Change the page according to passed index + * @param {Number} index Index of the page (0-n) + */ + + }, { + key: 'changePage', + value: function changePage(index) { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + + this.emitter.emit('before-changing-page', tf, index); + + if (index === null) { + index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; + } + if (index >= 0 && index <= this.nbPages - 1) { + if (this.onBeforeChangePage) { + this.onBeforeChangePage.call(null, this, index); + } + this.currentPageNb = parseInt(index, 10) + 1; + if (this.pageSelectorType === tf.fltTypeSlc) { + this.pagingSlc.options[index].selected = true; + } else { + this.pagingSlc.value = this.currentPageNb; + } + + if (tf.rememberPageNb) { + tf.feature('store').savePageNb(tf.pgNbCookie); + } + this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; + + this.groupByPage(); + + if (this.onAfterChangePage) { + this.onAfterChangePage.call(null, this, index); + } + } + + this.emitter.emit('after-changing-page', tf, index); + } + + /** + * Change rows according to page results drop-down + * TODO: accept a parameter setting the results per page length + */ + + }, { + key: 'changeResultsPerPage', + value: function changeResultsPerPage() { + var tf = this.tf; + + if (!this.isEnabled()) { + return; + } + + this.emitter.emit('before-changing-results-per-page', tf); + + var slcR = this.resultsPerPageSlc; + var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); + this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); + this.startPagingRow = this.pagingLength * slcPagesSelIndex; + + if (!isNaN(this.pagingLength)) { + if (this.startPagingRow >= tf.nbFilterableRows) { + this.startPagingRow = tf.nbFilterableRows - this.pagingLength; + } + this.setPagingInfo(); + + if (this.pageSelectorType === tf.fltTypeSlc) { + var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; + this.pagingSlc.options[slcIndex].selected = true; + } + if (tf.rememberPageLen) { + tf.feature('store').savePageLength(tf.pgLenCookie); + } + } + + this.emitter.emit('after-changing-results-per-page', tf); + } + + /** + * Re-set persisted pagination info + */ + + }, { + key: 'resetValues', + value: function resetValues() { + var tf = this.tf; + if (tf.rememberPageLen) { + this.resetPageLength(tf.pgLenCookie); + } + if (tf.rememberPageNb) { + this.resetPage(tf.pgNbCookie); + } + } + + /** + * Re-set page nb at page re-load + */ + + }, { + key: 'resetPage', + value: function resetPage(name) { + var tf = this.tf; + if (!this.isEnabled()) { + return; + } + this.emitter.emit('before-reset-page', tf); + var pgnb = tf.feature('store').getPageNb(name); + if (pgnb !== '') { + this.changePage(pgnb - 1); + } + this.emitter.emit('after-reset-page', tf, pgnb); + } + + /** + * Re-set page length value at page re-load + */ + + }, { + key: 'resetPageLength', + value: function resetPageLength(name) { + var tf = this.tf; + if (!this.isEnabled()) { + return; + } + this.emitter.emit('before-reset-page-length', tf); + var pglenIndex = tf.feature('store').getPageLength(name); + + if (pglenIndex !== '') { + this.resultsPerPageSlc.options[pglenIndex].selected = true; + this.changeResultsPerPage(); + } + this.emitter.emit('after-reset-page-length', tf, pglenIndex); + } + + /** + * Remove paging feature + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this4 = this; + + var tf = this.tf; + + if (!this.initialized) { + return; + } + // btns containers + var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); + var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); + var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); + var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); + //span containing 'Page' text + var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); + //span containing 'of' text + var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); + //span containing nb of pages + var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); + + var evt = this.evt; + + if (this.pagingSlc) { + if (this.pageSelectorType === tf.fltTypeSlc) { + _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); + } else if (this.pageSelectorType === tf.fltTypeInp) { + _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); + } + _dom2.default.remove(this.pagingSlc); + } + + if (btnNextSpan) { + _event2.default.remove(btnNextSpan, 'click', evt.next); + _dom2.default.remove(btnNextSpan); + } + + if (btnPrevSpan) { + _event2.default.remove(btnPrevSpan, 'click', evt.prev); + _dom2.default.remove(btnPrevSpan); + } + + if (btnLastSpan) { + _event2.default.remove(btnLastSpan, 'click', evt.last); + _dom2.default.remove(btnLastSpan); + } + + if (btnFirstSpan) { + _event2.default.remove(btnFirstSpan, 'click', evt.first); + _dom2.default.remove(btnFirstSpan); + } + + if (pgBeforeSpan) { + _dom2.default.remove(pgBeforeSpan); + } + + if (pgAfterSpan) { + _dom2.default.remove(pgAfterSpan); + } + + if (pgspan) { + _dom2.default.remove(pgspan); + } + + if (this.hasResultsPerPage) { + this.removeResultsPerPage(); + } + + this.emitter.off(['after-filtering'], function () { + return _this4.resetPagingInfo(); + }); + this.emitter.off(['initialized'], function () { + return _this4.resetValues(); + }); + + this.pagingSlc = null; + this.nbPages = 0; + this.disable(); + this.initialized = false; + } + }]); + + return Paging; + })(_feature.Feature); + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.ClearButton = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var ClearButton = exports.ClearButton = (function (_Feature) { + _inherits(ClearButton, _Feature); + + /** + * Clear button component + * @param {Object} tf TableFilter instance + */ + + function ClearButton(tf) { + _classCallCheck(this, ClearButton); + + // Configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); + + var f = _this.config; + + //id of container element + _this.btnResetTgtId = f.btn_reset_target_id || null; + //reset button element + _this.btnResetEl = null; + //defines reset text + _this.btnResetText = f.btn_reset_text || 'Reset'; + //defines reset button tooltip + _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; + //defines reset button innerHtml + _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); + //span containing reset button + _this.prfxResetSpan = 'resetspan_'; + return _this; + } + + _createClass(ClearButton, [{ + key: 'onClick', + value: function onClick() { + if (!this.isEnabled()) { + return; + } + this.tf.clearFilters(); + } + + /** + * Build DOM elements + */ + + }, { + key: 'init', + value: function init() { + var _this2 = this; + + var tf = this.tf; + + if (this.initialized) { + return; + } + + var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); + + // reset button is added to defined element + if (!this.btnResetTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); + targetEl.appendChild(resetspan); + + if (!this.btnResetHtml) { + var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); + fltreset.className = tf.btnResetCssClass; + fltreset.appendChild(_dom2.default.text(this.btnResetText)); + resetspan.appendChild(fltreset); + _event2.default.add(fltreset, 'click', function () { + _this2.onClick(); + }); + } else { + resetspan.innerHTML = this.btnResetHtml; + var resetEl = resetspan.firstChild; + _event2.default.add(resetEl, 'click', function () { + _this2.onClick(); + }); + } + this.btnResetEl = resetspan.firstChild; + + this.initialized = true; + } + + /** + * Remove clear button UI + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + + if (!this.initialized) { + return; + } + + var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); + if (resetspan) { + _dom2.default.remove(resetspan); + } + this.btnResetEl = null; + this.initialized = false; + } + }]); + + return ClearButton; + })(_feature.Feature); + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.Help = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; + var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; + + var Help = exports.Help = (function (_Feature) { + _inherits(Help, _Feature); + + /** + * Help UI component + * @param {Object} tf TableFilter instance + */ + + function Help(tf) { + _classCallCheck(this, Help); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); + + var f = _this.config; + + //id of custom container element for instructions + _this.tgtId = f.help_instructions_target_id || null; + //id of custom container element for instructions + _this.contTgtId = f.help_instructions_container_target_id || null; + //defines help text + _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; + //defines help innerHtml + _this.instrHtml = f.help_instructions_html || null; + //defines reset button text + _this.btnText = f.help_instructions_btn_text || '?'; + //defines reset button innerHtml + _this.btnHtml = f.help_instructions_btn_html || null; + //defines css class for help button + _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; + //defines css class for help container + _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; + //help button element + _this.btn = null; + //help content div + _this.cont = null; + _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; + + //id prefix for help elements + _this.prfxHelpSpan = 'helpSpan_'; + //id prefix for help elements + _this.prfxHelpDiv = 'helpDiv_'; + return _this; + } + + _createClass(Help, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + var tf = this.tf; + + var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); + var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); + + //help button is added to defined element + if (!this.tgtId) { + tf.setToolbar(); + } + var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); + targetEl.appendChild(helpspan); + + var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); + + if (!this.btnHtml) { + divContainer.appendChild(helpdiv); + var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); + helplink.className = this.btnCssClass; + helplink.appendChild(_dom2.default.text(this.btnText)); + helpspan.appendChild(helplink); + _event2.default.add(helplink, 'click', function () { + _this2.toggle(); + }); + } else { + helpspan.innerHTML = this.btnHtml; + var helpEl = helpspan.firstChild; + _event2.default.add(helpEl, 'click', function () { + _this2.toggle(); + }); + divContainer.appendChild(helpdiv); + } + + if (!this.instrHtml) { + helpdiv.innerHTML = this.instrText; + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } else { + if (this.contTgtId) { + divContainer.appendChild(helpdiv); + } + helpdiv.innerHTML = this.instrHtml; + if (!this.contTgtId) { + helpdiv.className = this.contCssClass; + _event2.default.add(helpdiv, 'dblclick', function () { + _this2.toggle(); + }); + } + } + helpdiv.innerHTML += this.defaultHtml; + _event2.default.add(helpdiv, 'click', function () { + _this2.toggle(); + }); + + this.cont = helpdiv; + this.btn = helpspan; + this.initialized = true; + } + + /** + * Toggle help pop-up + */ + + }, { + key: 'toggle', + value: function toggle() { + // check only if explicitily set to false as in this case undefined + // signifies the help feature is enabled by default + if (this.enabled === false) { + return; + } + var divDisplay = this.cont.style.display; + if (divDisplay === '' || divDisplay === 'none') { + this.cont.style.display = 'inline'; + } else { + this.cont.style.display = 'none'; + } + } + + /** + * Remove help UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.initialized) { + return; + } + _dom2.default.remove(this.btn); + this.btn = null; + if (!this.cont) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + this.initialized = false; + } + }]); + + return Help; + })(_feature.Feature); + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.AlternateRows = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var AlternateRows = exports.AlternateRows = (function (_Feature) { + _inherits(AlternateRows, _Feature); + + /** + * Alternating rows color + * @param {Object} tf TableFilter instance + */ + + function AlternateRows(tf) { + _classCallCheck(this, AlternateRows); + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); + + var config = _this.config; + //defines css class for even rows + _this.evenCss = config.even_row_css_class || 'even'; + //defines css class for odd rows + _this.oddCss = config.odd_row_css_class || 'odd'; + return _this; + } + + /** + * Sets alternating rows color + */ + + _createClass(AlternateRows, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + + this.processAll(); + + // Subscribe to events + this.emitter.on(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { + return _this2.processRow(rowIndex, arrIndex, isValid); + }); + this.emitter.on(['column-sorted'], function () { + return _this2.processAll(); + }); + + this.initialized = true; + } + }, { + key: 'processAll', + value: function processAll() { + if (!this.isEnabled()) { + return; + } + var tf = this.tf; + var validRowsIndex = tf.getValidRows(true); + var noValidRowsIndex = validRowsIndex.length === 0; + //1st index + var beginIndex = noValidRowsIndex ? tf.refRow : 0; + // nb indexes + var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; + var idx = 0; + + //alternates bg color + for (var j = beginIndex; j < indexLen; j++) { + var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; + this.setRowBg(rowIdx, idx); + idx++; + } + } + + /** + * Set/remove row background based on row validation + * @param {Number} rowIdx Row index + * @param {Boolean} isValid Valid row flag + */ + + }, { + key: 'processRow', + value: function processRow(rowIdx, arrIdx, isValid) { + if (isValid) { + this.setRowBg(rowIdx, arrIdx); + } else { + this.removeRowBg(rowIdx); + } + } + + /** + * Sets row background color + * @param {Number} rowIdx Row index + * @param {Number} idx Valid rows collection index needed to calculate bg + * color + */ + + }, { + key: 'setRowBg', + value: function setRowBg(rowIdx, idx) { + if (!this.isEnabled() || isNaN(rowIdx)) { + return; + } + var rows = this.tf.tbl.rows; + var i = isNaN(idx) ? rowIdx : idx; + this.removeRowBg(rowIdx); + + _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); + } + + /** + * Removes row background color + * @param {Number} idx Row index + */ + + }, { + key: 'removeRowBg', + value: function removeRowBg(idx) { + if (isNaN(idx)) { + return; + } + var rows = this.tf.tbl.rows; + _dom2.default.removeClass(rows[idx], this.oddCss); + _dom2.default.removeClass(rows[idx], this.evenCss); + } + + /** + * Removes all alternating backgrounds + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { + this.removeRowBg(i); + } + + // Unsubscribe to events + this.emitter.off(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { + return _this3.processRow(rowIndex, arrIndex, isValid); + }); + this.emitter.off(['column-sorted'], function () { + return _this3.processAll(); + }); + + this.initialized = false; + } + }]); + + return AlternateRows; + })(_feature.Feature); + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.NoResults = undefined; + + var _feature = __webpack_require__(12); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var NoResults = exports.NoResults = (function (_Feature) { + _inherits(NoResults, _Feature); + + /** + * No results message UI component + * @param {Object} tf TableFilter instance + */ + + function NoResults(tf) { + _classCallCheck(this, NoResults); + + //configuration object + + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); + + var f = _this.config.no_results_message; + + _this.content = f.content || 'No results'; + _this.customContainer = f.custom_container || null; + _this.customContainerId = f.custom_container_id || null; + _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); + _this.cssClass = f.css_class || 'no-results'; + + _this.cont = null; + + //callback before message is displayed + _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; + //callback after message is displayed + _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; + //callback before message is hidden + _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; + //callback after message is hidden + _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; + + _this.prfxNoResults = 'nores_'; + return _this; + } + + _createClass(NoResults, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this.initialized) { + return; + } + var tf = this.tf; + var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; + + //container + var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); + cont.className = this.cssClass; + cont.innerHTML = this.content; + + if (this.isExternal) { + target.appendChild(cont); + } else { + target.parentNode.insertBefore(cont, target.nextSibling); + } + + this.cont = cont; + + // subscribe to after-filtering event + this.emitter.on(['after-filtering'], function () { + return _this2.toggle(); + }); + + this.initialized = true; + this.hide(); + } + }, { + key: 'toggle', + value: function toggle() { + if (this.tf.nbVisibleRows > 0) { + this.hide(); + } else { + this.show(); + } + } + }, { + key: 'show', + value: function show() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeShowMsg) { + this.onBeforeShowMsg.call(null, this.tf, this); + } + + this.setWidth(); + this.cont.style.display = 'block'; + + if (this.onAfterShowMsg) { + this.onAfterShowMsg.call(null, this.tf, this); + } + } + }, { + key: 'hide', + value: function hide() { + if (!this.initialized || !this.isEnabled()) { + return; + } + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + + this.cont.style.display = 'none'; + + if (this.onBeforeHideMsg) { + this.onBeforeHideMsg.call(null, this.tf, this); + } + } + }, { + key: 'setWidth', + value: function setWidth() { + if (!this.initialized || this.isExternal || !this.isEnabled()) { + return; + } + if (this.tf.gridLayout) { + var gridLayout = this.tf.feature('gridLayout'); + this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; + } else { + this.cont.style.width = this.tf.tbl.clientWidth + 'px'; + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this3 = this; + + if (!this.initialized) { + return; + } + _dom2.default.remove(this.cont); + this.cont = null; + // unsubscribe to after-filtering event + this.emitter.off(['after-filtering'], function () { + return _this3.toggle(); + }); + + this.initialized = false; + } + }]); + + return NoResults; + })(_feature.Feature); + +/***/ } +/******/ ]) +}); +; +//# sourceMappingURL=tablefilter.js.map \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 1a28305f..de8259b2 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,8 +1,2218 @@ -/** - * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-12T06:41:18.898Z - * MIT License - */ +webpackJsonp([1],{ -webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"toggle",value:function(){var e=this._ezEditTable;e.editable?e.Editable.Remove():e.Editable.Set(),e.selection?e.Selection.Remove():e.Selection.Set()}},{key:"destroy",value:function(){var e=this,t=this._ezEditTable;t&&(this.cfg.selection&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return e.toggle()}),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file +/***/ 26: +/***/ function(module, exports, __webpack_require__) { + + var map = { + "./array": 6, + "./array.js": 6, + "./cookie": 4, + "./cookie.js": 4, + "./date": 7, + "./date.js": 7, + "./dom": 2, + "./dom.js": 2, + "./emitter": 9, + "./emitter.js": 9, + "./event": 1, + "./event.js": 1, + "./extensions/advancedGrid/adapterEzEditTable": 27, + "./extensions/advancedGrid/adapterEzEditTable.js": 27, + "./extensions/advancedGrid/advancedGrid": 28, + "./extensions/advancedGrid/advancedGrid.js": 28, + "./extensions/colOps/colOps": 29, + "./extensions/colOps/colOps.js": 29, + "./extensions/colsVisibility/colsVisibility": 30, + "./extensions/colsVisibility/colsVisibility.js": 30, + "./extensions/filtersVisibility/filtersVisibility": 31, + "./extensions/filtersVisibility/filtersVisibility.js": 31, + "./extensions/sort/adapterSortabletable": 32, + "./extensions/sort/adapterSortabletable.js": 32, + "./extensions/sort/sort": 33, + "./extensions/sort/sort.js": 33, + "./helpers": 8, + "./helpers.js": 8, + "./modules/alternateRows": 24, + "./modules/alternateRows.js": 24, + "./modules/checkList": 18, + "./modules/checkList.js": 18, + "./modules/clearButton": 22, + "./modules/clearButton.js": 22, + "./modules/dropdown": 16, + "./modules/dropdown.js": 16, + "./modules/feature": 12, + "./modules/feature.js": 12, + "./modules/gridLayout": 11, + "./modules/gridLayout.js": 11, + "./modules/help": 23, + "./modules/help.js": 23, + "./modules/highlightKeywords": 14, + "./modules/highlightKeywords.js": 14, + "./modules/loader": 13, + "./modules/loader.js": 13, + "./modules/noResults": 25, + "./modules/noResults.js": 25, + "./modules/paging": 21, + "./modules/paging.js": 21, + "./modules/popupFilter": 15, + "./modules/popupFilter.js": 15, + "./modules/rowsCounter": 19, + "./modules/rowsCounter.js": 19, + "./modules/statusBar": 20, + "./modules/statusBar.js": 20, + "./modules/store": 10, + "./modules/store.js": 10, + "./sort": 17, + "./sort.js": 17, + "./string": 3, + "./string.js": 3, + "./types": 5, + "./types.js": 5 + }; + function webpackContext(req) { + return __webpack_require__(webpackContextResolve(req)); + }; + function webpackContextResolve(req) { + return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); + }; + webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); + }; + webpackContext.resolve = webpackContextResolve; + module.exports = webpackContext; + webpackContext.id = 26; + + +/***/ }, + +/***/ 27: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterEzEditTable = (function () { + /** + * Adapter module for ezEditTable, an external library providing advanced + * grid features (selection and edition): + * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus + * + * @param {Object} tf TableFilter instance + */ + + function AdapterEzEditTable(tf, cfg) { + _classCallCheck(this, AdapterEzEditTable); + + // ezEditTable config + this.initialized = false; + this.desc = cfg.description || 'ezEditTable adapter'; + this.filename = cfg.filename || 'ezEditTable.js'; + this.vendorPath = cfg.vendor_path; + this.loadStylesheet = Boolean(cfg.load_stylesheet); + this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; + this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; + this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; + // Enable the ezEditTable's scroll into view behaviour if grid layout on + cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; + + this._ezEditTable = null; + this.cfg = cfg; + this.tf = tf; + this.emitter = tf.emitter; + } + + /** + * Conditionally load ezEditTable library and set advanced grid + * @return {[type]} [description] + */ + + _createClass(AdapterEzEditTable, [{ + key: 'init', + value: function init() { + var _this = this; + + var tf = this.tf; + if (window.EditTable) { + this._setAdvancedGrid(); + } else { + var path = this.vendorPath + this.filename; + tf.import(this.filename, path, function () { + _this._setAdvancedGrid(); + }); + } + if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { + tf.import(this.stylesheetName, this.stylesheet, null, 'link'); + } + + // TODO: hack to prevent ezEditTable enter key event hijaking. + // Needs to be fixed in the vendor's library + this.emitter.on(['filter-focus', 'filter-blur'], function () { + return _this.toggle(); + }); + } + + /** + * Instantiate ezEditTable component for advanced grid features + */ + + }, { + key: '_setAdvancedGrid', + value: function _setAdvancedGrid() { + var tf = this.tf; + + //start row for EditTable constructor needs to be calculated + var startRow, + cfg = this.cfg, + thead = _dom2.default.tag(tf.tbl, 'thead'); + + //if thead exists and startRow not specified, startRow is calculated + //automatically by EditTable + if (thead.length > 0 && !cfg.startRow) { + startRow = undefined; + } + //otherwise startRow config property if any or TableFilter refRow + else { + startRow = cfg.startRow || tf.refRow; + } + + cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; + var editable = cfg.editable; + var selectable = cfg.selection; + + if (selectable) { + cfg.default_selection = cfg.default_selection || 'row'; + } + //CSS Styles + cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; + + var _lastValidRowIndex = 0; + var _lastRowIndex = 0; + + if (selectable) { + //Row navigation needs to be calculated according to TableFilter's + //validRowsIndex array + var onAfterSelection = function onAfterSelection(et, selectedElm, e) { + var slc = et.Selection; + //Next valid filtered row needs to be selected + var doSelect = function doSelect(nextRowIndex) { + if (et.defaultSelection === 'row') { + slc.SelectRowByIndex(nextRowIndex); + } else { + et.ClearSelections(); + var cellIndex = selectedElm.cellIndex, + row = tf.tbl.rows[nextRowIndex]; + if (et.defaultSelection === 'both') { + slc.SelectRowByIndex(nextRowIndex); + } + if (row) { + slc.SelectCell(row.cells[cellIndex]); + } + } + //Table is filtered + if (tf.validRowsIndex.length !== tf.getRowsNb()) { + var r = tf.tbl.rows[nextRowIndex]; + if (r) { + r.scrollIntoView(false); + } + if (cell) { + if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { + tf.tblCont.scrollLeft = 100000000; + } else if (cell.cellIndex === 0 && tf.gridLayout) { + tf.tblCont.scrollLeft = 0; + } else { + cell.scrollIntoView(false); + } + } + } + }; + + //table is not filtered + if (!tf.validRowsIndex) { + return; + } + var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, + nextRowIndex, + paging = tf.feature('paging'), + + //pgup/pgdown keys + d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { + //last row + if (row.rowIndex >= validIndexes[validIdxLen - 1]) { + nextRowIndex = validIndexes[validIdxLen - 1]; + } else { + var calcRowIndex = _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[_lastValidRowIndex - d]; + nextRowIndex = v ? v : validIndexes[0]; + } + } + _lastRowIndex = row.rowIndex; + doSelect(nextRowIndex); + } else { + //If filtered row is valid, special calculation for + //pgup/pgdown keys + if (keyCode !== 34 && keyCode !== 33) { + _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); + _lastRowIndex = row.rowIndex; + } else { + if (keyCode === 34) { + //pgdown + //last row + if (_lastValidRowIndex + d <= validIdxLen - 1) { + nextRowIndex = validIndexes[_lastValidRowIndex + d]; + } else { + nextRowIndex = [validIdxLen - 1]; + } + } else { + //pgup + //first row + if (_lastValidRowIndex - d <= validIndexes[0]) { + nextRowIndex = validIndexes[0]; + } else { + nextRowIndex = validIndexes[_lastValidRowIndex - d]; + } + } + _lastRowIndex = nextRowIndex; + _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); + doSelect(nextRowIndex); + } + } + }; + + //Page navigation has to be enforced whenever selected row is out of + //the current page range + var onBeforeSelection = function onBeforeSelection(et, selectedElm) { + var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; + if (tf.paging) { + if (tf.feature('paging').nbPages > 1) { + var paging = tf.feature('paging'); + //page length is re-assigned in case it has changed + et.nbRowsPerPage = paging.pagingLength; + var validIndexes = tf.validRowsIndex, + validIdxLen = validIndexes.length, + pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); + var rowIndex = row.rowIndex; + + if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { + paging.setPage('last'); + } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { + paging.setPage('first'); + } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { + paging.setPage('next'); + } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { + paging.setPage('previous'); + } + } + } + }; + + //Selected row needs to be visible when paging is activated + if (tf.paging) { + tf.feature('paging').onAfterChangePage = function (paging) { + var advGrid = paging.tf.extension('advancedGrid'); + var et = advGrid._ezEditTable; + var slc = et.Selection; + var row = slc.GetActiveRow(); + if (row) { + row.scrollIntoView(false); + } + var cell = slc.GetActiveCell(); + if (cell) { + cell.scrollIntoView(false); + } + }; + } + + //Rows navigation when rows are filtered is performed with the + //EditTable row selection callback events + if (cfg.default_selection === 'row') { + var fnB = cfg.on_before_selected_row; + cfg.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 = cfg.on_after_selected_row; + cfg.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 = cfg.on_before_selected_cell; + cfg.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 = cfg.on_after_selected_cell; + cfg.on_after_selected_cell = function () { + onAfterSelection(arguments[0], arguments[1], arguments[2]); + if (fnC) { + fnC.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + } + } + if (editable) { + //Added or removed rows, TF rows number needs to be re-calculated + var fnE = cfg.on_added_dom_row; + cfg.on_added_dom_row = function () { + tf.nbFilterableRows++; + if (!tf.paging) { + tf.emitter.emit('rows-changed', tf, this); + //tf.feature('rowsCounter').refresh(); + } else { + tf.nbRows++; + tf.nbVisibleRows++; + tf.nbFilterableRows++; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnE) { + fnE.call(null, arguments[0], arguments[1], arguments[2]); + } + }; + if (cfg.actions && cfg.actions['delete']) { + var fnF = cfg.actions['delete'].on_after_submit; + cfg.actions['delete'].on_after_submit = function () { + tf.nbFilterableRows--; + if (!tf.paging) { + // tf.feature('rowsCounter').refresh(); + tf.emitter.emit('rows-changed', tf, this); + } else { + tf.nbRows--; + tf.nbVisibleRows--; + tf.nbFilterableRows--; + tf.paging = false; + tf.feature('paging').destroy(); + tf.feature('paging').reset(false); + } + if (tf.alternateRows) { + tf.feature('alternateRows').init(); + } + if (fnF) { + fnF.call(null, arguments[0], arguments[1]); + } + }; + } + } + + try { + this._ezEditTable = new EditTable(tf.id, cfg, startRow); + this._ezEditTable.Init(); + } catch (e) { + throw new Error(this.err); + } + + this.initialized = true; + } + + /** + * Reset advanced grid when previously removed + */ + + }, { + key: 'reset', + value: function reset() { + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.Set(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Set(); + } + } + } + + /** + * Toggle behaviour + */ + + }, { + key: 'toggle', + value: function toggle() { + var ezEditTable = this._ezEditTable; + if (ezEditTable.editable) { + ezEditTable.Editable.Remove(); + } else { + ezEditTable.Editable.Set(); + } + if (ezEditTable.selection) { + ezEditTable.Selection.Remove(); + } else { + ezEditTable.Selection.Set(); + } + } + + /** + * Remove advanced grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + var ezEditTable = this._ezEditTable; + if (ezEditTable) { + if (this.cfg.selection) { + ezEditTable.Selection.ClearSelections(); + ezEditTable.Selection.Remove(); + } + if (this.cfg.editable) { + ezEditTable.Editable.Remove(); + } + } + + this.emitter.off(['filter-focus', 'filter-blur'], function () { + return _this2.toggle(); + }); + this.initialized = false; + } + }]); + + return AdapterEzEditTable; + })(); + + exports.default = AdapterEzEditTable; + +/***/ }, + +/***/ 28: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterEzEditTable = __webpack_require__(27); + + var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = _adapterEzEditTable2.default; + +/***/ }, + +/***/ 29: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColOps = (function () { + + /** + * Column calculations + * @param {Object} tf TableFilter instance + */ + + function ColOps(tf, opts) { + _classCallCheck(this, ColOps); + + //calls function before col operation + this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; + //calls function after col operation + this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; + + this.opts = opts; + this.tf = tf; + } + + _createClass(ColOps, [{ + key: 'init', + value: function init() { + var _this = this; + + // subscribe to events + this.tf.emitter.on(['after-filtering'], function () { + return _this.calc(); + }); + + this.calc(); + } + + /** + * Calculates columns' values + * Configuration options are stored in 'opts' property + * - 'id' contains ids of elements showing result (array) + * - 'col' contains the columns' indexes (array) + * - 'operation' contains operation type (array, values: 'sum', 'mean', + * 'min', 'max', 'median', 'q1', 'q3') + * - 'write_method' array defines which method to use for displaying the + * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' + * - 'tot_row_index' defines in which row results are displayed + * (integers array) + * + * - changes made by Nuovella: + * (1) optimized the routine (now it will only process each column once), + * (2) added calculations for the median, lower and upper quartile. + */ + + }, { + key: 'calc', + value: function calc() { + var tf = this.tf; + if (!tf.isFirstLoad && !tf.hasGrid()) { + return; + } + + if (this.onBeforeOperation) { + this.onBeforeOperation.call(null, tf); + } + + var opts = this.opts, + labelId = opts.id, + colIndex = opts.col, + operation = opts.operation, + outputType = opts.write_method, + totRowIndex = opts.tot_row_index, + excludeRow = opts.exclude_row, + decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; + + //nuovella: determine unique list of columns to operate on + var ucolIndex = [], + ucolMax = 0; + ucolIndex[ucolMax] = colIndex[0]; + + for (var ii = 1; ii < colIndex.length; ii++) { + var saved = 0; + //see if colIndex[ii] is already in the list of unique indexes + for (var jj = 0; jj <= ucolMax; jj++) { + if (ucolIndex[jj] === colIndex[ii]) { + saved = 1; + } + } + //if not saved then, save the index; + if (saved === 0) { + ucolMax++; + ucolIndex[ucolMax] = colIndex[ii]; + } + } + + if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { + var rows = tf.tbl.rows, + colvalues = []; + + for (var ucol = 0; ucol <= ucolMax; ucol++) { + //this retrieves col values + //use ucolIndex because we only want to pass through this loop + //once for each column get the values in this unique column + colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); + + //next: calculate all operations for this column + 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; + + for (var k = 0; k < colIndex.length; k++) { + if (colIndex[k] === ucolIndex[ucol]) { + mThisCol++; + opsThisCol[mThisCol] = _string2.default.lower(operation[k]); + decThisCol[mThisCol] = decimalPrecision[k]; + labThisCol[mThisCol] = labelId[k]; + oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; + + switch (opsThisCol[mThisCol]) { + case 'mean': + meanFlag = 1; + break; + case 'sum': + sumFlag = 1; + break; + case 'min': + minFlag = 1; + break; + case 'max': + maxFlag = 1; + break; + case 'median': + medFlag = 1; + break; + case 'q1': + q1Flag = 1; + break; + case 'q3': + q3Flag = 1; + break; + } + } + } + + for (var j = 0; j < colvalues[ucol].length; j++) { + //sort the list for calculation of median and quartiles + if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { + if (j < colvalues[ucol].length - 1) { + for (k = j + 1; k < colvalues[ucol].length; k++) { + if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { + temp = colvalues[ucol][j]; + colvalues[ucol][j] = colvalues[ucol][k]; + colvalues[ucol][k] = temp; + } + } + } + } + var cvalue = parseFloat(colvalues[ucol][j]); + theList[j] = parseFloat(cvalue); + + if (!isNaN(cvalue)) { + nbvalues++; + if (sumFlag === 1 || meanFlag === 1) { + sumValue += parseFloat(cvalue); + } + if (minFlag === 1) { + if (minValue === null) { + minValue = parseFloat(cvalue); + } else { + minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; + } + } + if (maxFlag === 1) { + if (maxValue === null) { + maxValue = parseFloat(cvalue); + } else { + maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; + } + } + } + } //for j + if (meanFlag === 1) { + meanValue = sumValue / nbvalues; + } + if (medFlag === 1) { + var aux = 0; + if (nbvalues % 2 === 1) { + aux = Math.floor(nbvalues / 2); + medValue = theList[aux]; + } else { + medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; + } + } + var posa; + if (q1Flag === 1) { + posa = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa == nbvalues) { + q1Value = (theList[posa - 1] + theList[posa]) / 2; + } else { + q1Value = theList[posa]; + } + } + if (q3Flag === 1) { + posa = 0.0; + var posb = 0.0; + posa = Math.floor(nbvalues / 4); + if (4 * posa === nbvalues) { + posb = 3 * posa; + q3Value = (theList[posb] + theList[posb - 1]) / 2; + } else { + q3Value = theList[nbvalues - posa - 1]; + } + } + + for (var i = 0; i <= mThisCol; i++) { + switch (opsThisCol[i]) { + case 'mean': + result = meanValue; + break; + case 'sum': + result = sumValue; + break; + case 'min': + result = minValue; + break; + case 'max': + result = maxValue; + break; + case 'median': + result = medValue; + break; + case 'q1': + result = q1Value; + break; + case 'q3': + result = q3Value; + break; + } + + var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; + + //if outputType is defined + if (oTypeThisCol && result) { + result = result.toFixed(precision); + + if (_dom2.default.id(labThisCol[i])) { + switch (_string2.default.lower(oTypeThisCol)) { + case 'innerhtml': + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result; + } + break; + case 'setvalue': + _dom2.default.id(labThisCol[i]).value = result; + break; + case 'createtextnode': + var oldnode = _dom2.default.id(labThisCol[i]).firstChild; + var txtnode = _dom2.default.text(result); + _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); + break; + } //switch + } + } else { + try { + if (isNaN(result) || !isFinite(result) || nbvalues === 0) { + _dom2.default.id(labThisCol[i]).innerHTML = '.'; + } else { + _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); + } + } catch (e) {} //catch + } //else + } //for i + + // row(s) with result are always visible + var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; + if (totRow) { + totRow.style.display = ''; + } + } //for ucol + } //if typeof + + if (this.onAfterOperation) { + this.onAfterOperation.call(null, tf); + } + } + }, { + key: 'destroy', + value: function destroy() { + var _this2 = this; + + // unsubscribe to events + this.tf.emitter.off(['after-filtering'], function () { + return _this2.calc(); + }); + } + }]); + + return ColOps; + })(); + + exports.default = ColOps; + +/***/ }, + +/***/ 30: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var ColsVisibility = (function () { + + /** + * Columns Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function ColsVisibility(tf, f) { + _classCallCheck(this, ColsVisibility); + + // Configuration object + var cfg = tf.config(); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Columns visibility manager'; + + //show/hide cols span element + this.spanEl = null; + //show/hide cols button element + this.btnEl = null; + //show/hide cols container div element + this.contEl = null; + + //tick to hide or show column + this.tickToHide = f.tick_to_hide === false ? false : true; + //enables/disables cols manager generation + this.manager = f.manager === false ? false : true; + //only if external headers + this.headersTbl = f.headers_table || false; + //only if external headers + this.headersIndex = f.headers_index || 1; + //id of container element + this.contElTgtId = f.container_target_id || null; + //alternative headers text + this.headersText = f.headers_text || null; + //id of button container element + this.btnTgtId = f.btn_target_id || null; + //defines show/hide cols text + this.btnText = f.btn_text || 'Columns▼'; + //defines show/hide cols button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for show/hide cols button + this.btnCssClass = f.btn_css_class || 'colVis'; + //defines close link text + this.btnCloseText = f.btn_close_text || 'Close'; + //defines close button innerHtml + this.btnCloseHtml = f.btn_close_html || null; + //defines css class for close button + this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; + this.stylesheet = f.stylesheet || 'colsVisibility.css'; + //span containing show/hide cols button + this.prfx = 'colVis_'; + //defines css class span containing show/hide cols + this.spanCssClass = f.span_css_class || 'colVisSpan'; + this.prfxCont = this.prfx + 'Cont_'; + //defines css class div containing show/hide cols + this.contCssClass = f.cont_css_class || 'colVisCont'; + //defines css class for cols list (ul) + this.listCssClass = cfg.list_css_class || 'cols_checklist'; + //defines css class for list item (li) + this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; + //defines css class for selected list item (li) + this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; + //text preceding columns list + this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); + this.atStart = f.at_start || null; + this.enableHover = Boolean(f.enable_hover); + //enables select all option + this.enableTickAll = Boolean(f.enable_tick_all); + //text preceding columns list + this.tickAllText = f.tick_all_text || 'Select all:'; + + //array containing hidden columns indexes + this.hiddenCols = []; + this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; + + //callback invoked just after cols manager is loaded + this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; + //calls function before cols manager is opened + this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; + //calls function after cols manager is opened + this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; + //calls function before cols manager is closed + this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; + //calls function after cols manager is closed + this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; + + //callback before col is hidden + this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; + //callback after col is hidden + this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; + //callback before col is displayed + this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; + //callback after col is displayed + this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; + + //Grid layout compatibility + if (tf.gridLayout) { + this.headersTbl = tf.feature('gridLayout').headTbl; //headers table + this.headersIndex = 0; //headers index + this.onAfterColDisplayed = function () {}; + this.onAfterColHidden = function () {}; + } + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + _createClass(ColsVisibility, [{ + key: 'toggle', + value: function toggle() { + var contDisplay = this.contEl.style.display; + var onBeforeOpen = this.onBeforeOpen; + var onBeforeClose = this.onBeforeClose; + var onAfterOpen = this.onAfterOpen; + var onAfterClose = this.onAfterClose; + + if (onBeforeOpen && contDisplay !== 'inline') { + onBeforeOpen.call(null, this); + } + if (onBeforeClose && contDisplay === 'inline') { + onBeforeClose.call(null, this); + } + + this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; + + if (onAfterOpen && contDisplay !== 'inline') { + onAfterOpen.call(null, this); + } + if (onAfterClose && contDisplay === 'inline') { + onAfterClose.call(null, this); + } + } + }, { + key: 'checkItem', + value: function checkItem(lbl) { + var li = lbl.parentNode; + if (!li || !lbl) { + return; + } + var isChecked = lbl.firstChild.checked; + var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; + colIndex = parseInt(colIndex, 10); + if (isChecked) { + _dom2.default.addClass(li, this.listSlcItemCssClass); + } else { + _dom2.default.removeClass(li, this.listSlcItemCssClass); + } + + var hide = false; + if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { + hide = true; + } + this.setHidden(colIndex, hide); + } + }, { + key: 'init', + value: function init() { + if (!this.manager) { + return; + } + this.buildBtn(); + this.buildManager(); + + this.initialized = true; + } + + /** + * Build main button UI + */ + + }, { + key: 'buildBtn', + value: function buildBtn() { + var _this = this; + + if (this.btnEl) { + return; + } + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.spanCssClass; + + //Container element (rdiv or custom element) + if (!this.btnTgtId) { + tf.setToolbar(); + } + var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); + + if (!this.btnTgtId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + if (!this.btnHtml) { + var btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCssClass; + btn.title = this.desc; + + btn.innerHTML = this.btnText; + span.appendChild(btn); + if (!this.enableHover) { + _event2.default.add(btn, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(btn, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } else { + //Custom html + span.innerHTML = this.btnHtml; + var colVisEl = span.firstChild; + if (!this.enableHover) { + _event2.default.add(colVisEl, 'click', function (evt) { + _this.toggle(evt); + }); + } else { + _event2.default.add(colVisEl, 'mouseover', function (evt) { + _this.toggle(evt); + }); + } + } + + this.spanEl = span; + this.btnEl = this.spanEl.firstChild; + + if (this.onLoaded) { + this.onLoaded.call(null, this); + } + } + + /** + * Build columns manager UI + */ + + }, { + key: 'buildManager', + value: function buildManager() { + var _this2 = this; + + var tf = this.tf; + + var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); + container.className = this.contCssClass; + + //Extension description + var extNameLabel = _dom2.default.create('p'); + extNameLabel.innerHTML = this.text; + container.appendChild(extNameLabel); + + //Headers list + var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); + ul.className = this.listCssClass; + + var tbl = this.headersTbl ? this.headersTbl : tf.tbl; + var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); + var headerRow = tbl.rows[headerIndex]; + + //Tick all option + if (this.enableTickAll) { + var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); + _dom2.default.addClass(li, this.listItemCssClass); + ul.appendChild(li); + li.check.checked = !this.tickToHide; + + _event2.default.add(li.check, 'click', function () { + for (var h = 0; h < headerRow.cells.length; h++) { + var itm = _dom2.default.id('col_' + h + '_' + tf.id); + if (itm && li.check.checked !== itm.checked) { + itm.click(); + itm.checked = li.check.checked; + } + } + }); + } + + for (var i = 0; i < headerRow.cells.length; i++) { + var cell = headerRow.cells[i]; + var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); + var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); + _dom2.default.addClass(liElm, this.listItemCssClass); + if (!this.tickToHide) { + _dom2.default.addClass(liElm, this.listSlcItemCssClass); + } + ul.appendChild(liElm); + if (!this.tickToHide) { + liElm.check.checked = true; + } + + _event2.default.add(liElm.check, 'click', function (evt) { + var elm = _event2.default.target(evt); + var lbl = elm.parentNode; + _this2.checkItem(lbl); + }); + } + + //separator + var p = _dom2.default.create('p', ['align', 'center']); + var btn; + //Close link + if (!this.btnCloseHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:;']); + btn.className = this.btnCloseCssClass; + btn.innerHTML = this.btnCloseText; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + p.appendChild(btn); + } else { + p.innerHTML = this.btnCloseHtml; + btn = p.firstChild; + _event2.default.add(btn, 'click', function (evt) { + _this2.toggle(evt); + }); + } + + container.appendChild(ul); + container.appendChild(p); + + this.btnEl.parentNode.insertBefore(container, this.btnEl); + this.contEl = container; + + if (this.atStart) { + var a = this.atStart; + for (var k = 0; k < a.length; k++) { + var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); + if (itm) { + itm.click(); + } + } + } + } + + /** + * Hide or show specified columns + * @param {Numner} colIndex Column index + * @param {Boolean} hide hide column if true or show if false + */ + + }, { + key: 'setHidden', + value: function setHidden(colIndex, hide) { + var tf = this.tf; + var tbl = tf.tbl; + + if (this.onBeforeColHidden && hide) { + this.onBeforeColHidden.call(null, this, colIndex); + } + if (this.onBeforeColDisplayed && !hide) { + this.onBeforeColDisplayed.call(null, this, colIndex); + } + + this._hideCells(tbl, colIndex, hide); + if (this.headersTbl) { + this._hideCells(this.headersTbl, colIndex, hide); + } + + var hiddenCols = this.hiddenCols; + var itemIndex = hiddenCols.indexOf(colIndex); + if (hide) { + if (itemIndex === -1) { + this.hiddenCols.push(colIndex); + } + } else { + if (itemIndex !== -1) { + this.hiddenCols.splice(itemIndex, 1); + } + } + + var gridLayout; + var headTbl; + var gridColElms; + if (this.onAfterColHidden && hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); + + var headTblW = parseInt(headTbl.style.width, 10); + headTbl.style.width = headTblW - hiddenWidth + 'px'; + tbl.style.width = headTbl.style.width; + } + this.onAfterColHidden.call(null, this, colIndex); + } + + if (this.onAfterColDisplayed && !hide) { + //This event is fired just after a column is displayed for + //grid_layout support + //TODO: grid layout module should be responsible for those + //calculations + if (tf.gridLayout) { + gridLayout = tf.feature('gridLayout'); + headTbl = gridLayout.headTbl; + gridColElms = gridLayout.gridColElms; + var width = parseInt(gridColElms[colIndex].style.width, 10); + headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; + tf.tbl.style.width = headTbl.style.width; + } + this.onAfterColDisplayed.call(null, this, colIndex); + } + } + + /** + * Show specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'showCol', + value: function showCol(colIndex) { + if (colIndex === undefined || !this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, false); + } + } + + /** + * Hide specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'hideCol', + value: function hideCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + return; + } + if (this.manager && this.contEl) { + var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); + if (itm) { + itm.click(); + } + } else { + this.setHidden(colIndex, true); + } + } + + /** + * Determine if specified column is hidden + * @param {Number} colIndex Column index + */ + + }, { + key: 'isColHidden', + value: function isColHidden(colIndex) { + if (this.hiddenCols.indexOf(colIndex) !== -1) { + return true; + } + return false; + } + + /** + * Toggle visibility of specified column + * @param {Number} colIndex Column index + */ + + }, { + key: 'toggleCol', + value: function toggleCol(colIndex) { + if (colIndex === undefined || this.isColHidden(colIndex)) { + this.showCol(colIndex); + } else { + this.hideCol(colIndex); + } + } + + /** + * Returns the indexes of the columns currently hidden + * @return {Array} column indexes + */ + + }, { + key: 'getHiddenCols', + value: function getHiddenCols() { + return this.hiddenCols; + } + + /** + * Remove the columns manager + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + if (_dom2.default.id(this.contElTgtId)) { + _dom2.default.id(this.contElTgtId).innerHTML = ''; + } else { + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + } + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + this.initialized = false; + } + }, { + key: '_getHeaderText', + value: function _getHeaderText(cell) { + if (!cell.hasChildNodes) { + return ''; + } + + for (var i = 0; i < cell.childNodes.length; i++) { + var n = cell.childNodes[i]; + if (n.nodeType === 3) { + return n.nodeValue; + } else if (n.nodeType === 1) { + if (n.id && n.id.indexOf('popUp') !== -1) { + continue; + } else { + return _dom2.default.getText(n); + } + } + continue; + } + return ''; + } + }, { + key: '_hideCells', + value: function _hideCells(tbl, colIndex, hide) { + for (var i = 0; i < tbl.rows.length; i++) { + var row = tbl.rows[i]; + var cell = row.cells[colIndex]; + if (cell) { + cell.style.display = hide ? 'none' : ''; + } + } + } + }]); + + return ColsVisibility; + })(); + + exports.default = ColsVisibility; + +/***/ }, + +/***/ 31: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var FiltersVisibility = (function () { + + /** + * Filters Row Visibility extension + * @param {Object} tf TableFilter instance + * @param {Object} f Config + */ + + function FiltersVisibility(tf, f) { + _classCallCheck(this, FiltersVisibility); + + this.initialized = false; + this.name = f.name; + this.desc = f.description || 'Filters row visibility manager'; + + // Path and image filenames + this.stylesheet = f.stylesheet || 'filtersVisibility.css'; + this.icnExpand = f.expand_icon_name || 'icn_exp.png'; + this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; + + //expand/collapse filters span element + this.contEl = null; + //expand/collapse filters btn element + this.btnEl = null; + + this.icnExpandHtml = 'Expand filters'; + this.icnCollapseHtml = 'Collapse filters'; + this.defaultText = 'Toggle filters'; + + //id of container element + this.targetId = f.target_id || null; + //enables/disables expand/collapse icon + this.enableIcon = f.enable_icon === false ? false : true; + this.btnText = f.btn_text || ''; + + //defines expand/collapse filters text + this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; + this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; + + //defines expand/collapse filters button innerHtml + this.btnHtml = f.btn_html || null; + //defines css class for expand/collapse filters button + this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; + //defines css class span containing expand/collapse filters + this.contCssClass = f.cont_css_class || 'expClpFlt'; + this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); + + this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; + + // Prefix + this.prfx = 'fltsVis_'; + + //callback before filters row is shown + this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; + //callback after filters row is shown + this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; + //callback before filters row is hidden + this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; + //callback after filters row is hidden + this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; + + //Loads extension stylesheet + tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); + + this.tf = tf; + } + + /** + * Initialise extension + */ + + _createClass(FiltersVisibility, [{ + key: 'init', + value: function init() { + if (this.initialized) { + return; + } + + this.buildUI(); + this.initialized = true; + } + + /** + * Build UI elements + */ + + }, { + key: 'buildUI', + value: function buildUI() { + var _this = this; + + var tf = this.tf; + var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); + span.className = this.contCssClass; + + //Container element (rdiv or custom element) + if (!this.targetId) { + tf.setToolbar(); + } + var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); + + if (!this.targetId) { + var firstChild = targetEl.firstChild; + firstChild.parentNode.insertBefore(span, firstChild); + } else { + targetEl.appendChild(span); + } + + var btn = undefined; + if (!this.btnHtml) { + btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); + btn.className = this.btnCssClass; + btn.title = this.btnText || this.defaultText; + btn.innerHTML = this.collapseBtnHtml; + span.appendChild(btn); + } else { + //Custom html + span.innerHTML = this.btnHtml; + btn = span.firstChild; + } + + _event2.default.add(btn, 'click', function () { + return _this.toggle(); + }); + + this.contEl = span; + this.btnEl = btn; + + if (!this.visibleAtStart) { + this.toggle(); + } + } + + /** + * Toggle filters visibility + */ + + }, { + key: 'toggle', + value: function toggle() { + var tf = this.tf; + var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; + var fltRow = tbl.rows[this.filtersRowIndex]; + var fltRowDisplay = fltRow.style.display; + + if (this.onBeforeShow && fltRowDisplay !== '') { + this.onBeforeShow.call(this, this); + } + if (this.onBeforeHide && fltRowDisplay === '') { + this.onBeforeHide.call(null, this); + } + + fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; + if (this.enableIcon && !this.btnHtml) { + this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; + } + + if (this.onAfterShow && fltRowDisplay !== '') { + this.onAfterShow.call(null, this); + } + if (this.onAfterHide && fltRowDisplay === '') { + this.onAfterHide.call(null, this); + } + } + + /** + * Destroy the UI + */ + + }, { + key: 'destroy', + value: function destroy() { + if (!this.btnEl && !this.contEl) { + return; + } + + this.btnEl.innerHTML = ''; + _dom2.default.remove(this.btnEl); + this.btnEl = null; + + this.contEl.innerHTML = ''; + _dom2.default.remove(this.contEl); + this.contEl = null; + this.initialized = false; + } + }]); + + return FiltersVisibility; + })(); + + exports.default = FiltersVisibility; + +/***/ }, + +/***/ 32: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var AdapterSortableTable = (function () { + + /** + * SortableTable Adapter module + * @param {Object} tf TableFilter instance + */ + + function AdapterSortableTable(tf, opts) { + _classCallCheck(this, AdapterSortableTable); + + this.initialized = false; + this.name = opts.name; + this.desc = opts.description || 'Sortable table'; + + //indicates if tables was sorted + this.sorted = false; + + this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; + this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; + this.asyncSort = Boolean(opts.async_sort); + this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; + + // edit .sort-arrow.descending / .sort-arrow.ascending in + // tablefilter.css to reflect any path change + this.imgPath = opts.images_path || tf.themesPath; + this.imgBlank = opts.image_blank || 'blank.png'; + this.imgClassName = opts.image_class_name || 'sort-arrow'; + this.imgAscClassName = opts.image_asc_class_name || 'ascending'; + this.imgDescClassName = opts.image_desc_class_name || 'descending'; + //cell attribute storing custom key + this.customKey = opts.custom_key || 'data-tf-sortKey'; + + // callback invoked after sort is loaded and instanciated + this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; + // callback invoked before table is sorted + this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; + // callback invoked after table is sorted + this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; + + this.tf = tf; + this.emitter = tf.emitter; + } + + _createClass(AdapterSortableTable, [{ + key: 'init', + value: function init() { + var tf = this.tf; + var adpt = this; + + // SortableTable class sanity check (sortabletable.js) + if (_types2.default.isUndef(SortableTable)) { + throw new Error('SortableTable class not found.'); + } + + this.overrideSortableTable(); + this.setSortTypes(); + + //Column sort at start + var sortColAtStart = adpt.sortColAtStart; + if (sortColAtStart) { + this.stt.sort(sortColAtStart[0], sortColAtStart[1]); + } + + if (this.onSortLoaded) { + this.onSortLoaded.call(null, tf, this); + } + + /*** SortableTable callbacks ***/ + this.stt.onbeforesort = function () { + if (adpt.onBeforeSort) { + adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); + } + + /*** sort behaviour for paging ***/ + if (tf.paging) { + tf.feature('paging').disable(); + } + }; + + this.stt.onsort = function () { + adpt.sorted = true; + + //sort behaviour for paging + if (tf.paging) { + var paginator = tf.feature('paging'); + // recalculate valid rows index as sorting may have change it + tf.getValidRows(true); + paginator.enable(); + paginator.setPage(paginator.getPage()); + } + + if (adpt.onAfterSort) { + adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); + } + + adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn); + }; + + this.initialized = true; + } + + /** + * Sort specified column + * @param {Number} colIdx Column index + * @param {Boolean} desc Optional: descending manner + */ + + }, { + key: 'sortByColumnIndex', + value: function sortByColumnIndex(colIdx, desc) { + this.stt.sort(colIdx, desc); + } + }, { + key: 'overrideSortableTable', + value: function overrideSortableTable() { + var adpt = this, + tf = this.tf; + + /** + * Overrides headerOnclick method in order to handle th event + * @param {Object} e [description] + */ + SortableTable.prototype.headerOnclick = function (evt) { + if (!adpt.initialized) { + return; + } + + // find Header element + var el = evt.target || evt.srcElement; + + while (el.tagName !== 'TD' && el.tagName !== 'TH') { + el = el.parentNode; + } + + this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); + }; + + /** + * Overrides getCellIndex IE returns wrong cellIndex when columns are + * hidden + * @param {Object} oTd TD element + * @return {Number} Cell index + */ + SortableTable.getCellIndex = function (oTd) { + var cells = oTd.parentNode.cells, + l = cells.length, + i = undefined; + for (i = 0; cells[i] != oTd && i < l; i++) {} + return i; + }; + + /** + * Overrides initHeader in order to handle filters row position + * @param {Array} oSortTypes + */ + SortableTable.prototype.initHeader = function (oSortTypes) { + var stt = this; + if (!stt.tHead) { + if (tf.gridLayout) { + stt.tHead = tf.feature('gridLayout').headTbl.tHead; + } else { + return; + } + } + + stt.headersRow = tf.headersRow; + var cells = stt.tHead.rows[stt.headersRow].cells; + stt.sortTypes = oSortTypes || []; + var l = cells.length; + var img = undefined, + c = undefined; + + for (var i = 0; i < l; i++) { + c = cells[i]; + if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { + c.style.cursor = 'pointer'; + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + c.appendChild(img); + if (stt.sortTypes[i] !== null) { + c.setAttribute('_sortType', stt.sortTypes[i]); + } + _event2.default.add(c, 'click', stt._headerOnclick); + } else { + c.setAttribute('_sortType', oSortTypes[i]); + c._sortType = 'None'; + } + } + stt.updateHeaderArrows(); + }; + + /** + * Overrides updateHeaderArrows in order to handle arrows indicators + */ + SortableTable.prototype.updateHeaderArrows = function () { + var stt = this; + var cells = undefined, + l = undefined, + img = undefined; + + // external headers + if (adpt.asyncSort && adpt.triggerIds.length > 0) { + var triggers = adpt.triggerIds; + cells = []; + l = triggers.length; + for (var j = 0; j < triggers.length; j++) { + cells.push(_dom2.default.id(triggers[j])); + } + } else { + if (!this.tHead) { + return; + } + cells = stt.tHead.rows[stt.headersRow].cells; + l = cells.length; + } + for (var i = 0; i < l; i++) { + var cellAttr = cells[i].getAttribute('_sortType'); + if (cellAttr !== null && cellAttr !== 'None') { + img = cells[i].lastChild || cells[i]; + if (img.nodeName.toLowerCase() !== 'img') { + img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); + cells[i].appendChild(img); + } + if (i === stt.sortColumn) { + img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); + } else { + img.className = adpt.imgClassName; + } + } + } + }; + + /** + * Overrides getRowValue for custom key value feature + * @param {Object} oRow Row element + * @param {String} sType + * @param {Number} nColumn + * @return {String} + */ + SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { + var stt = this; + // if we have defined a custom getRowValue use that + var sortTypeInfo = stt._sortTypeInfo[sType]; + if (sortTypeInfo && sortTypeInfo.getRowValue) { + return sortTypeInfo.getRowValue(oRow, nColumn); + } + var c = oRow.cells[nColumn]; + var s = SortableTable.getInnerText(c); + return stt.getValueFromString(s, sType); + }; + + /** + * Overrides getInnerText in order to avoid Firefox unexpected sorting + * behaviour with untrimmed text elements + * @param {Object} oNode DOM element + * @return {String} DOM element inner text + */ + SortableTable.getInnerText = function (oNode) { + if (!oNode) { + return; + } + if (oNode.getAttribute(adpt.customKey)) { + return oNode.getAttribute(adpt.customKey); + } else { + return _dom2.default.getText(oNode); + } + }; + } + }, { + key: 'addSortType', + value: function addSortType() { + var args = arguments; + SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); + } + }, { + key: 'setSortTypes', + value: function setSortTypes() { + var _this = this; + + var tf = this.tf, + sortTypes = this.sortTypes, + _sortTypes = []; + + for (var i = 0; i < tf.nbCells; i++) { + var colType = undefined; + + if (sortTypes[i]) { + colType = sortTypes[i].toLowerCase(); + if (colType === 'none') { + colType = 'None'; + } + } else { + // resolve column types + if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { + colType = tf.colNbFormat[i].toLowerCase(); + } else if (tf.hasColDateType && tf.colDateType[i] !== null) { + colType = tf.colDateType[i].toLowerCase() + 'date'; + } else { + colType = 'String'; + } + } + _sortTypes.push(colType); + } + + //Public TF method to add sort type + + //Custom sort types + this.addSortType('number', Number); + this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); + this.addSortType('date', SortableTable.toDate); + this.addSortType('string'); + this.addSortType('us', usNumberConverter); + this.addSortType('eu', euNumberConverter); + this.addSortType('dmydate', dmyDateConverter); + this.addSortType('ymddate', ymdDateConverter); + this.addSortType('mdydate', mdyDateConverter); + this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); + this.addSortType('ipaddress', ipAddress, sortIP); + + this.stt = new SortableTable(tf.tbl, _sortTypes); + + /*** external table headers adapter ***/ + if (this.asyncSort && this.triggerIds.length > 0) { + (function () { + var triggers = _this.triggerIds; + for (var j = 0; j < triggers.length; j++) { + if (triggers[j] === null) { + continue; + } + var trigger = _dom2.default.id(triggers[j]); + if (trigger) { + trigger.style.cursor = 'pointer'; + + _event2.default.add(trigger, 'click', function (evt) { + var elm = evt.target; + if (!_this.tf.sort) { + return; + } + _this.stt.asyncSort(triggers.indexOf(elm.id)); + }); + trigger.setAttribute('_sortType', _sortTypes[j]); + } + } + })(); + } + } + + /** + * Destroy sort + */ + + }, { + key: 'destroy', + value: function destroy() { + var tf = this.tf; + this.sorted = false; + this.initialized = false; + this.stt.destroy(); + + var ids = tf.getFiltersId(); + for (var idx = 0; idx < ids.length; idx++) { + var header = tf.getHeaderElement(idx); + var img = _dom2.default.tag(header, 'img'); + + if (img.length === 1) { + header.removeChild(img[0]); + } + } + } + }]); + + return AdapterSortableTable; + })(); + + //Converters + + exports.default = AdapterSortableTable; + function usNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'us'); + } + function euNumberConverter(s) { + return _helpers2.default.removeNbFormat(s, 'eu'); + } + function dateConverter(s, format) { + return _date2.default.format(s, format); + } + function dmyDateConverter(s) { + return dateConverter(s, 'DMY'); + } + function mdyDateConverter(s) { + return dateConverter(s, 'MDY'); + } + function ymdDateConverter(s) { + return dateConverter(s, 'YMD'); + } + function ddmmmyyyyDateConverter(s) { + return dateConverter(s, 'DDMMMYYYY'); + } + + function ipAddress(value) { + var vals = value.split('.'); + for (var x in vals) { + var val = vals[x]; + while (3 > val.length) { + val = '0' + val; + } + vals[x] = val; + } + return vals.join('.'); + } + + function sortIP(a, b) { + var aa = ipAddress(a.value.toLowerCase()); + var bb = ipAddress(b.value.toLowerCase()); + if (aa == bb) { + return 0; + } else if (aa < bb) { + return -1; + } else { + return 1; + } + } + +/***/ }, + +/***/ 33: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _adapterSortabletable = __webpack_require__(32); + + var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + if (!window.SortableTable) { + __webpack_require__(34); + } // import 'script!sortabletable'; + + exports.default = _adapterSortabletable2.default; + +/***/ }, + +/***/ 34: +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") + +/***/ }, + +/***/ 35: +/***/ function(module, exports) { + + /* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra + */ + module.exports = function(src) { + if (typeof execScript === "function") + execScript(src); + else + eval.call(null, src); + } + +/***/ }, + +/***/ 36: +/***/ function(module, exports) { + + module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" + +/***/ } + +}); +//# sourceMappingURL=tf-1.js.map \ No newline at end of file diff --git a/src/modules/checkList.js b/src/modules/checkList.js index 01cac0e5..19d8183e 100644 --- a/src/modules/checkList.js +++ b/src/modules/checkList.js @@ -47,7 +47,6 @@ export class CheckList extends Feature{ this.excludedOpts = null; } - // TODO: move event here onChange(evt){ let elm = evt.target; let tf = this.tf; diff --git a/src/tablefilter.js b/src/tablefilter.js index 655745f0..5e632337 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -479,19 +479,17 @@ export class TableFilter { let elm = Event.target(e); this.activeFilterId = elm.getAttribute('id'); this.activeFlt = Dom.id(this.activeFilterId); - if(this.popupFilters){ - Event.cancel(e); - Event.stop(e); - } + // if(this.popupFilters){ + // Event.cancel(e); + // Event.stop(e); + // } this.emitter.emit('filter-focus', this); } }; } /** - * Initialise filtering grid bar behaviours and layout - * - * TODO: decompose in smaller methods + * Initialise features and layout */ init(){ if(this._hasGrid){ diff --git a/test/test-disable-filter-onchange.html b/test/test-disable-filter-onchange.html new file mode 100644 index 00000000..e505fdd0 --- /dev/null +++ b/test/test-disable-filter-onchange.html @@ -0,0 +1,78 @@ + + + + + TableFilter disable select filter onchange event + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FromDestinationRoad Distance (km)By Air (hrs)By Rail (hrs)
SydneyAdelaide14121.425.3
SydneyBrisbane9821.516
SydneyCanberra286.64.3
SydneyMelbourne8721.110.5
AdelaidePerth27813.138
AdelaideAlice Springs1533220.25
AdelaideBrisbane20452.1540
+ + + + +
+
+ + \ No newline at end of file diff --git a/test/test-disable-filter-onchange.js b/test/test-disable-filter-onchange.js new file mode 100644 index 00000000..9abfc99a --- /dev/null +++ b/test/test-disable-filter-onchange.js @@ -0,0 +1,40 @@ +(function(win, TableFilter){ + var id = function (id){ return document.getElementById(id); }; + + var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + col_0: 'select', + col_1: 'multiple', + on_change: false + }); + tf.init(); + + module('Sanity checks'); + test('Disable onchange event on select filter', function() { + deepEqual(tf instanceof TableFilter, true, 'TableFilter type'); + deepEqual(tf.onSlcChange, false, 'Onchange event disabled'); + }); + + module('Behaviour'); + test('Cannot filter on selection change', function() { + var flt0 = id(tf.fltIds[0]); + var flt1 = id(tf.fltIds[1]); + var evObj = document.createEvent('HTMLEvents'); + evObj.initEvent('change', true, true); + + tf.setFilterValue(0, 'Sydney'); + flt0.dispatchEvent(evObj); + tf.setFilterValue(1, 'Canberra'); + flt1.dispatchEvent(evObj); + + deepEqual(tf.getValidRows().length, 0, 'Table not filtered'); + deepEqual(tf.nbHiddenRows, 0, 'No hidden rows'); + }); + + module('Tear-down'); + test('TableFilter removed', function() { + tf.destroy(); + deepEqual(tf.hasGrid(), false, 'Filters removed'); + }); + +})(window, TableFilter); From 3db685f0c95a971c8664d73910d1623aeec3574a Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Wed, 13 Jan 2016 17:45:44 +1100 Subject: [PATCH 27/41] Started disconnecting _resetGrid --- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 107 +++++++++--------- src/modules/gridLayout.js | 2 +- src/modules/store.js | 2 +- src/tablefilter.js | 16 ++- test/test-grid-layout.js | 16 +-- 11 files changed, 82 insertions(+), 73 deletions(-) diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 1d7ecdc6..74c990e4 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T03:56:48.756Z + * build date: 2016-01-13T05:45:24.670Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 4916eff5..e949611d 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T03:56:48.756Z + * build date: 2016-01-13T05:45:24.670Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 34f71d8e..26557421 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T03:56:48.756Z + * build date: 2016-01-13T05:45:24.670Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 1ac83aa3..969fa876 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T03:56:48.756Z + * build date: 2016-01-13T05:45:24.670Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 4521b6e3..f96c346d 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T03:56:48.756Z + * build date: 2016-01-13T05:45:24.670Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 17fd2f88..cdc8ae8b 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T03:56:48.756Z + * build date: 2016-01-13T05:45:24.670Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 32402f81..dd46390b 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -676,12 +676,16 @@ return /******/ (function(modules) { // webpackBootstrap } if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { - Mod.store = new _store.Store(this); + if (!Mod.store) { + Mod.store = new _store.Store(this); + } Mod.store.init(); } if (this.gridLayout) { - Mod.gridLayout = new _gridLayout.GridLayout(this); + if (!Mod.gridLayout) { + Mod.gridLayout = new _gridLayout.GridLayout(this); + } Mod.gridLayout.init(); } @@ -708,61 +712,62 @@ return /******/ (function(modules) { // webpackBootstrap if (!this.fltGrid) { this._initNoFilters(); } else { - if (this.isFirstLoad) { - var fltrow = this._insertFiltersRow(); + // if(this.isFirstLoad){ + var fltrow = this._insertFiltersRow(); - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = this.tbl.rows.length; + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.tbl.rows.length; - // Generate filters - for (var i = 0; i < n; i++) { - this.emitter.emit('before-filter-init', this, i); + // Generate filters + for (var i = 0; i < n; i++) { + this.emitter.emit('before-filter-init', this, i); - var fltcell = _dom2.default.create(this.fltCellTag), - col = this.getFilterType(i); + var fltcell = _dom2.default.create(this.fltCellTag), + col = this.getFilterType(i); - if (this.singleSearchFlt) { - fltcell.colSpan = this.nbCells; + if (this.singleSearchFlt) { + fltcell.colSpan = this.nbCells; + } + if (!this.gridLayout) { + fltrow.appendChild(fltcell); + } + inpclass = i == n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass; + + //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 (!Mod.dropdown) { + Mod.dropdown = new _dropdown.Dropdown(this); } - if (!this.gridLayout) { - fltrow.appendChild(fltcell); - } - inpclass = i == n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass; - - //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 (!Mod.dropdown) { - Mod.dropdown = new _dropdown.Dropdown(this); + Mod.dropdown.init(i, this.isExternalFlt, fltcell); + } + // checklist + else if (col === this.fltTypeCheckList) { + if (!Mod.checkList) { + Mod.checkList = new _checkList.CheckList(this); } - Mod.dropdown.init(i, this.isExternalFlt, fltcell); - } - // checklist - else if (col === this.fltTypeCheckList) { - if (!Mod.checkList) { - Mod.checkList = new _checkList.CheckList(this); - } - Mod.checkList.init(i, this.isExternalFlt, fltcell); - } else { - this._buildInputFilter(i, inpclass, fltcell); - } - - // this adds submit button - if (i == n - 1 && this.displayBtn) { - this._buildSubmitButton(i, fltcell); + Mod.checkList.init(i, this.isExternalFlt, fltcell); + } else { + this._buildInputFilter(i, inpclass, fltcell); } - this.emitter.emit('after-filter-init', this, i); - } // for i - } else { - this._resetGrid(); - } //if isFirstLoad + // this adds submit button + if (i == n - 1 && this.displayBtn) { + this._buildSubmitButton(i, fltcell); + } + + this.emitter.emit('after-filter-init', this, i); + } // for i + + // } else { + // this._resetGrid(); + // }//if isFirstLoad } //if this.fltGrid /* Features */ @@ -3652,7 +3657,7 @@ return /******/ (function(modules) { // webpackBootstrap fltValues.push(value); } //adds array size - fltValues.push(tf.fltIds.length); + //fltValues.push(tf.fltIds.length); //writes cookie _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); @@ -3889,7 +3894,7 @@ return /******/ (function(modules) { // webpackBootstrap this.tblMainCont.className = this.gridMainContCssClass; if (this.gridWidth) { this.tblMainCont.style.width = this.gridWidth; - } + }console.log(tbl, tbl.parentNode); tbl.parentNode.insertBefore(this.tblMainCont, tbl); //Table container: div wrapping content table diff --git a/src/modules/gridLayout.js b/src/modules/gridLayout.js index 01b50b67..eb68ca6f 100644 --- a/src/modules/gridLayout.js +++ b/src/modules/gridLayout.js @@ -110,7 +110,7 @@ export class GridLayout extends Feature{ this.tblMainCont.className = this.gridMainContCssClass; if(this.gridWidth){ this.tblMainCont.style.width = this.gridWidth; - } + }console.log(tbl, tbl.parentNode); tbl.parentNode.insertBefore(this.tblMainCont, tbl); //Table container: div wrapping content table diff --git a/src/modules/store.js b/src/modules/store.js index 59ce3b03..5784e81c 100644 --- a/src/modules/store.js +++ b/src/modules/store.js @@ -44,7 +44,7 @@ export class Store{ fltValues.push(value); } //adds array size - fltValues.push(tf.fltIds.length); + //fltValues.push(tf.fltIds.length); //writes cookie Cookie.write( diff --git a/src/tablefilter.js b/src/tablefilter.js index 5e632337..9046f229 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -508,12 +508,16 @@ export class TableFilter { if(this.rememberGridValues || this.rememberPageNb || this.rememberPageLen){ - Mod.store = new Store(this); + if(!Mod.store){ + Mod.store = new Store(this); + } Mod.store.init(); } if(this.gridLayout){ - Mod.gridLayout = new GridLayout(this); + if(!Mod.gridLayout){ + Mod.gridLayout = new GridLayout(this); + } Mod.gridLayout.init(); } @@ -540,7 +544,7 @@ export class TableFilter { if(!this.fltGrid){ this._initNoFilters(); } else { - if(this.isFirstLoad){ + // if(this.isFirstLoad){ let fltrow = this._insertFiltersRow(); this.nbFilterableRows = this.getRowsNb(); @@ -594,9 +598,9 @@ export class TableFilter { this.emitter.emit('after-filter-init', this, i); }// for i - } else { - this._resetGrid(); - }//if isFirstLoad + // } else { + // this._resetGrid(); + // }//if isFirstLoad }//if this.fltGrid diff --git a/test/test-grid-layout.js b/test/test-grid-layout.js index 60130168..2195374e 100644 --- a/test/test-grid-layout.js +++ b/test/test-grid-layout.js @@ -19,11 +19,11 @@ test('GridLayout component', function() { deepEqual(tf.filtersRowIndex, 1, 'Filters row index'); }); -test('Destroy GridLayout component', function() { - gridLayout.destroy(); - deepEqual(gridLayout.tblMainCont, null, 'Main container element removed'); - deepEqual(gridLayout.tblCont, null, 'Main HTML table container element removed'); - deepEqual(gridLayout.headTblCont, null, 'Headers container element removed'); - deepEqual(gridLayout.headTbl, null, 'Headers HTML table element removed'); - notEqual(gridLayout.sourceTblHtml, null, 'Table reference is kept'); -}); +// test('Destroy GridLayout component', function() { +// gridLayout.destroy(); +// deepEqual(gridLayout.tblMainCont, null, 'Main container element removed'); +// deepEqual(gridLayout.tblCont, null, 'Main HTML table container element removed'); +// deepEqual(gridLayout.headTblCont, null, 'Headers container element removed'); +// deepEqual(gridLayout.headTbl, null, 'Headers HTML table element removed'); +// notEqual(gridLayout.sourceTblHtml, null, 'Table reference is kept'); +// }); From ada1374ade4c621d17473ea6aad269553784d73f Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Thu, 14 Jan 2016 19:35:46 +1100 Subject: [PATCH 28/41] Fixed tests for reset feature behaviour unit test (grid-layout, paging) --- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 7764 +---------------- dist/tablefilter/tf-1.js | 2224 +---- src/modules/gridLayout.js | 4 +- src/modules/paging.js | 10 +- src/modules/statusBar.js | 4 +- src/tablefilter.js | 114 +- test/test-grid-layout.js | 23 +- test/test-paging.js | 9 + 14 files changed, 114 insertions(+), 10050 deletions(-) diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 74c990e4..2da7ba1a 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T05:45:24.670Z + * build date: 2016-01-14T08:30:34.837Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index e949611d..55001878 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T05:45:24.670Z + * build date: 2016-01-14T08:30:34.837Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 26557421..3a201200 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T05:45:24.670Z + * build date: 2016-01-14T08:30:34.837Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 969fa876..64278f05 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T05:45:24.670Z + * build date: 2016-01-14T08:30:34.837Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index f96c346d..2a154374 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T05:45:24.670Z + * build date: 2016-01-14T08:30:34.837Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index cdc8ae8b..0560153d 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-13T05:45:24.670Z + * build date: 2016-01-14T08:30:34.837Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index dd46390b..fea33ed3 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,7756 +1,10 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else { - var a = factory(); - for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; - } -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // install a JSONP callback for chunk loading -/******/ var parentJsonpFunction = window["webpackJsonp"]; -/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, callbacks = []; -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(installedChunks[chunkId]) -/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); -/******/ while(callbacks.length) -/******/ callbacks.shift().call(null, __webpack_require__); -/******/ -/******/ }; -/******/ -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // object to store loaded and loading chunks -/******/ // "0" means "already loaded" -/******/ // Array means "loading", array contains callbacks -/******/ var installedChunks = { -/******/ 0:0 -/******/ }; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ // This file contains only the entry chunk. -/******/ // The chunk loading function for additional chunks -/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { -/******/ // "0" is the signal for "already loaded" -/******/ if(installedChunks[chunkId] === 0) -/******/ return callback.call(null, __webpack_require__); -/******/ -/******/ // an array means "currently loading". -/******/ if(installedChunks[chunkId] !== undefined) { -/******/ installedChunks[chunkId].push(callback); -/******/ } else { -/******/ // start chunk loading -/******/ installedChunks[chunkId] = [callback]; -/******/ var head = document.getElementsByTagName('head')[0]; -/******/ var script = document.createElement('script'); -/******/ script.type = 'text/javascript'; -/******/ script.charset = 'utf-8'; -/******/ script.async = true; -/******/ -/******/ script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js"; -/******/ head.appendChild(script); -/******/ } -/******/ }; -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { +/** + * tablefilter v0.1.6 by Max Guglielmi + * build date: 2016-01-14T08:30:34.759Z + * MIT License + */ - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - // Features - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.TableFilter = undefined; - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _cookie = __webpack_require__(4); - - var _cookie2 = _interopRequireDefault(_cookie); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _date = __webpack_require__(7); - - var _date2 = _interopRequireDefault(_date); - - var _helpers = __webpack_require__(8); - - var _helpers2 = _interopRequireDefault(_helpers); - - var _emitter = __webpack_require__(9); - - var _store = __webpack_require__(10); - - var _gridLayout = __webpack_require__(11); - - var _loader = __webpack_require__(13); - - var _highlightKeywords = __webpack_require__(14); - - var _popupFilter = __webpack_require__(15); - - var _dropdown = __webpack_require__(16); - - var _checkList = __webpack_require__(18); - - var _rowsCounter = __webpack_require__(19); - - var _statusBar = __webpack_require__(20); - - var _paging = __webpack_require__(21); - - var _clearButton = __webpack_require__(22); - - var _help = __webpack_require__(23); - - var _alternateRows = __webpack_require__(24); - - var _noResults = __webpack_require__(25); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var global = window, - doc = global.document; - - var TableFilter = exports.TableFilter = (function () { - - /** - * TableFilter object constructor - * requires `table` or `id` arguments, `row` and `configuration` optional - * @param {DOMElement} table Table DOM element - * @param {String} id Table id - * @param {Number} row index indicating the 1st row - * @param {Object} configuration object - */ - - function TableFilter() { - var _this = this; - - _classCallCheck(this, TableFilter); - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - if (args.length === 0) { - return; - } - - this.id = null; - this.version = '0.1.6'; - this.year = new Date().getFullYear(); - this.tbl = null; - this.startRow = null; - this.refRow = null; - this.headersRow = null; - this.cfg = {}; - this.nbFilterableRows = null; - this.nbRows = null; - this.nbCells = null; - this._hasGrid = false; - - // TODO: use for-of with babel plug-in - args.forEach(function (arg) { - // for (let arg of args) { - var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); - if (argtype === 'object' && arg && arg.nodeName === 'TABLE') { - _this.tbl = arg; - _this.id = arg.id || 'tf_' + new Date().getTime() + '_'; - } else if (argtype === 'string') { - _this.id = arg; - _this.tbl = _dom2.default.id(arg); - } else if (argtype === 'number') { - _this.startRow = arg; - } else if (argtype === 'object') { - _this.cfg = arg; - } - // } - }); - - if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) { - throw new Error('Could not instantiate TableFilter: HTML table not found.'); - } - - // configuration object - var f = this.cfg; - - this.emitter = new _emitter.Emitter(); - - //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 || 'tablefilter/'; - - /*** filter types ***/ - this.fltTypeInp = 'input'; - this.fltTypeSlc = 'select'; - this.fltTypeMulti = 'multiple'; - this.fltTypeCheckList = 'checklist'; - this.fltTypeNone = 'none'; - - /*** filters' grid properties ***/ - - //enables/disables filter grid - this.fltGrid = f.grid === false ? false : true; - - //enables/disables grid layout (fixed headers) - this.gridLayout = Boolean(f.grid_layout); - - this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index; - this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index; - - //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 valid rows indexes (rows visible upon filtering) - this.validRowsIndex = []; - //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; - - //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.stylePath = f.style_path || this.basePath + 'style/'; - this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows); - //defines widths of columns - this.hasColWidths = _types2.default.isArray(f.col_widths); - this.colWidths = this.hasColWidths ? f.col_widths : null; - //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'; - - /*** filters' grid behaviours ***/ - //enables/disables enter key - this.enterKey = f.enter_key === false ? false : true; - //calls function before filtering starts - this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null; - //calls function after filtering - this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null; - //enables/disables case sensitivity - this.caseSensitive = Boolean(f.case_sensitive); - //has exact match per column - this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match); - this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : []; - //enables/disbles exact match for search - this.exactMatch = Boolean(f.exact_match); - //refreshes drop-down lists upon validation - this.linkedFilters = Boolean(f.linked_filters); - //wheter excluded options are disabled - this.disableExcludedOptions = Boolean(f.disable_excluded_options); - //stores active filter element - this.activeFlt = null; - //id of active filter - this.activeFilterId = null; - //enables always visible rows - this.hasVisibleRows = Boolean(f.rows_always_visible); - //array containing always visible rows - this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; - //enables/disables external filters generation - this.isExternalFlt = Boolean(f.external_flt_grid); - //array containing ids of external elements containing filters - this.externalFltTgtIds = f.external_flt_grid_ids || []; - //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null; - //enables/disables single filter search - this.singleSearchFlt = Boolean(f.single_filter); - //calls function after row is validated - this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null; - //input watermark text array - this.watermark = f.watermark || ''; - this.isWatermarkArray = _types2.default.isArray(this.watermark); - //id of toolbar container element - this.toolBarTgtId = f.toolbar_target_id || null; - //enables/disables help div - this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions); - //popup filters - this.popupFilters = Boolean(f.popup_filters); - //active columns color - this.markActiveColumns = Boolean(f.mark_active_columns); - //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null; - //calls function after active column header is marked - this.onAfterActiveColumn = _types2.default.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 || 'Clear'; - //enables/disables empty option in combo-box filters - this.enableEmptyOption = Boolean(f.enable_empty_option); - //defines empty option text - this.emptyText = f.empty_text || '(Empty)'; - //enables/disables non empty option in combo-box filters - this.enableNonEmptyOption = Boolean(f.enable_non_empty_option); - //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 = Boolean(f.sort_num_asc); - this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null; - //enables/disables descending numeric options sorting - this.isSortNumDesc = Boolean(f.sort_num_desc); - this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null; - //Select filters are populated on demand - this.loadFltOnDemand = Boolean(f.load_filters_on_demand); - this.hasCustomOptions = _types2.default.isObj(f.custom_options); - this.customOptions = f.custom_options; - - /*** 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 || '^[¥£€$]'; - this.separator = f.separator || ','; - - /*** rows counter ***/ - //show/hides rows counter - this.rowsCounter = Boolean(f.rows_counter); - - /*** status bar ***/ - //show/hides status bar - this.statusBar = Boolean(f.status_bar); - - /*** loader ***/ - //enables/disables loader/spinner indicator - this.loader = Boolean(f.loader); - - /*** validation - reset buttons/links ***/ - //show/hides filter's validation button - this.displayBtn = Boolean(f.btn); - //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 = Boolean(f.btn_reset); - //defines css class for reset button - this.btnResetCssClass = f.btn_reset_css_class || 'reset'; - //callback function before filters are cleared - this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null; - //callback function after filters are cleared - this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null; - - /*** paging ***/ - //enables/disables table paging - this.paging = Boolean(f.paging); - this.nbVisibleRows = 0; //nb visible rows - this.nbHiddenRows = 0; //nb hidden rows - - /*** autofilter on typing ***/ - //enables/disables auto filtering, table is filtered when user stops - //typing - this.autoFilter = Boolean(f.auto_filter); - //onkeyup delay timer (msecs) - this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900; - //typing indicator - this.isUserTyping = null; - this.autoFilterTimer = null; - - /*** keyword highlighting ***/ - //enables/disables keyword highlighting - this.highlightKeywords = Boolean(f.highlight_keywords); - - /*** No results feature ***/ - this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message); - - /*** 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 = _types2.default.isArray(f.col_number_format); - //array containing columns nb formats - this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null; - //enables date type per column - this.hasColDateType = _types2.default.isArray(f.col_date_type); - //array containing columns date type - this.colDateType = this.hasColDateType ? f.col_date_type : null; - - /*** 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_'; - //filter values cookie - this.prfxCookieFltsValues = 'tf_flts_'; - //page nb cookie - this.prfxCookiePageNb = 'tf_pgnb_'; - //page length cookie - this.prfxCookiePageLen = 'tf_pglen_'; - - /*** cookies ***/ - this.hasStoredValues = false; - //remembers filters values on page load - this.rememberGridValues = Boolean(f.remember_grid_values); - //cookie storing filter values - this.fltsValuesCookie = this.prfxCookieFltsValues + this.id; - //remembers page nb on page load - this.rememberPageNb = this.paging && f.remember_page_number; - //cookie storing page nb - this.pgNbCookie = this.prfxCookiePageNb + this.id; - //remembers page length on page load - this.rememberPageLen = this.paging && f.remember_page_length; - //cookie storing page length - this.pgLenCookie = this.prfxCookiePageLen + this.id; - - /*** extensions ***/ - //imports external script - this.extensions = f.extensions; - this.hasExtensions = _types2.default.isArray(this.extensions); - - /*** themes ***/ - this.enableDefaultTheme = Boolean(f.enable_default_theme); - //imports themes - this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes); - this.themes = f.themes || []; - //themes path - this.themesPath = f.themes_path || this.stylePath + 'themes/'; - - // Features registry - this.Mod = {}; - - // Extensions registry - this.ExtRegistry = {}; - - /*** TF events ***/ - this.Evt = { - // Detect key - - detectKey: function detectKey(e) { - if (!this.enterKey) { - return; - } - if (e) { - var key = _event2.default.keyCode(e); - if (key === 13) { - this.filter(); - _event2.default.cancel(e); - _event2.default.stop(e); - } else { - this.isUserTyping = true; - global.clearInterval(this.autoFilterTimer); - this.autoFilterTimer = null; - } - } - }, - - // if auto-filter on, detect user is typing and filter columns - onKeyUp: function onKeyUp(e) { - if (!this.autoFilter) { - return; - } - var key = _event2.default.keyCode(e); - this.isUserTyping = false; - - function filter() { - /*jshint validthis:true */ - global.clearInterval(this.autoFilterTimer); - this.autoFilterTimer = null; - if (!this.isUserTyping) { - this.filter(); - this.isUserTyping = null; - } - } - - if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) { - if (this.autoFilterTimer === null) { - this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay); - } - } else { - global.clearInterval(this.autoFilterTimer); - this.autoFilterTimer = null; - } - }, - - // if auto-filter on, detect user is typing - onKeyDown: function onKeyDown() { - if (!this.autoFilter) { - return; - } - this.isUserTyping = true; - }, - - // if auto-filter on, clear interval on filter blur - onInpBlur: function onInpBlur() { - if (this.autoFilter) { - this.isUserTyping = false; - global.clearInterval(this.autoFilterTimer); - } - this.emitter.emit('filter-blur', this); - }, - - // set focused text-box filter as active - onInpFocus: function onInpFocus(e) { - var elm = _event2.default.target(e); - this.activeFilterId = elm.getAttribute('id'); - this.activeFlt = _dom2.default.id(this.activeFilterId); - // if(this.popupFilters){ - // Event.cancel(e); - // Event.stop(e); - // } - this.emitter.emit('filter-focus', this); - } - }; - } - - /** - * Initialise features and layout - */ - - _createClass(TableFilter, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this._hasGrid) { - return; - } - - var Mod = this.Mod; - var n = this.singleSearchFlt ? 1 : this.nbCells, - inpclass = undefined; - - //loads stylesheet if not imported - this.import(this.stylesheetId, this.stylesheet, null, 'link'); - - //loads theme - if (this.hasThemes) { - this.loadThemes(); - } - - if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { - if (!Mod.store) { - Mod.store = new _store.Store(this); - } - Mod.store.init(); - } - - if (this.gridLayout) { - if (!Mod.gridLayout) { - Mod.gridLayout = new _gridLayout.GridLayout(this); - } - Mod.gridLayout.init(); - } - - if (this.loader) { - if (!Mod.loader) { - Mod.loader = new _loader.Loader(this); - } - Mod.loader.init(); - } - - if (this.highlightKeywords) { - Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this); - Mod.highlightKeyword.init(); - } - - if (this.popupFilters) { - if (!Mod.popupFilter) { - Mod.popupFilter = new _popupFilter.PopupFilter(this); - } - Mod.popupFilter.init(); - } - - //filters grid is not generated - if (!this.fltGrid) { - this._initNoFilters(); - } else { - // if(this.isFirstLoad){ - var fltrow = this._insertFiltersRow(); - - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = this.tbl.rows.length; - - // Generate filters - for (var i = 0; i < n; i++) { - this.emitter.emit('before-filter-init', this, i); - - var fltcell = _dom2.default.create(this.fltCellTag), - col = this.getFilterType(i); - - if (this.singleSearchFlt) { - fltcell.colSpan = this.nbCells; - } - if (!this.gridLayout) { - fltrow.appendChild(fltcell); - } - inpclass = i == n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass; - - //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 (!Mod.dropdown) { - Mod.dropdown = new _dropdown.Dropdown(this); - } - Mod.dropdown.init(i, this.isExternalFlt, fltcell); - } - // checklist - else if (col === this.fltTypeCheckList) { - if (!Mod.checkList) { - Mod.checkList = new _checkList.CheckList(this); - } - Mod.checkList.init(i, this.isExternalFlt, fltcell); - } else { - this._buildInputFilter(i, inpclass, fltcell); - } - - // this adds submit button - if (i == n - 1 && this.displayBtn) { - this._buildSubmitButton(i, fltcell); - } - - this.emitter.emit('after-filter-init', this, i); - } // for i - - // } else { - // this._resetGrid(); - // }//if isFirstLoad - } //if this.fltGrid - - /* Features */ - if (this.hasVisibleRows) { - this.emitter.on(['after-filtering'], function () { - return _this2.enforceVisibility(); - }); - this.enforceVisibility(); - } - if (this.rowsCounter) { - Mod.rowsCounter = new _rowsCounter.RowsCounter(this); - Mod.rowsCounter.init(); - } - if (this.statusBar) { - Mod.statusBar = new _statusBar.StatusBar(this); - Mod.statusBar.init(); - } - if (this.paging || Mod.paging) { - if (!Mod.paging) { - Mod.paging = new _paging.Paging(this); - Mod.paging.init(); - } - Mod.paging.reset(); - } - if (this.btnReset) { - Mod.clearButton = new _clearButton.ClearButton(this); - Mod.clearButton.init(); - } - if (this.help) { - if (!Mod.help) { - Mod.help = new _help.Help(this); - } - Mod.help.init(); - } - if (this.hasColWidths && !this.gridLayout) { - this.setColWidths(); - } - if (this.alternateRows) { - Mod.alternateRows = new _alternateRows.AlternateRows(this); - Mod.alternateRows.init(); - } - if (this.noResults) { - if (!Mod.noResults) { - Mod.noResults = new _noResults.NoResults(this); - } - Mod.noResults.init(); - } - - 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) { - _dom2.default.addClass(this.tbl, this.prfxTf); - } - - /* Loads extensions */ - if (this.hasExtensions) { - this.initExtensions(); - } - - // Subscribe to events - if (this.markActiveColumns) { - this.emitter.on(['before-filtering'], function () { - return _this2.clearActiveColumns(); - }); - this.emitter.on(['cell-processed'], function (tf, colIndex) { - return _this2.markActiveColumn(colIndex); - }); - } - if (this.linkedFilters) { - this.emitter.on(['after-filtering'], function () { - return _this2.linkFilters(); - }); - } - - if (this.onFiltersLoaded) { - this.onFiltersLoaded.call(null, this); - } - - this.emitter.emit('initialized', this); - } - - /** - * Insert filters row at initialization - */ - - }, { - key: '_insertFiltersRow', - value: function _insertFiltersRow() { - if (this.gridLayout) { - return; - } - var fltrow = undefined; - - var thead = _dom2.default.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.headersRow++; - } - - fltrow.className = this.fltsRowCssClass; - - if (this.isExternalFlt) { - fltrow.style.display = 'none'; - } - - this.emitter.emit('filters-row-inserted', this, fltrow); - return fltrow; - } - - /** - * Initialize filtersless table - */ - - }, { - key: '_initNoFilters', - value: function _initNoFilters() { - if (this.fltGrid) { - return; - } - this.refRow = this.refRow > 0 ? this.refRow - 1 : 0; - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = this.nbFilterableRows + this.refRow; - } - - /** - * Build input filter type - * @param {Number} colIndex Column index - * @param {String} cssClass Css class applied to filter - * @param {DOMElement} container Container DOM element - */ - - }, { - key: '_buildInputFilter', - value: function _buildInputFilter(colIndex, cssClass, container) { - var col = this.getFilterType(colIndex); - var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; - var inptype = col === this.fltTypeInp ? 'text' : 'hidden'; - var inp = _dom2.default.create(this.fltTypeInp, ['id', this.prfxFlt + colIndex + '_' + this.id], ['type', inptype], ['ct', colIndex]); - - if (inptype !== 'hidden' && this.watermark) { - inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark); - } - inp.className = cssClass || this.fltCssClass; - _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this)); - - //filter is appended in custom element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(inp); - this.externalFltEls.push(inp); - } else { - container.appendChild(inp); - } - - this.fltIds.push(inp.id); - - _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this)); - _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this)); - _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this)); - _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this)); - } - - /** - * Build submit button - * @param {Number} colIndex Column index - * @param {DOMElement} container Container DOM element - */ - - }, { - key: '_buildSubmitButton', - value: function _buildSubmitButton(colIndex, container) { - var _this3 = this; - - var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; - var btn = _dom2.default.create(this.fltTypeInp, ['id', this.prfxValButton + colIndex + '_' + this.id], ['type', 'button'], ['value', this.btnText]); - btn.className = this.btnCssClass; - - //filter is appended in custom element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(btn); - } else { - container.appendChild(btn); - } - - _event2.default.add(btn, 'click', function () { - return _this3.filter(); - }); - } - - /** - * Return a feature instance for a given name - * @param {String} name Name of the feature - * @return {Object} - */ - - }, { - key: 'feature', - value: function feature(name) { - return this.Mod[name]; - } - - /** - * Initialise all the extensions defined in the configuration object - */ - - }, { - key: 'initExtensions', - value: function initExtensions() { - var exts = this.extensions; - // Set config's publicPath dynamically for Webpack... - __webpack_require__.p = this.basePath; - - this.emitter.emit('before-loading-extensions', this); - for (var i = 0, len = exts.length; i < len; i++) { - var ext = exts[i]; - if (!this.ExtRegistry[ext.name]) { - this.loadExtension(ext); - } - } - this.emitter.emit('after-loading-extensions', this); - } - - /** - * Load an extension module - * @param {Object} ext Extension config object - */ - - }, { - key: 'loadExtension', - value: function loadExtension(ext) { - var _this4 = this; - - if (!ext || !ext.name) { - return; - } - - var name = ext.name; - var path = ext.path; - var modulePath = undefined; - - if (name && path) { - modulePath = ext.path + name; - } else { - name = name.replace('.js', ''); - modulePath = 'extensions/{}/{}'.replace(/{}/g, name); - } - - // Require pattern for Webpack - __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) { - var inst = new mod.default(_this4, ext); - inst.init(); - _this4.ExtRegistry[name] = inst; - }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}); - } - - /** - * Get an extension instance - * @param {String} name Name of the extension - * @return {Object} Extension instance - */ - - }, { - key: 'extension', - value: function extension(name) { - return this.ExtRegistry[name]; - } - - /** - * Check passed extension name exists - * @param {String} name Name of the extension - * @return {Boolean} - */ - - }, { - key: 'hasExtension', - value: function hasExtension(name) { - return !_types2.default.isEmpty(this.ExtRegistry[name]); - } - - /** - * Destroy all the extensions defined in the configuration object - */ - - }, { - key: 'destroyExtensions', - value: function destroyExtensions() { - var exts = this.extensions; - - for (var i = 0, len = exts.length; i < len; i++) { - var ext = exts[i]; - var extInstance = this.ExtRegistry[ext.name]; - if (extInstance) { - extInstance.destroy(); - this.ExtRegistry[ext.name] = null; - } - } - } - - /** - * Load themes defined in the configuration object - */ - - }, { - key: 'loadThemes', - value: function loadThemes() { - var themes = this.themes; - this.emitter.emit('before-loading-themes', this); - - //Default theme config - if (this.enableDefaultTheme) { - var defaultTheme = { name: 'default' }; - this.themes.push(defaultTheme); - } - if (_types2.default.isArray(themes)) { - for (var i = 0, len = themes.length; i < len; i++) { - var theme = themes[i]; - var name = theme.name; - var path = theme.path; - var styleId = this.prfxTf + name; - if (name && !path) { - path = this.themesPath + name + '/' + name + '.css'; - } else if (!name && theme.path) { - name = 'theme{0}'.replace('{0}', i); - } - - if (!this.isImported(path, 'link')) { - this.import(styleId, path, null, 'link'); - } - } - } - - //Some elements need to be overriden for default 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; - - this.emitter.emit('after-loading-themes', this); - } - - /** - * Return stylesheet DOM element for a given theme name - * @return {DOMElement} stylesheet element - */ - - }, { - key: 'getStylesheet', - value: function getStylesheet() { - var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; - - return _dom2.default.id(this.prfxTf + name); - } - - /** - * Destroy filter grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this5 = this; - - if (!this._hasGrid) { - return; - } - var rows = this.tbl.rows, - Mod = this.Mod; - - if (this.isExternalFlt && !this.popupFilters) { - this.removeExternalFlts(); - } - if (this.infDiv) { - this.removeToolbar(); - } - if (this.highlightKeywords) { - Mod.highlightKeyword.unhighlightAll(); - } - if (this.markActiveColumns) { - this.clearActiveColumns(); - this.emitter.off(['before-filtering'], function () { - return _this5.clearActiveColumns(); - }); - this.emitter.off(['cell-processed'], function (tf, colIndex) { - return _this5.markActiveColumn(colIndex); - }); - } - if (this.hasExtensions) { - this.destroyExtensions(); - } - - for (var j = this.refRow; j < this.nbRows; j++) { - // validate row - this.validateRow(j, true); - - //removes alternating colors - if (this.alternateRows) { - Mod.alternateRows.removeRowBg(j); - } - } //for j - - if (this.fltGrid && !this.gridLayout) { - this.fltGridEl = rows[this.filtersRowIndex]; - this.tbl.deleteRow(this.filtersRowIndex); - } - - // Destroy modules - Object.keys(Mod).forEach(function (key) { - var feature = Mod[key]; - if (feature && _types2.default.isFn(feature.destroy)) { - feature.destroy(); - } - }); - - // unsubscribe to events - if (this.hasVisibleRows) { - this.emitter.off(['after-filtering'], function () { - return _this5.enforceVisibility(); - }); - } - if (this.linkedFilters) { - this.emitter.off(['after-filtering'], function () { - return _this5.linkFilters(); - }); - } - - _dom2.default.removeClass(this.tbl, this.prfxTf); - this.nbHiddenRows = 0; - this.validRowsIndex = []; - this.activeFlt = null; - this._hasGrid = false; - } - - /** - * Generate container element for paging, reset button, rows counter etc. - */ - - }, { - key: 'setToolbar', - value: function setToolbar() { - if (this.infDiv) { - return; - } - - /*** container div ***/ - var infdiv = _dom2.default.create('div', ['id', this.prfxInfDiv + this.id]); - infdiv.className = this.infDivCssClass; - - //custom container - if (this.toolBarTgtId) { - _dom2.default.id(this.toolBarTgtId).appendChild(infdiv); - } - //grid-layout - else if (this.gridLayout) { - var gridLayout = this.Mod.gridLayout; - gridLayout.tblMainCont.appendChild(infdiv); - infdiv.className = gridLayout.gridInfDivCssClass; - } - //default location: just above the table - else { - var cont = _dom2.default.create('caption'); - cont.appendChild(infdiv); - this.tbl.insertBefore(cont, this.tbl.firstChild); - } - this.infDiv = _dom2.default.id(this.prfxInfDiv + this.id); - - /*** left div containing rows # displayer ***/ - var ldiv = _dom2.default.create('div', ['id', this.prfxLDiv + this.id]); - ldiv.className = this.lDivCssClass; - infdiv.appendChild(ldiv); - this.lDiv = _dom2.default.id(this.prfxLDiv + this.id); - - /*** right div containing reset button - + nb results per page select ***/ - var rdiv = _dom2.default.create('div', ['id', this.prfxRDiv + this.id]); - rdiv.className = this.rDivCssClass; - infdiv.appendChild(rdiv); - this.rDiv = _dom2.default.id(this.prfxRDiv + this.id); - - /*** mid div containing paging elements ***/ - var mdiv = _dom2.default.create('div', ['id', this.prfxMDiv + this.id]); - mdiv.className = this.mDivCssClass; - infdiv.appendChild(mdiv); - this.mDiv = _dom2.default.id(this.prfxMDiv + this.id); - - // Enable help instructions by default if topbar is generated and not - // explicitely set to false - if (_types2.default.isUndef(this.help)) { - if (!this.Mod.help) { - this.Mod.help = new _help.Help(this); - } - this.Mod.help.init(); - this.help = true; - } - } - - /** - * Remove toolbar container element - */ - - }, { - key: 'removeToolbar', - value: function removeToolbar() { - if (!this.infDiv) { - return; - } - _dom2.default.remove(this.infDiv); - this.infDiv = null; - - var tbl = this.tbl; - var captions = _dom2.default.tag(tbl, 'caption'); - if (captions.length > 0) { - [].forEach.call(captions, function (elm) { - tbl.removeChild(elm); - }); - } - } - - /** - * Remove all the external column filters - */ - - }, { - key: 'removeExternalFlts', - value: function removeExternalFlts() { - if (!this.isExternalFlt) { - return; - } - var ids = this.externalFltTgtIds, - len = ids.length; - for (var ct = 0; ct < len; ct++) { - var externalFltTgtId = ids[ct], - externalFlt = _dom2.default.id(externalFltTgtId); - if (externalFlt) { - externalFlt.innerHTML = ''; - } - } - } - - /** - * Check if given column implements a filter with custom options - * @param {Number} colIndex Column's index - * @return {Boolean} - */ - - }, { - key: 'isCustomOptions', - value: function isCustomOptions(colIndex) { - return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; - } - - /** - * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the - * custom options values and texts - * @param {Number} colIndex Column's index - * @return {Array} - */ - - }, { - key: 'getCustomOptions', - value: function getCustomOptions(colIndex) { - if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { - return; - } - - var customOptions = this.customOptions; - var cols = customOptions.cols; - var optTxt = [], - optArray = []; - var index = cols.indexOf(colIndex); - var slcValues = customOptions.values[index]; - var slcTexts = customOptions.texts[index]; - var slcSort = customOptions.sorts[index]; - - for (var r = 0, len = slcValues.length; r < len; r++) { - optArray.push(slcValues[r]); - if (slcTexts[r]) { - optTxt.push(slcTexts[r]); - } else { - optTxt.push(slcValues[r]); - } - } - if (slcSort) { - optArray.sort(); - optTxt.sort(); - } - return [optArray, optTxt]; - } - - /** - * Reset persisted filter values - */ - - }, { - key: 'resetValues', - value: function resetValues() { - var _this6 = this; - - //only loadFltOnDemand - if (this.rememberGridValues) { - if (this.loadFltOnDemand) { - this._resetGridValues(this.fltsValuesCookie); - } else { - var fltValues = this.Mod.store.getFilterValues(this.fltsValuesCookie); - fltValues.forEach(function (val, idx) { - if (val !== ' ') { - _this6.setFilterValue(idx, val); - } - }); - } - } - this.filter(); - } - - /** - * Reset persisted filter values when load filters on demand feature is - * enabled - * @param {String} name cookie name storing filter values - */ - - }, { - key: '_resetGridValues', - value: function _resetGridValues(name) { - if (!this.loadFltOnDemand) { - return; - } - var fltsValues = this.Mod.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 = undefined, - opt = undefined; - var fltType = this.getFilterType(i); - // if loadFltOnDemand, drop-down needs to contain stored - // value(s) for filtering - if (fltType === this.fltTypeSlc || fltType === this.fltTypeMulti) { - var slc = _dom2.default.id(this.fltIds[i]); - slc.options[0].selected = false; - - //selects - if (slcFltsIndex.indexOf(i) != -1) { - opt = _dom2.default.createOpt(fltsValues[i], fltsValues[i], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - //multiple select - if (multiFltsIndex.indexOf(i) != -1) { - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - opt = _dom2.default.createOpt(s[j], s[j], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - } // if multiFltsIndex - } else if (fltType === this.fltTypeCheckList) { - var checkList = this.Mod.checkList; - var divChk = checkList.checkListDiv[i]; - divChk.title = divChk.innerHTML; - divChk.innerHTML = ''; - - var ul = _dom2.default.create('ul', ['id', this.fltIds[i]], ['colIndex', i]); - ul.className = checkList.checkListCssClass; - - var li0 = _dom2.default.createCheckItem(this.fltIds[i] + '_0', '', this.displayAllText); - li0.className = checkList.checkListItemCssClass; - ul.appendChild(li0); - - divChk.appendChild(ul); - - s = fltsValues[i].split(' ' + this.orOperator + ' '); - for (var j = 0, len = s.length; j < len; j++) { - if (s[j] === '') { - continue; - } - var li = _dom2.default.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; - } - } else if (fltType === this.fltTypeInp) { - this.setFilterValue(i, fltsValues[i]); - } - } //end for - - if (!this.hasStoredValues && this.paging) { - this.Mod.paging.setPagingInfo(); - } - } //end if - } - - /** - * Filter the table by retrieving the data from each cell in every single - * row and comparing it to the search term for current column. A row is - * hidden when all the search terms are not found in inspected row. - * - * TODO: Reduce complexity of this massive method - */ - - }, { - key: 'filter', - value: function filter() { - if (!this.fltGrid || !this._hasGrid && !this.isFirstLoad) { - return; - } - //invoke onbefore callback - if (this.onBeforeFilter) { - this.onBeforeFilter.call(null, this); - } - this.emitter.emit('before-filtering', this); - - var row = this.tbl.rows, - Mod = this.Mod, - hiddenrows = 0; - - this.validRowsIndex = []; - // search args re-init - this.searchArgs = this.getFiltersValue(); - - var numCellData, 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(_string2.default.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(_string2.default.rgxEsc(this.rgxOperator)); - - //keyword highlighting - function highlight(str, ok, cell) { - /*jshint validthis:true */ - if (this.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 = _dom2.default.getText(cell); - } - if (w !== '') { - Mod.highlightKeyword.highlight(cell, w, Mod.highlightKeyword.highlightCssClass); - } - } - } - - //looks for search argument in current row - function hasArg(sA, cellData, j) { - /*jshint validthis:true */ - var occurence = undefined, - removeNbFormat = _helpers2.default.removeNbFormat; - - //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 && _date2.default.isValid(sA.replace(re_l, ''), dtType); - var isLEDate = hasLE && _date2.default.isValid(sA.replace(re_le, ''), dtType); - var isGDate = hasGR && _date2.default.isValid(sA.replace(re_g, ''), dtType); - var isGEDate = hasGE && _date2.default.isValid(sA.replace(re_ge, ''), dtType); - var isDFDate = hasDF && _date2.default.isValid(sA.replace(re_d, ''), dtType); - var isEQDate = hasEQ && _date2.default.isValid(sA.replace(re_eq, ''), dtType); - - var dte1 = undefined, - dte2 = undefined; - //dates - if (_date2.default.isValid(cellData, dtType)) { - dte1 = _date2.default.format(cellData, dtType); - // lower date - if (isLDate) { - dte2 = _date2.default.format(sA.replace(re_l, ''), dtType); - occurence = dte1 < dte2; - } - // lower equal date - else if (isLEDate) { - dte2 = _date2.default.format(sA.replace(re_le, ''), dtType); - occurence = dte1 <= dte2; - } - // greater equal date - else if (isGEDate) { - dte2 = _date2.default.format(sA.replace(re_ge, ''), dtType); - occurence = dte1 >= dte2; - } - // greater date - else if (isGDate) { - dte2 = _date2.default.format(sA.replace(re_g, ''), dtType); - occurence = dte1 > dte2; - } - // different date - else if (isDFDate) { - dte2 = _date2.default.format(sA.replace(re_d, ''), dtType); - occurence = dte1.toString() != dte2.toString(); - } - // equal date - else if (isEQDate) { - dte2 = _date2.default.format(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 = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } else if (_date2.default.isValid(sA, dtType)) { - dte2 = _date2.default.format(sA, dtType); - occurence = dte1.toString() === dte2.toString(); - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } else { - //first numbers need to be formated - if (this.hasColNbFormat && this.colNbFormat[j]) { - numCellData = removeNbFormat(cellData, this.colNbFormat[j]); - nbFormat = this.colNbFormat[j]; - } else { - if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') { - numCellData = removeNbFormat(cellData, 'us'); - nbFormat = 'us'; - } else { - numCellData = removeNbFormat(cellData, 'eu'); - nbFormat = 'eu'; - } - } - - // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, - // rgx:) - // lower equal - if (hasLE) { - occurence = numCellData <= removeNbFormat(sA.replace(re_le, ''), nbFormat); - } - //greater equal - else if (hasGE) { - occurence = numCellData >= removeNbFormat(sA.replace(re_ge, ''), nbFormat); - } - //lower - else if (hasLO) { - occurence = numCellData < removeNbFormat(sA.replace(re_l, ''), nbFormat); - } - //greater - else if (hasGR) { - occurence = numCellData > removeNbFormat(sA.replace(re_g, ''), nbFormat); - } - //different - else if (hasDF) { - occurence = _string2.default.contains(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true; - } - //like - else if (hasLK) { - occurence = _string2.default.contains(sA.replace(re_lk, ''), cellData, false, this.caseSensitive); - } - //equal - else if (hasEQ) { - occurence = _string2.default.contains(sA.replace(re_eq, ''), cellData, true, this.caseSensitive); - } - //starts with - else if (hasST) { - occurence = cellData.indexOf(sA.replace(re_st, '')) === 0 ? true : false; - } - //ends with - else if (hasEN) { - var searchArg = sA.replace(re_en, ''); - occurence = cellData.lastIndexOf(searchArg, cellData.length - 1) === cellData.length - 1 - (searchArg.length - 1) && cellData.lastIndexOf(searchArg, cellData.length - 1) > -1 ? true : false; - } - //empty - else if (hasEM) { - occurence = _string2.default.isEmpty(cellData); - } - //non-empty - else if (hasNM) { - occurence = !_string2.default.isEmpty(cellData); - } - //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(cellData); - } catch (e) { - occurence = false; - } - } else { - occurence = _string2.default.contains(sA, cellData, this.isExactMatch(j), this.caseSensitive); - } - } //else - return occurence; - } //fn - - for (var k = this.refRow; k < this.nbRows; k++) { - /*** if table already filtered some rows are not visible ***/ - if (this.getRowDisplay(row[k]) === '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 = true, - - //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]; - var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; - if (sA === '') { - continue; - } - - var cellData = _string2.default.matchCase(this.getCellData(cell[j]), this.caseSensitive); - - //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 = undefined, - occur = false, - s = hasMultiOrSA ? sAOrSplit : sAAndSplit; - for (var w = 0, len = s.length; w < len; w++) { - cS = _string2.default.trim(s[w]); - occur = hasArg.call(this, cS, cellData, j); - highlight.call(this, cS, occur, cell[j]); - if (hasMultiOrSA && occur) { - break; - } - if (hasMultiAndSA && !occur) { - break; - } - } - occurence[j] = occur; - } - //single search parameter - else { - occurence[j] = hasArg.call(this, _string2.default.trim(sA), cellData, j); - highlight.call(this, sA, occurence[j], cell[j]); - } //else single param - - if (!occurence[j]) { - isRowValid = false; - } - if (this.singleSearchFlt && occurence[j]) { - singleFltRowValid = true; - } - - this.emitter.emit('cell-processed', this, j, cell[j]); - } //for j - - if (this.singleSearchFlt && singleFltRowValid) { - isRowValid = true; - } - - if (!isRowValid) { - this.validateRow(k, false); - hiddenrows++; - } else { - this.validateRow(k, true); - } - - this.emitter.emit('row-processed', this, k, this.validRowsIndex.length, isRowValid); - } // for k - - this.nbVisibleRows = this.validRowsIndex.length; - this.nbHiddenRows = hiddenrows; - - //invokes onafterfilter callback - if (this.onAfterFilter) { - this.onAfterFilter.call(null, this); - } - - this.emitter.emit('after-filtering', this); - } - - /** - * Return the data of a specified colum - * @param {Number} colIndex Column index - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} num Optional: return unformatted number - * @param {Array} exclude Optional: list of row indexes to be excluded - * @return {Array} Flat list of data for a column - */ - - }, { - key: 'getColValues', - value: function getColValues(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var num = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var exclude = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3]; - - if (!this.fltGrid) { - return; - } - var row = this.tbl.rows, - colValues = []; - - if (includeHeaders) { - colValues.push(this.getHeadersText()[colIndex]); - } - - for (var i = this.refRow; i < this.nbRows; i++) { - var isExludedRow = false; - // checks if current row index appears in exclude array - if (exclude.length > 0) { - isExludedRow = exclude.indexOf(i) != -1; - } - 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 !== '') { - continue; - } - var cellData = this.getCellData(cell[j]), - nbFormat = this.colNbFormat ? this.colNbFormat[colIndex] : null, - data = num ? _helpers2.default.removeNbFormat(cellData, nbFormat) : cellData; - colValues.push(data); - } - } - } - return colValues; - } - - /** - * Return the filter's value of a specified column - * @param {Number} index Column index - * @return {String} Filter value - */ - - }, { - key: 'getFilterValue', - value: function getFilterValue(index) { - if (!this.fltGrid) { - return; - } - var fltValue = undefined, - flt = this.getFilterElement(index); - if (!flt) { - return ''; - } - - var fltColType = this.getFilterType(index); - if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { - fltValue = flt.value; - } - //mutiple select - else if (fltColType === this.fltTypeMulti) { - fltValue = ''; - for (var j = 0, len = flt.options.length; j < len; 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; - } - - /** - * Return the filters' values - * @return {Array} List of filters' values - */ - - }, { - key: 'getFiltersValue', - value: function getFiltersValue() { - if (!this.fltGrid) { - return; - } - var searchArgs = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - searchArgs.push(_string2.default.trim(_string2.default.matchCase(this.getFilterValue(i), this.caseSensitive))); - } - return searchArgs; - } - - /** - * Return the ID of the filter of a specified column - * @param {Number} index Column's index - * @return {String} ID of the filter element - */ - - }, { - key: 'getFilterId', - value: function getFilterId(index) { - if (!this.fltGrid) { - return; - } - return this.fltIds[index]; - } - - /** - * Return the list of ids of filters matching a specified type. - * Note: hidden filters are also returned - * - * @param {String} type Filter type string ('input', 'select', 'multiple', - * 'checklist') - * @param {Boolean} bool If true returns columns indexes instead of IDs - * @return {[type]} List of element IDs or column indexes - */ - - }, { - key: 'getFiltersByType', - value: function getFiltersByType(type, bool) { - if (!this.fltGrid) { - return; - } - var arr = []; - for (var i = 0, len = this.fltIds.length; i < len; i++) { - var fltType = this.getFilterType(i); - if (fltType === _string2.default.lower(type)) { - var a = bool ? i : this.fltIds[i]; - arr.push(a); - } - } - return arr; - } - - /** - * Return the filter's DOM element for a given column - * @param {Number} index Column's index - * @return {DOMElement} - */ - - }, { - key: 'getFilterElement', - value: function getFilterElement(index) { - var fltId = this.fltIds[index]; - return _dom2.default.id(fltId); - } - - /** - * Return the number of cells for a given row index - * @param {Number} rowIndex Index of the row - * @return {Number} Number of cells - */ - - }, { - key: 'getCellsNb', - value: function getCellsNb() { - var rowIndex = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; - - var tr = this.tbl.rows[rowIndex]; - return tr.cells.length; - } - - /** - * Return the number of filterable rows starting from reference row if - * defined - * @param {Boolean} includeHeaders Include the headers row - * @return {Number} Number of filterable rows - */ - - }, { - key: 'getRowsNb', - value: function getRowsNb(includeHeaders) { - var s = _types2.default.isUndef(this.refRow) ? 0 : this.refRow, - ntrs = this.tbl.rows.length; - if (includeHeaders) { - s = 0; - } - return parseInt(ntrs - s, 10); - } - - /** - * Return the data of a given cell - * @param {DOMElement} cell Cell's DOM object - * @return {String} - */ - - }, { - key: 'getCellData', - value: function getCellData(cell) { - var idx = cell.cellIndex; - //Check for customCellData callback - if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) { - return this.customCellData.call(null, this, cell, idx); - } else { - return _dom2.default.getText(cell); - } - } - - /** - * Return the table data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getTableData', - value: function getTableData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - var rows = this.tbl.rows; - var tblData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - tblData.push([this.getHeadersRowIndex(), headers]); - } - for (var k = this.refRow; k < this.nbRows; k++) { - var rowData = [k, []]; - var cells = rows[k].cells; - for (var j = 0, len = cells.length; j < len; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var cellData = this.getCellData(cells[j]); - rowData[1].push(cellData); - } - tblData.push(rowData); - } - return tblData; - } - - /** - * Return the filtered data with following format: - * [ - * [rowIndex, [value0, value1...]], - * [rowIndex, [value0, value1...]] - * ] - * @param {Boolean} includeHeaders Optional: include headers row - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredData', - value: function getFilteredData() { - var includeHeaders = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - var excludeHiddenCols = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (!this.validRowsIndex) { - return []; - } - var rows = this.tbl.rows, - filteredData = []; - if (includeHeaders) { - var headers = this.getHeadersText(excludeHiddenCols); - filteredData.push([this.getHeadersRowIndex(), headers]); - } - - var validRows = this.getValidRows(true); - for (var i = 0; i < validRows.length; i++) { - var rData = [this.validRowsIndex[i], []], - cells = rows[this.validRowsIndex[i]].cells; - for (var k = 0; k < cells.length; k++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(k)) { - continue; - } - } - var cellData = this.getCellData(cells[k]); - rData[1].push(cellData); - } - filteredData.push(rData); - } - return filteredData; - } - - /** - * Return the filtered data for a given column index - * @param {Number} colIndex Colmun's index - * @param {Boolean} includeHeaders Optional: include headers row - * @return {Array} Flat list of values ['val0','val1','val2'...] - * - * TODO: provide an API returning data in JSON format - */ - - }, { - key: 'getFilteredDataCol', - value: function getFilteredDataCol(colIndex) { - var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - if (_types2.default.isUndef(colIndex)) { - return []; - } - var data = this.getFilteredData(), - colData = []; - if (includeHeaders) { - colData.push(this.getHeadersText()[colIndex]); - } - for (var i = 0, len = data.length; i < len; 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; - } - - /** - * Get the display value of a row - * @param {RowElement} DOM element of the row - * @return {String} Usually 'none' or '' - */ - - }, { - key: 'getRowDisplay', - value: function getRowDisplay(row) { - if (!_types2.default.isObj(row)) { - return null; - } - return row.style.display; - } - - /** - * Validate/invalidate row by setting the 'validRow' attribute on the row - * @param {Number} rowIndex Index of the row - * @param {Boolean} isValid - */ - - }, { - key: 'validateRow', - value: function validateRow(rowIndex, isValid) { - var row = this.tbl.rows[rowIndex]; - if (!row || typeof isValid !== 'boolean') { - return; - } - - // always visible rows are valid - if (this.hasVisibleRows && this.visibleRows.indexOf(rowIndex) !== -1) { - isValid = true; - } - - var displayFlag = isValid ? '' : 'none', - validFlag = isValid ? 'true' : 'false'; - row.style.display = displayFlag; - - if (this.paging) { - row.setAttribute('validRow', validFlag); - } - - if (isValid) { - if (this.validRowsIndex.indexOf(rowIndex) === -1) { - this.validRowsIndex.push(rowIndex); - } - - if (this.onRowValidated) { - this.onRowValidated.call(null, this, rowIndex); - } - - this.emitter.emit('row-validated', this, rowIndex); - } - } - - /** - * Validate all filterable rows - */ - - }, { - key: 'validateAllRows', - value: function validateAllRows() { - if (!this._hasGrid) { - return; - } - this.validRowsIndex = []; - for (var k = this.refRow; k < this.nbFilterableRows; k++) { - this.validateRow(k, true); - } - } - - /** - * Set search value to a given filter - * @param {Number} index Column's index - * @param {String} searcharg Search term - */ - - }, { - key: 'setFilterValue', - value: function setFilterValue(index) { - var searcharg = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; - - if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) { - return; - } - var slc = this.getFilterElement(index), - fltColType = this.getFilterType(index); - - if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { - slc.value = searcharg; - } - //multiple selects - else if (fltColType === this.fltTypeMulti) { - var s = searcharg.split(' ' + this.orOperator + ' '); - // let ct = 0; //keywords counter - for (var j = 0, len = slc.options.length; j < len; j++) { - var option = slc.options[j]; - if (s === '' || s[0] === '') { - option.selected = false; - } - if (option.value === '') { - option.selected = false; - } - if (option.value !== '' && _array2.default.has(s, option.value, true)) { - option.selected = true; - } //if - } //for j - } - //checklist - else if (fltColType === this.fltTypeCheckList) { - searcharg = _string2.default.matchCase(searcharg, this.caseSensitive); - var sarg = searcharg.split(' ' + this.orOperator + ' '); - var lisNb = _dom2.default.tag(slc, 'li').length; - - slc.setAttribute('value', ''); - slc.setAttribute('indexes', ''); - - for (var k = 0; k < lisNb; k++) { - var li = _dom2.default.tag(slc, 'li')[k], - lbl = _dom2.default.tag(li, 'label')[0], - chk = _dom2.default.tag(li, 'input')[0], - lblTxt = _string2.default.matchCase(_dom2.default.getText(lbl), this.caseSensitive); - if (lblTxt !== '' && _array2.default.has(sarg, lblTxt, true)) { - chk.checked = true; - this.Mod.checkList.setCheckListValues(chk); - } else { - chk.checked = false; - this.Mod.checkList.setCheckListValues(chk); - } - } - } - } - - /** - * Set them columns' widths as per configuration - * @param {Number} rowIndex Optional row index to apply the widths to - * @param {Element} tbl DOM element - */ - - }, { - key: 'setColWidths', - value: function setColWidths(rowIndex, tbl) { - if (!this.fltGrid || !this.hasColWidths) { - return; - } - tbl = tbl || this.tbl; - var rIndex = undefined; - if (rowIndex === undefined) { - rIndex = tbl.rows[0].style.display != 'none' ? 0 : 1; - } else { - rIndex = rowIndex; - } - - setWidths.call(this); - - function setWidths() { - /*jshint validthis:true */ - var nbCols = this.nbCells; - var colWidths = this.colWidths; - var colTags = _dom2.default.tag(tbl, 'col'); - var tblHasColTag = colTags.length > 0; - var frag = !tblHasColTag ? doc.createDocumentFragment() : null; - for (var k = 0; k < nbCols; k++) { - var col = undefined; - if (tblHasColTag) { - col = colTags[k]; - } else { - col = _dom2.default.create('col', ['id', this.id + '_col_' + k]); - frag.appendChild(col); - } - col.style.width = colWidths[k]; - } - if (!tblHasColTag) { - tbl.insertBefore(frag, tbl.firstChild); - } - } - } - - /** - * Makes defined rows always visible - */ - - }, { - key: 'enforceVisibility', - value: function enforceVisibility() { - if (!this.hasVisibleRows) { - return; - } - for (var i = 0, len = this.visibleRows.length; i < len; i++) { - var row = this.visibleRows[i]; - //row index cannot be > nrows - if (row <= this.nbRows) { - this.validateRow(row, true); - } - } - } - - /** - * Clear all the filters' values - */ - - }, { - key: 'clearFilters', - value: function clearFilters() { - if (!this.fltGrid) { - return; - } - - this.emitter.emit('before-clearing-filters', this); - - if (this.onBeforeReset) { - this.onBeforeReset.call(null, this, this.getFiltersValue()); - } - for (var i = 0, len = this.fltIds.length; i < len; i++) { - this.setFilterValue(i, ''); - } - // if(this.linkedFilters){ - // this.linkFilters(); - // } - if (this.rememberPageLen) { - _cookie2.default.remove(this.pgLenCookie); - } - if (this.rememberPageNb) { - _cookie2.default.remove(this.pgNbCookie); - } - if (this.onAfterReset) { - this.onAfterReset.call(null, this); - } - - this.filter(); - - this.emitter.emit('after-clearing-filters', this); - } - - /** - * Clears filtered columns visual indicator (background color) - */ - - }, { - key: 'clearActiveColumns', - value: function clearActiveColumns() { - for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) { - _dom2.default.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); - } - } - - /** - * Mark currently filtered column - * @param {Number} colIndex Column index - */ - - }, { - key: 'markActiveColumn', - value: function markActiveColumn(colIndex) { - var header = this.getHeaderElement(colIndex); - if (_dom2.default.hasClass(header, this.activeColumnsCssClass)) { - return; - } - if (this.onBeforeActiveColumn) { - this.onBeforeActiveColumn.call(null, this, colIndex); - } - _dom2.default.addClass(header, this.activeColumnsCssClass); - if (this.onAfterActiveColumn) { - this.onAfterActiveColumn.call(null, this, colIndex); - } - } - - /** - * Refresh the filters subject to linking ('select', 'multiple', - * 'checklist' type) - */ - - }, { - key: 'linkFilters', - value: function linkFilters() { - if (!this.linkedFilters || !this.activeFilterId) { - return; - } - 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); - - var activeFlt = this.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(this.prfxFlt)[1]; - var slcSelectedValue = undefined; - for (var i = 0, len = slcIndex.length; i < len; i++) { - var curSlc = _dom2.default.id(this.fltIds[slcIndex[i]]); - slcSelectedValue = this.getFilterValue(slcIndex[i]); - - // Welcome to cyclomatic complexity hell :) - // TODO: simplify/refactor if statement - if (activeFlt !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) != -1 && activeFlt === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) != -1 || slcA2.indexOf(slcIndex[i]) != -1) || slcSelectedValue === this.displayAllText) { - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.checkListDiv[slcIndex[i]].innerHTML = ''; - } else { - curSlc.innerHTML = ''; - } - - //1st option needs to be inserted - if (this.loadFltOnDemand) { - var opt0 = _dom2.default.createOpt(this.displayAllText, ''); - if (curSlc) { - curSlc.appendChild(opt0); - } - } - - if (slcA3.indexOf(slcIndex[i]) != -1) { - this.Mod.checkList.build(slcIndex[i]); - } else { - this.Mod.dropdown.build(slcIndex[i], true); - } - - this.setFilterValue(slcIndex[i], slcSelectedValue); - } - } // for i - } - - /** - * Re-generate the filters grid bar when previously removed - */ - - }, { - key: '_resetGrid', - value: function _resetGrid() { - if (this.isFirstLoad) { - return; - } - - var Mod = this.Mod; - var tbl = this.tbl; - var rows = tbl.rows; - var filtersRowIndex = this.filtersRowIndex; - var filtersRow = rows[filtersRowIndex]; - - // grid was removed, grid row element is stored in fltGridEl property - if (!this.gridLayout) { - // If table has a thead ensure the filters row is appended in the - // thead element - if (tbl.tHead) { - var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); - tbl.tHead.replaceChild(this.fltGridEl, tempRow); - } else { - filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); - } - - _dom2.default.addClass(tbl, this.prfxTf); - } - - // filters are appended in external placeholders elements - if (this.isExternalFlt) { - var externalFltTgtIds = this.externalFltTgtIds; - for (var ct = 0, len = externalFltTgtIds.length; ct < len; ct++) { - var extFlt = _dom2.default.id(externalFltTgtIds[ct]); - - if (!extFlt) { - continue; - } - - var externalFltEl = this.externalFltEls[ct]; - extFlt.appendChild(externalFltEl); - var colFltType = this.getFilterType(ct); - //IE special treatment for gridLayout, appended filters are - //empty - if (this.gridLayout && externalFltEl.innerHTML === '' && colFltType !== this.fltTypeInp) { - if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { - Mod.dropdown.build(ct); - } - if (colFltType === this.fltTypeCheckList) { - Mod.checkList.build(ct); - } - } - } - } - - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = rows.length; - - if (this.popupFilters) { - this.headersRow++; - Mod.popupFilter.reset(); - } - - this._hasGrid = true; - } - - /** - * Determines if passed filter column implements exact query match - * @param {Number} colIndex [description] - * @return {Boolean} [description] - */ - - }, { - key: 'isExactMatch', - value: function isExactMatch(colIndex) { - var fltType = this.getFilterType(colIndex); - return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== this.fltTypeInp; - } - - /** - * Check if passed script or stylesheet is already imported - * @param {String} filePath Ressource path - * @param {String} type Possible values: 'script' or 'link' - * @return {Boolean} - */ - - }, { - key: 'isImported', - value: function isImported(filePath, type) { - var imported = false, - importType = !type ? 'script' : type, - attr = importType == 'script' ? 'src' : 'href', - files = _dom2.default.tag(doc, importType); - for (var i = 0, len = files.length; i < len; i++) { - if (files[i][attr] === undefined) { - continue; - } - if (files[i][attr].match(filePath)) { - imported = true; - break; - } - } - return imported; - } - - /** - * Import script or stylesheet - * @param {String} fileId Ressource ID - * @param {String} filePath Ressource path - * @param {Function} callback Callback - * @param {String} type Possible values: 'script' or 'link' - */ - - }, { - key: 'import', - value: function _import(fileId, filePath, callback, type) { - var ftype = !type ? 'script' : type, - imported = this.isImported(filePath, ftype); - if (imported) { - return; - } - var o = this, - isLoaded = false, - file = undefined, - head = _dom2.default.tag(doc, 'head')[0]; - - if (_string2.default.lower(ftype) === 'link') { - file = _dom2.default.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]); - } else { - file = _dom2.default.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: ' + filePath); - }; - head.appendChild(file); - } - - /** - * Check if table has filters grid - * @return {Boolean} - */ - - }, { - key: 'hasGrid', - value: function hasGrid() { - return this._hasGrid; - } - - /** - * Get list of filter IDs - * @return {[type]} [description] - */ - - }, { - key: 'getFiltersId', - value: function getFiltersId() { - return this.fltIds || []; - } - - /** - * Get filtered (valid) rows indexes - * @param {Boolean} reCalc Force calculation of filtered rows list - * @return {Array} List of row indexes - */ - - }, { - key: 'getValidRows', - value: function getValidRows(reCalc) { - 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; - } - - /** - * Get the index of the row containing the filters - * @return {Number} - */ - - }, { - key: 'getFiltersRowIndex', - value: function getFiltersRowIndex() { - return this.filtersRowIndex; - } - - /** - * Get the index of the headers row - * @return {Number} - */ - - }, { - key: 'getHeadersRowIndex', - value: function getHeadersRowIndex() { - return this.headersRow; - } - - /** - * Get the row index from where the filtering process start (1st filterable - * row) - * @return {Number} - */ - - }, { - key: 'getStartRowIndex', - value: function getStartRowIndex() { - return this.refRow; - } - - /** - * Get the index of the last row - * @return {Number} - */ - - }, { - key: 'getLastRowIndex', - value: function getLastRowIndex() { - if (!this._hasGrid) { - return; - } - return this.nbRows - 1; - } - - /** - * Get the header DOM element for a given column index - * @param {Number} colIndex Column index - * @return {Object} - */ - - }, { - key: 'getHeaderElement', - value: function getHeaderElement(colIndex) { - var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl; - var tHead = _dom2.default.tag(table, 'thead'); - var headersRow = this.headersRow; - var header = undefined; - for (var i = 0; i < this.nbCells; i++) { - if (i !== colIndex) { - continue; - } - if (tHead.length === 0) { - header = table.rows[headersRow].cells[i]; - } - if (tHead.length === 1) { - header = tHead[0].rows[headersRow].cells[i]; - } - break; - } - return header; - } - - /** - * Return the list of headers' text - * @param {Boolean} excludeHiddenCols Optional: exclude hidden columns - * @return {Array} list of headers' text - */ - - }, { - key: 'getHeadersText', - value: function getHeadersText() { - var excludeHiddenCols = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var headers = []; - for (var j = 0; j < this.nbCells; j++) { - if (excludeHiddenCols && this.hasExtension('colsVisibility')) { - if (this.extension('colsVisibility').isColHidden(j)) { - continue; - } - } - var header = this.getHeaderElement(j); - var headerText = _dom2.default.getText(header); - headers.push(headerText); - } - return headers; - } - - /** - * Return the filter type for a specified column - * @param {Number} colIndex Column's index - * @return {String} - */ - - }, { - key: 'getFilterType', - value: function getFilterType(colIndex) { - var colType = this.cfg['col_' + colIndex]; - return !colType ? this.fltTypeInp : _string2.default.lower(colType); - } - - /** - * Get the total number of filterable rows - * @return {Number} - */ - - }, { - key: 'getFilterableRowsNb', - value: function getFilterableRowsNb() { - return this.getRowsNb(false); - } - - /** - * Get the configuration object (literal object) - * @return {Object} - */ - - }, { - key: 'config', - value: function config() { - return this.cfg; - } - }]); - - return TableFilter; - })(); - -/***/ }, -/* 1 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * DOM event utilities - */ - - exports.default = { - 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; - } - }, - target: function target(evt) { - return evt && evt.target || window.event && window.event.srcElement; - }, - keyCode: function keyCode(evt) { - return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0; - } - }; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * DOM utilities - */ - - exports.default = { - - /** - * Returns text + text of children of given node - * @param {NodeElement} node - * @return {String} - */ - - getText: function getText(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 - */ - create: function create(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]); - } - } - } - return el; - }, - - /** - * Removes passed node from DOM - * @param {DOMElement} node - * @return {DOMElement} old node reference - */ - remove: function remove(node) { - return node.parentNode.removeChild(node); - }, - - /** - * Returns a text node with given text - * @param {String} txt - * @return {Object} - */ - text: function text(txt) { - return document.createTextNode(txt); - }, - hasClass: function hasClass(ele, cls) { - if (!ele) { - return false; - } - - if (supportsClassList()) { - return ele.classList.contains(cls); - } - return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); - }, - addClass: function addClass(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; - } - }, - removeClass: function removeClass(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 - */ - createOpt: function createOpt(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 - */ - createCheckItem: function createCheckItem(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; - }, - id: function id(key) { - return document.getElementById(key); - }, - tag: function tag(o, tagname) { - return o.getElementsByTagName(tagname); - } - }; - - // HTML5 classList API - - function supportsClassList() { - return document.documentElement.classList; - } - -/***/ }, -/* 3 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * String utilities - */ - - exports.default = { - lower: function lower(text) { - return text.toLowerCase(); - }, - upper: function upper(text) { - return text.toUpperCase(); - }, - trim: function trim(text) { - if (text.trim) { - return text.trim(); - } - return text.replace(/^\s*|\s*$/g, ''); - }, - isEmpty: function isEmpty(text) { - return this.trim(text) === ''; - }, - rgxEsc: function rgxEsc(text) { - var chars = /[-\/\\^$*+?.()|[\]{}]/g; - var escMatch = '\\$&'; - return String(text).replace(chars, escMatch); - }, - matchCase: function matchCase(text, caseSensitive) { - if (!caseSensitive) { - return this.lower(text); - } - return text; - }, - - /** - * Checks if passed data contains the searched term - * @param {String} term Searched term - * @param {String} data Data string - * @param {Boolean} exactMatch Exact match - * @param {Boolean} caseSensitive Case sensitive - * @return {Boolean} - */ - contains: function contains(term, data) { - var exactMatch = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var caseSensitive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; - - // Improved by Cedric Wartel (cwl) automatic exact match for selects and - // special characters are now filtered - var regexp = undefined, - modifier = caseSensitive ? 'g' : 'gi'; - if (exactMatch) { - regexp = new RegExp('(^\\s*)' + this.rgxEsc(term) + '(\\s*$)', modifier); - } else { - regexp = new RegExp(this.rgxEsc(term), modifier); - } - return regexp.test(data); - } - }; - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Cookie utilities - */ - - exports.default = { - write: function write(name, value, hours) { - var expire = ''; - if (hours) { - expire = new Date(new Date().getTime() + hours * 3600000); - expire = '; expires=' + expire.toGMTString(); - } - document.cookie = name + '=' + escape(value) + expire; - }, - read: function read(name) { - var cookieValue = '', - search = name + '='; - if (document.cookie.length > 0) { - var cookie = document.cookie, - offset = cookie.indexOf(search); - if (offset !== -1) { - offset += search.length; - var end = cookie.indexOf(';', offset); - if (end === -1) { - end = cookie.length; - } - cookieValue = unescape(cookie.substring(offset, end)); - } - } - return cookieValue; - }, - remove: function remove(name) { - this.write(name, '', -1); - }, - valueToArray: function valueToArray(name, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.read(name); - //creates an array with filters' values - var arr = val.split(separator); - return arr; - }, - getValueByIndex: function getValueByIndex(name, index, separator) { - if (!separator) { - separator = ','; - } - //reads the cookie - var val = this.valueToArray(name, separator); - return val[index]; - } - }; - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - /** - * Types utilities - */ - - var UNDEFINED = void 0; - - exports.default = { - /** - * Check if argument is an object or a global object - * @param {String or Object} v - * @return {Boolean} - */ - - isObj: function isObj(v) { - var isO = false; - if (typeof v === 'string') { - if (window[v] && _typeof(window[v]) === 'object') { - isO = true; - } - } else { - if (v && (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') { - isO = true; - } - } - return isO; - }, - - /** - * Check if argument is a function - * @param {Function} fn - * @return {Boolean} - */ - isFn: function isFn(fn) { - return fn && fn.constructor == Function; - }, - - /** - * Check if argument is an array - * @param {Array} obj - * @return {Boolean} - */ - isArray: function isArray(obj) { - return obj && obj.constructor == Array; - }, - - /** - * Determine if argument is undefined - * @param {Any} o - * @return {Boolean} - */ - isUndef: function isUndef(o) { - return o === UNDEFINED; - }, - - /** - * Determine if argument is null - * @param {Any} o - * @return {Boolean} - */ - isNull: function isNull(o) { - return o === null; - }, - - /** - * Determine if argument is empty (undefined, null or empty string) - * @param {Any} o - * @return {Boolean} - */ - isEmpty: function isEmpty(o) { - return this.isUndef(o) || this.isNull(o) || o.length === 0; - } - }; - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - has: function has(arr, val, caseSensitive) { - var sCase = caseSensitive === undefined ? false : caseSensitive; - for (var i = 0; i < arr.length; i++) { - if (_string2.default.matchCase(arr[i].toString(), sCase) == val) { - return true; - } - } - return false; - } - }; /** - * Array utilities - */ - -/***/ }, -/* 7 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * Date utilities - */ - - exports.default = { - 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 = undefined, - reg2 = undefined; - // 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 = undefined, - dd = undefined, - yy = undefined; - // 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(dateStr, formatStr) { - if (!formatStr) { - formatStr = 'DMY'; - } - if (!dateStr || dateStr === '') { - return new Date(1001, 0, 1); - } - var oDate = undefined; - var parts = undefined; - - switch (formatStr.toUpperCase()) { - case 'DDMMMYYYY': - parts = dateStr.replace(/[- \/.]/g, ' ').split(' '); - oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); - break; - case 'DMY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'MDY': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - case 'YMD': - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - default: - //in case format is not correct - /* jshint ignore:start */ - 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]); - /* jshint ignore:end */ - break; - } - return oDate; - } - }; - - function y2kDate(yr) { - if (yr === undefined) { - return 0; - } - if (yr.length > 2) { - return yr; - } - var y = undefined; - //>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; - } - - function mmm2mm(mmm) { - if (mmm === undefined) { - return 0; - } - var mondigit = undefined; - 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; - } - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - removeNbFormat: function removeNbFormat(data, format) { - if (!data) { - return; - } - if (!format) { - format = 'us'; - } - var n = data; - if (_string2.default.lower(format) === 'us') { - n = +n.replace(/[^\d\.-]/g, ''); - } else { - n = +n.replace(/[^\d\,-]/g, '').replace(',', '.'); - } - return n; - } - }; /** - * Misc helpers - */ - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - "use strict"; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - /** - * Event emitter class - */ - - var Emitter = exports.Emitter = (function () { - function Emitter() { - _classCallCheck(this, Emitter); - - /** - * Events object - * @type {Object} - */ - this.events = {}; - } - - /** - * Subscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - _createClass(Emitter, [{ - key: "on", - value: function on(evts, fn) { - var _this = this; - - evts.forEach(function (evt) { - _this.events[evt] = _this.events[evt] || []; - _this.events[evt].push(fn); - }); - } - - /** - * Unsubscribe to an event - * @param {Array} evts Collection of event names - * @param {Function} fn Function invoked when event is emitted - */ - - }, { - key: "off", - value: function off(evts, fn) { - var _this2 = this; - - evts.forEach(function (evt) { - if (evt in _this2.events) { - _this2.events[evt].splice(_this2.events[evt].indexOf(fn), 1); - } - }); - } - - /** - * Emit an event - * @param {String} evt Event name followed by any other argument passed to - * the invoked function - */ - - }, { - key: "emit", - value: function emit(evt /*, args...*/) { - if (evt in this.events) { - for (var i = 0; i < this.events[evt].length; i++) { - this.events[evt][i].apply(this, [].slice.call(arguments, 1)); - } - } - } - }]); - - return Emitter; - })(); - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Store = undefined; - - var _cookie = __webpack_require__(4); - - var _cookie2 = _interopRequireDefault(_cookie); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Store = exports.Store = (function () { - - /** - * Store, persistence manager - * @param {Object} tf TableFilter instance - * - * TODO: use localStorage and fallback to cookie persistence - */ - - function Store(tf) { - _classCallCheck(this, Store); - - var f = tf.config(); - - this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(Store, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on(['after-filtering'], function () { - return _this.saveFilterValues(_this.tf.fltsValuesCookie); - }); - } - - /** - * Store filters' values in cookie - * @param {String} cookie name - */ - - }, { - key: 'saveFilterValues', - value: function saveFilterValues(name) { - var tf = this.tf; - var fltValues = []; - - if (!tf.rememberGridValues) { - return; - } - - //store filters' values - for (var i = 0; i < tf.fltIds.length; i++) { - var value = tf.getFilterValue(i); - if (value === '') { - value = ' '; - } - fltValues.push(value); - } - //adds array size - //fltValues.push(tf.fltIds.length); - - //writes cookie - _cookie2.default.write(name, fltValues.join(tf.separator), this.duration); - } - - /** - * Retrieve filters' values from cookie - * @param {String} cookie name - * @return {Array} - */ - - }, { - key: 'getFilterValues', - value: function getFilterValues(name) { - var flts = _cookie2.default.read(name); - var rgx = new RegExp(this.tf.separator, 'g'); - // filters' values array - return flts.split(rgx); - } - - /** - * Store page number in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageNb', - value: function savePageNb(name) { - if (!this.tf.rememberPageNb) { - return; - } - _cookie2.default.write(name, this.tf.feature('paging').currentPageNb, this.duration); - } - - /** - * Retrieve page number from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageNb', - value: function getPageNb(name) { - return _cookie2.default.read(name); - } - - /** - * Store page length in cookie - * @param {String} cookie name - */ - - }, { - key: 'savePageLength', - value: function savePageLength(name) { - if (!this.tf.rememberPageLen) { - return; - } - _cookie2.default.write(name, this.tf.feature('paging').resultsPerPageSlc.selectedIndex, this.duration); - } - - /** - * Retrieve page length from cookie - * @param {String} cookie name - * @return {String} - */ - - }, { - key: 'getPageLength', - value: function getPageLength(name) { - return _cookie2.default.read(name); - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off(['after-filtering'], function () { - return _this2.saveFilterValues(_this2.tf.fltsValuesCookie); - }); - } - }]); - - return Store; - })(); - -/***/ }, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.GridLayout = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var GridLayout = exports.GridLayout = (function (_Feature) { - _inherits(GridLayout, _Feature); - - /** - * Grid layout, table with fixed headers - * @param {Object} tf TableFilter instance - */ - - function GridLayout(tf) { - _classCallCheck(this, GridLayout); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GridLayout).call(this, tf, 'gridLayout')); - - var f = _this.config; - - //defines grid width - _this.gridWidth = f.grid_width || null; - //defines grid height - _this.gridHeight = f.grid_height || null; - //defines css class for main container - _this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont'; - //defines css class for div containing table - _this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont'; - //defines css class for div containing headers' table - _this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont'; - //defines css class for div containing rows counter, paging etc. - _this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf'; - //defines which row contains column headers - _this.gridHeadRowIndex = f.grid_headers_row_index || 0; - //array of headers row indexes to be placed in header table - _this.gridHeadRows = f.grid_headers_rows || [0]; - //generate filters in table headers - _this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true; - //default col width - _this.gridDefaultColWidth = f.grid_default_col_width || '100px'; - - _this.gridColElms = []; - - //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_'; - - _this.sourceTblHtml = tf.tbl.outerHTML; - return _this; - } - - /** - * Generates a grid with fixed headers - */ - - _createClass(GridLayout, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - var f = this.config; - var tbl = tf.tbl; - - if (this.initialized) { - return; - } - - // Override reference rows indexes - tf.refRow = _types2.default.isNull(tf.startRow) ? 0 : tf.startRow; - tf.headersRow = 0; - tf.filtersRowIndex = 1; - - tf.isExternalFlt = true; - - // default width of 100px if column widths not set - if (!tf.hasColWidths) { - tf.colWidths = []; - for (var k = 0; k < tf.nbCells; k++) { - var colW = undefined, - cell = tbl.rows[this.gridHeadRowIndex].cells[k]; - if (cell.width !== '') { - colW = cell.width; - } else if (cell.style.width !== '') { - colW = parseInt(cell.style.width, 10); - } else { - colW = this.gridDefaultColWidth; - } - tf.colWidths[k] = colW; - } - tf.hasColWidths = true; - } - tf.setColWidths(this.gridHeadRowIndex); - - var tblW = undefined; //initial table width - if (tbl.width !== '') { - tblW = tbl.width; - } else if (tbl.style.width !== '') { - tblW = parseInt(tbl.style.width, 10); - } else { - tblW = tbl.clientWidth; - } - - //Main container: it will contain all the elements - this.tblMainCont = _dom2.default.create('div', ['id', this.prfxMainTblCont + tf.id]); - this.tblMainCont.className = this.gridMainContCssClass; - if (this.gridWidth) { - this.tblMainCont.style.width = this.gridWidth; - }console.log(tbl, tbl.parentNode); - tbl.parentNode.insertBefore(this.tblMainCont, tbl); - - //Table container: div wrapping content table - this.tblCont = _dom2.default.create('div', ['id', this.prfxTblCont + tf.id]); - this.tblCont.className = this.gridContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.tblCont.style.width = '100%'; - } else { - this.tblCont.style.width = this.gridWidth; - } - } - if (this.gridHeight) { - this.tblCont.style.height = this.gridHeight; - } - tbl.parentNode.insertBefore(this.tblCont, tbl); - var t = _dom2.default.remove(tbl); - this.tblCont.appendChild(t); - - //In case table width is expressed in % - if (tbl.style.width === '') { - tbl.style.width = (_string2.default.contains('%', tblW) ? tbl.clientWidth : tblW) + 'px'; - } - - var d = _dom2.default.remove(this.tblCont); - this.tblMainCont.appendChild(d); - - //Headers table container: div wrapping headers table - this.headTblCont = _dom2.default.create('div', ['id', this.prfxHeadTblCont + tf.id]); - this.headTblCont.className = this.gridHeadContCssClass; - if (this.gridWidth) { - if (this.gridWidth.indexOf('%') != -1) { - this.headTblCont.style.width = '100%'; - } else { - this.headTblCont.style.width = this.gridWidth; - } - } - - //Headers table - this.headTbl = _dom2.default.create('table', ['id', this.prfxHeadTbl + tf.id]); - var tH = _dom2.default.create('tHead'); - - //1st row should be headers row, ids are added if not set - //Those ids are used by the sort feature - var hRow = tbl.rows[this.gridHeadRowIndex]; - var sortTriggers = []; - for (var n = 0; n < tf.nbCells; n++) { - var c = hRow.cells[n]; - var thId = c.getAttribute('id'); - if (!thId || thId === '') { - thId = this.prfxGridTh + n + '_' + tf.id; - c.setAttribute('id', thId); - } - sortTriggers.push(thId); - } - - //Filters row is created - var filtersRow = _dom2.default.create('tr'); - if (this.gridEnableFilters && tf.fltGrid) { - tf.externalFltTgtIds = []; - for (var j = 0; j < tf.nbCells; j++) { - var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id; - var cl = _dom2.default.create(tf.fltCellTag, ['id', fltTdId]); - filtersRow.appendChild(cl); - tf.externalFltTgtIds[j] = fltTdId; - } - } - //Headers row are moved from content table to headers table - for (var i = 0; i < this.gridHeadRows.length; i++) { - var headRow = tbl.rows[this.gridHeadRows[0]]; - tH.appendChild(headRow); - } - this.headTbl.appendChild(tH); - if (tf.filtersRowIndex === 0) { - tH.insertBefore(filtersRow, hRow); - } else { - tH.appendChild(filtersRow); - } - - this.headTblCont.appendChild(this.headTbl); - this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont); - - //THead needs to be removed in content table for sort feature - var thead = _dom2.default.tag(tbl, 'thead'); - if (thead.length > 0) { - tbl.removeChild(thead[0]); - } - - //Headers table style - this.headTbl.style.tableLayout = 'fixed'; - tbl.style.tableLayout = 'fixed'; - this.headTbl.cellPadding = tbl.cellPadding; - this.headTbl.cellSpacing = tbl.cellSpacing; - // this.headTbl.style.width = tbl.style.width; - - //content table without headers needs col widths to be reset - tf.setColWidths(0, this.headTbl); - - //Headers container width - // this.headTblCont.style.width = this.tblCont.clientWidth+'px'; - - tbl.style.width = ''; - // - this.headTbl.style.width = tbl.clientWidth + 'px'; - // - - //scroll synchronisation - _event2.default.add(this.tblCont, 'scroll', function (evt) { - var elm = _event2.default.target(evt); - var scrollLeft = elm.scrollLeft; - _this2.headTblCont.scrollLeft = scrollLeft; - //New pointerX calc taking into account scrollLeft - // if(!o.isPointerXOverwritten){ - // try{ - // o.Evt.pointerX = function(evt){ - // let e = evt || global.event; - // let bdScrollLeft = tf_StandardBody().scrollLeft + - // scrollLeft; - // return (e.pageX + scrollLeft) || - // (e.clientX + bdScrollLeft); - // }; - // o.isPointerXOverwritten = true; - // } catch(err) { - // o.isPointerXOverwritten = false; - // } - // } - }); - - //Configure sort extension if any - var sort = (f.extensions || []).filter(function (itm) { - return itm.name === 'sort'; - }); - if (sort.length === 1) { - sort[0].async_sort = true; - sort[0].trigger_ids = sortTriggers; - } - - //Cols generation for all browsers excepted IE<=7 - this.tblHasColTag = _dom2.default.tag(tbl, 'col').length > 0 ? true : false; - - //Col elements are enough to keep column widths after sorting and - //filtering - var createColTags = function createColTags() { - for (var k = tf.nbCells - 1; k >= 0; k--) { - var col = _dom2.default.create('col', ['id', tf.id + '_col_' + k]); - tbl.insertBefore(col, tbl.firstChild); - col.style.width = tf.colWidths[k]; - this.gridColElms[k] = col; - } - this.tblHasColTag = true; - }; - - if (!this.tblHasColTag) { - createColTags.call(this); - } else { - var cols = _dom2.default.tag(tbl, 'col'); - for (var ii = 0; ii < tf.nbCells; ii++) { - cols[ii].setAttribute('id', tf.id + '_col_' + ii); - cols[ii].style.width = tf.colWidths[ii]; - this.gridColElms.push(cols[ii]); - } - } - - var afterColResizedFn = _types2.default.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null; - f.on_after_col_resized = function (o, colIndex) { - if (!colIndex) { - return; - } - var w = o.crWColsRow.cells[colIndex].style.width; - var col = o.gridColElms[colIndex]; - col.style.width = w; - - var thCW = o.crWColsRow.cells[colIndex].clientWidth; - var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; - - if (thCW != tdCW) { - o.headTbl.style.width = tbl.clientWidth + 'px'; - } - - if (afterColResizedFn) { - afterColResizedFn.call(null, o, colIndex); - } - }; - - if (tf.popupFilters) { - filtersRow.style.display = 'none'; - } - - if (tbl.clientWidth !== this.headTbl.clientWidth) { - tbl.style.width = this.headTbl.clientWidth + 'px'; - } - - this.initialized = true; - } - - /** - * Removes the grid layout - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - var tbl = tf.tbl; - - if (!this.initialized) { - return; - } - var t = _dom2.default.remove(tbl); - this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); - _dom2.default.remove(this.tblMainCont); - - this.tblMainCont = null; - this.headTblCont = null; - this.headTbl = null; - this.tblCont = null; - - tbl.outerHTML = this.sourceTblHtml; - //needed to keep reference of table element for future usage - this.tf.tbl = t; - - this.initialized = false; - } - }]); - - return GridLayout; - })(_feature.Feature); - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var NOTIMPLEMENTED = 'Not implemented.'; - - var Feature = exports.Feature = (function () { - function Feature(tf, feature) { - _classCallCheck(this, Feature); - - this.tf = tf; - this.feature = feature; - this.enabled = tf[feature]; - this.config = tf.config(); - this.emitter = tf.emitter; - this.initialized = false; - } - - _createClass(Feature, [{ - key: 'init', - value: function init() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - } - }, { - key: 'destroy', - value: function destroy() { - throw new Error(NOTIMPLEMENTED); - } - }, { - key: 'enable', - value: function enable() { - this.enabled = true; - } - }, { - key: 'disable', - value: function disable() { - this.enabled = false; - } - }, { - key: 'isEnabled', - value: function isEnabled() { - return this.enabled; - } - }]); - - return Feature; - })(); - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Loader = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var Loader = exports.Loader = (function (_Feature) { - _inherits(Loader, _Feature); - - /** - * Loading message/spinner - * @param {Object} tf TableFilter instance - */ - - function Loader(tf) { - _classCallCheck(this, Loader); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Loader).call(this, tf, 'loader')); - - var f = _this.config; - - //id of container element - _this.loaderTgtId = f.loader_target_id || null; - //div containing loader - _this.loaderDiv = null; - //defines loader text - _this.loaderText = f.loader_text || 'Loading...'; - //defines loader innerHtml - _this.loaderHtml = f.loader_html || null; - //defines css class for loader div - _this.loaderCssClass = f.loader_css_class || 'loader'; - //delay for hiding loader - _this.loaderCloseDelay = 250; - //callback function before loader is displayed - _this.onShowLoader = _types2.default.isFn(f.on_show_loader) ? f.on_show_loader : null; - //callback function after loader is closed - _this.onHideLoader = _types2.default.isFn(f.on_hide_loader) ? f.on_hide_loader : null; - //loader div - _this.prfxLoader = 'load_'; - return _this; - } - - _createClass(Loader, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - var containerDiv = _dom2.default.create('div', ['id', this.prfxLoader + tf.id]); - containerDiv.className = this.loaderCssClass; - - var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom2.default.id(this.loaderTgtId); - if (!this.loaderTgtId) { - targetEl.insertBefore(containerDiv, tf.tbl); - } else { - targetEl.appendChild(containerDiv); - } - this.loaderDiv = containerDiv; - if (!this.loaderHtml) { - this.loaderDiv.appendChild(_dom2.default.text(this.loaderText)); - } else { - this.loaderDiv.innerHTML = this.loaderHtml; - } - - this.show('none'); - - // Subscribe to events - emitter.on(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this2.show(''); - }); - emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.show('none'); - }); - - this.initialized = true; - } - }, { - key: 'show', - value: function show(p) { - var _this3 = this; - - if (!this.isEnabled() /*|| this.loaderDiv.style.display === p*/) { - return; - } - - var displayLoader = function displayLoader() { - if (!_this3.loaderDiv) { - return; - } - if (_this3.onShowLoader && p !== 'none') { - _this3.onShowLoader.call(null, _this3); - } - _this3.loaderDiv.style.display = p; - if (_this3.onHideLoader && p === 'none') { - _this3.onHideLoader.call(null, _this3); - } - }; - - var t = p === 'none' ? this.loaderCloseDelay : 1; - global.setTimeout(displayLoader, t); - } - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - _dom2.default.remove(this.loaderDiv); - this.loaderDiv = null; - - // Unsubscribe to events - emitter.off(['before-filtering', 'before-populating-filter', 'before-changing-page', 'before-clearing-filters', 'before-changing-results-per-page', 'before-reset-page', 'before-reset-page-length', 'before-loading-extensions', 'before-loading-themes'], function () { - return _this4.show(''); - }); - emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.show('none'); - }); - - this.initialized = false; - } - }]); - - return Loader; - })(_feature.Feature); - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.HighlightKeyword = undefined; - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var HighlightKeyword = exports.HighlightKeyword = (function () { - - /** - * HighlightKeyword, highlight matched keyword - * @param {Object} tf TableFilter instance - */ - - function HighlightKeyword(tf) { - _classCallCheck(this, HighlightKeyword); - - var f = tf.config(); - //defines css class for highlighting - this.highlightCssClass = f.highlight_css_class || 'keyword'; - this.highlightedNodes = []; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(HighlightKeyword, [{ - key: 'init', - value: function init() { - var _this = this; - - this.emitter.on(['before-filtering'], function () { - return _this.unhighlightAll(); - }); - } - - /** - * highlight occurences of searched term in passed node - * @param {Node} node - * @param {String} word Searched term - * @param {String} cssClass Css class name - */ - - }, { - key: 'highlight', - value: function highlight(node, word, cssClass) { - // Iterate into this nodes childNodes - if (node.hasChildNodes) { - var children = node.childNodes; - for (var i = 0; i < children.length; i++) { - this.highlight(children[i], word, cssClass); - } - } - - if (node.nodeType === 3) { - var tempNodeVal = _string2.default.lower(node.nodeValue); - var tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) != -1) { - var pn = node.parentNode; - if (pn && pn.className != cssClass) { - // word not highlighted yet - var nv = node.nodeValue, - ni = tempNodeVal.indexOf(tempWordVal), - - // Create a load of replacement nodes - before = _dom2.default.text(nv.substr(0, ni)), - docWordVal = nv.substr(ni, word.length), - after = _dom2.default.text(nv.substr(ni + word.length)), - hiwordtext = _dom2.default.text(docWordVal), - hiword = _dom2.default.create('span'); - hiword.className = cssClass; - hiword.appendChild(hiwordtext); - pn.insertBefore(before, node); - pn.insertBefore(hiword, node); - pn.insertBefore(after, node); - pn.removeChild(node); - this.highlightedNodes.push(hiword.firstChild); - } - } - } - } - - /** - * Removes highlight to nodes matching passed string - * @param {String} word - * @param {String} cssClass Css class to remove - */ - - }, { - key: 'unhighlight', - value: function unhighlight(word, cssClass) { - var arrRemove = []; - var highlightedNodes = this.highlightedNodes; - for (var i = 0; i < highlightedNodes.length; i++) { - var n = highlightedNodes[i]; - if (!n) { - continue; - } - var tempNodeVal = _string2.default.lower(n.nodeValue), - tempWordVal = _string2.default.lower(word); - if (tempNodeVal.indexOf(tempWordVal) !== -1) { - var pn = n.parentNode; - if (pn && pn.className === cssClass) { - var prevSib = pn.previousSibling, - nextSib = pn.nextSibling; - if (!prevSib || !nextSib) { - continue; - } - nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue; - prevSib.nodeValue = ''; - n.nodeValue = ''; - arrRemove.push(i); - } - } - } - for (var k = 0; k < arrRemove.length; k++) { - highlightedNodes.splice(arrRemove[k], 1); - } - } - - /** - * Clear all occurrences of highlighted nodes - */ - - }, { - key: 'unhighlightAll', - value: function unhighlightAll() { - if (!this.tf.highlightKeywords || !this.tf.searchArgs) { - return; - } - for (var y = 0; y < this.tf.searchArgs.length; y++) { - this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass); - } - this.highlightedNodes = []; - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - this.emitter.off(['before-filtering'], function () { - return _this2.unhighlightAll(); - }); - } - }]); - - return HighlightKeyword; - })(); - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.PopupFilter = undefined; - - var _feature = __webpack_require__(12); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var PopupFilter = exports.PopupFilter = (function (_Feature) { - _inherits(PopupFilter, _Feature); - - /** - * Pop-up filter component - * @param {Object} tf TableFilter instance - */ - - function PopupFilter(tf) { - _classCallCheck(this, PopupFilter); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PopupFilter).call(this, tf, 'popupFilters')); - - var f = _this.config; - - // Enable external filters - tf.isExternalFlt = true; - tf.externalFltTgtIds = []; - - //filter icon path - _this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif'; - //active filter icon path - _this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif'; - _this.popUpImgFltHtml = f.popup_filters_image_html || 'Column filter'; - //defines css class for popup div containing filter - _this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter'; - //callback function before popup filtes is opened - _this.onBeforePopUpOpen = _types2.default.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null; - //callback function after popup filtes is opened - _this.onAfterPopUpOpen = _types2.default.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null; - //callback function before popup filtes is closed - _this.onBeforePopUpClose = _types2.default.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null; - //callback function after popup filtes is closed - _this.onAfterPopUpClose = _types2.default.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null; - - //stores filters spans - _this.popUpFltSpans = []; - //stores filters icons - _this.popUpFltImgs = []; - //stores filters containers - _this.popUpFltElms = _this.popUpFltElmCache || []; - _this.popUpFltAdjustToContainer = true; - - //id prefix for pop-up filter span - _this.prfxPopUpSpan = 'popUpSpan_'; - //id prefix for pop-up div containing filter - _this.prfxPopUpDiv = 'popUpDiv_'; - return _this; - } - - _createClass(PopupFilter, [{ - key: 'onClick', - value: function onClick(e) { - var evt = e || global.event, - elm = evt.target.parentNode, - colIndex = parseInt(elm.getAttribute('ci'), 10); - - this.closeAll(colIndex); - this.toggle(colIndex); - - if (this.popUpFltAdjustToContainer) { - var popUpDiv = this.popUpFltElms[colIndex], - header = this.tf.getHeaderElement(colIndex), - headerWidth = header.clientWidth * 0.95; - popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; - } - _event2.default.cancel(evt); - _event2.default.stop(evt); - } - - /** - * Initialize DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - // Override headers row index if no grouped headers - if (tf.headersRow <= 1) { - tf.headersRow = 0; - } - - for (var i = 0; i < tf.nbCells; i++) { - if (tf.getFilterType(i) === tf.fltTypeNone) { - continue; - } - var popUpSpan = _dom2.default.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]); - popUpSpan.innerHTML = this.popUpImgFltHtml; - var header = tf.getHeaderElement(i); - header.appendChild(popUpSpan); - _event2.default.add(popUpSpan, 'click', function (evt) { - _this2.onClick(evt); - }); - this.popUpFltSpans[i] = popUpSpan; - this.popUpFltImgs[i] = popUpSpan.firstChild; - } - - // subscribe to events - this.emitter.on(['before-filtering'], function () { - return _this2.buildIcons(); - }); - this.emitter.on(['after-filtering'], function () { - return _this2.closeAll(); - }); - this.emitter.on(['cell-processed'], function (tf, cellIndex) { - return _this2.buildIcon(cellIndex, true); - }); - this.emitter.on(['filters-row-inserted'], function () { - return _this2.tf.headersRow++; - }); - this.emitter.on(['before-filter-init'], function (tf, colIndex) { - return _this2.build(colIndex); - }); - - this.initialized = true; - } - - /** - * Reset previously destroyed feature - */ - - }, { - key: 'reset', - value: function reset() { - this.enable(); - this.init(); - this.buildAll(); - } - - /** - * Build all pop-up filters elements - */ - - }, { - key: 'buildAll', - value: function buildAll() { - for (var i = 0; i < this.popUpFltElmCache.length; i++) { - this.build(i, this.popUpFltElmCache[i]); - } - } - - /** - * Build a specified pop-up filter elements - * @param {Number} colIndex Column index - * @param {Object} div Optional container DOM element - */ - - }, { - key: 'build', - value: function build(colIndex, div) { - var tf = this.tf; - var popUpDiv = !div ? _dom2.default.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div; - popUpDiv.className = this.popUpDivCssClass; - tf.externalFltTgtIds.push(popUpDiv.id); - var header = tf.getHeaderElement(colIndex); - header.insertBefore(popUpDiv, header.firstChild); - _event2.default.add(popUpDiv, 'click', function (evt) { - _event2.default.stop(evt); - }); - this.popUpFltElms[colIndex] = popUpDiv; - } - - /** - * Toogle visibility of specified filter - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggle', - value: function toggle(colIndex) { - var tf = this.tf, - popUpFltElm = this.popUpFltElms[colIndex]; - - if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') { - if (this.onBeforePopUpOpen) { - this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'block'; - if (tf.getFilterType(colIndex) === tf.fltTypeInp) { - var flt = tf.getFilterElement(colIndex); - if (flt) { - flt.focus(); - } - } - if (this.onAfterPopUpOpen) { - this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } else { - if (this.onBeforePopUpClose) { - this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - popUpFltElm.style.display = 'none'; - if (this.onAfterPopUpClose) { - this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex); - } - } - } - - /** - * Close all filters excepted for the specified one if any - * @param {Number} exceptIdx Column index of the filter to not close - */ - - }, { - key: 'closeAll', - value: function closeAll(exceptIdx) { - for (var i = 0; i < this.popUpFltElms.length; i++) { - if (i === exceptIdx) { - continue; - } - var popUpFltElm = this.popUpFltElms[i]; - if (popUpFltElm) { - popUpFltElm.style.display = 'none'; - } - } - } - - /** - * Build all the icons representing the pop-up filters - */ - - }, { - key: 'buildIcons', - value: function buildIcons() { - for (var i = 0; i < this.popUpFltImgs.length; i++) { - this.buildIcon(i, false); - } - } - - /** - * Apply specified icon state - * @param {Number} colIndex Column index - * @param {Boolean} active Apply active state - */ - - }, { - key: 'buildIcon', - value: function buildIcon(colIndex, active) { - if (this.popUpFltImgs[colIndex]) { - this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt; - } - } - - /** - * Remove pop-up filters - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - this.popUpFltElmCache = []; - for (var i = 0; i < this.popUpFltElms.length; i++) { - var popUpFltElm = this.popUpFltElms[i], - popUpFltSpan = this.popUpFltSpans[i], - popUpFltImg = this.popUpFltImgs[i]; - if (popUpFltElm) { - _dom2.default.remove(popUpFltElm); - this.popUpFltElmCache[i] = popUpFltElm; - } - popUpFltElm = null; - if (popUpFltSpan) { - _dom2.default.remove(popUpFltSpan); - } - popUpFltSpan = null; - if (popUpFltImg) { - _dom2.default.remove(popUpFltImg); - } - popUpFltImg = null; - } - this.popUpFltElms = []; - this.popUpFltSpans = []; - this.popUpFltImgs = []; - - // unsubscribe to events - this.emitter.off(['before-filtering'], function () { - return _this3.buildIcons(); - }); - this.emitter.off(['after-filtering'], function () { - return _this3.closeAll(); - }); - this.emitter.off(['cell-processed'], function (tf, cellIndex) { - return _this3.buildIcon(cellIndex, true); - }); - this.emitter.off(['filters-row-inserted'], function () { - return _this3.tf.headersRow++; - }); - this.emitter.off(['before-filter-init'], function (tf, colIndex) { - return _this3.build(colIndex); - }); - - this.initialized = false; - } - }]); - - return PopupFilter; - })(_feature.Feature); - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Dropdown = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Dropdown = exports.Dropdown = (function (_Feature) { - _inherits(Dropdown, _Feature); - - /** - * Dropdown UI component - * @param {Object} tf TableFilter instance - */ - - function Dropdown(tf) { - _classCallCheck(this, Dropdown); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Dropdown).call(this, tf, 'dropdown')); - - var f = tf.config(); - - _this.enableSlcResetFilter = f.enable_slc_reset_filter === false ? false : true; - //defines empty option text - _this.nonEmptyText = f.non_empty_text || '(Non empty)'; - //sets select filling method: 'innerHTML' or 'createElement' - _this.slcFillingMethod = f.slc_filling_method || 'createElement'; - //IE only, tooltip text appearing on select before it is populated - _this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate'; - //tooltip text appearing on multiple select - _this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections'; - - _this.isCustom = null; - _this.opts = null; - _this.optsTxt = null; - _this.slcInnerHtml = null; - return _this; - } - - _createClass(Dropdown, [{ - key: 'onSlcFocus', - value: function onSlcFocus(e) { - var elm = _event2.default.target(e); - var tf = this.tf; - tf.activeFilterId = elm.getAttribute('id'); - tf.activeFlt = _dom2.default.id(tf.activeFilterId); - // select is populated when element has focus - if (tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - this.build(ct); - } - // if(tf.popupFilters){ - // Event.cancel(e); - // Event.stop(e); - // } - this.emitter.emit('filter-focus', tf, this); - } - }, { - key: 'onSlcChange', - value: function onSlcChange() { - // if(!this.activeFlt){ return; } - // if(this.popupFilters){ Event.stop(e); } - if (this.tf.onSlcChange) { - this.tf.filter(); - } - } - - /** - * Initialize drop-down filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - }, { - key: 'init', - value: function init(colIndex, isExternal, container) { - var _this2 = this; - - var tf = this.tf; - var col = tf.getFilterType(colIndex); - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var slc = _dom2.default.create(tf.fltTypeSlc, ['id', tf.prfxFlt + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - - if (col === tf.fltTypeMulti) { - slc.multiple = tf.fltTypeMulti; - slc.title = this.multipleSlcTooltip; - } - slc.className = _string2.default.lower(col) === tf.fltTypeSlc ? tf.fltCssClass : tf.fltMultiCssClass; - - //filter is appended in container element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(slc); - tf.externalFltEls.push(slc); - } else { - container.appendChild(slc); - } - - tf.fltIds.push(slc.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - //1st option is created here since build isn't invoked - var opt0 = _dom2.default.createOpt(tf.displayAllText, ''); - slc.appendChild(opt0); - } - - //Event.add(slc, 'keypress', tf.Evt.detectKey.bind(tf)); - _event2.default.add(slc, 'change', function () { - return _this2.onSlcChange(); - }); - // Event.add(slc, 'change', tf.Evt.onSlcChange.bind(tf)); - _event2.default.add(slc, 'focus', function (e) { - return _this2.onSlcFocus(e); - }); - - this.initialized = true; - } - - /** - * Build drop-down filter UI - * @param {Number} colIndex Column index - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Boolean} isExternal Render in external container - * @param {String} extSlcId External container id - */ - - }, { - key: 'build', - value: function build(colIndex) { - var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var isExternal = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var extSlcId = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - this.slcInnerHtml = ''; - - var slcId = tf.fltIds[colIndex]; - if (!_dom2.default.id(slcId) && !isExternal || !_dom2.default.id(extSlcId) && isExternal) { - return; - } - var slc = !isExternal ? _dom2.default.id(slcId) : _dom2.default.id(extSlcId), - rows = tf.tbl.rows, - matchCase = tf.matchCase; - - //custom select test - this.isCustom = tf.isCustomOptions(colIndex); - - //custom selects text - var activeFlt = undefined; - if (isLinked && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - var excludedOpts = null, - filteredDataCol = null; - if (isLinked && tf.disableExcludedOptions) { - excludedOpts = []; - filteredDataCol = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cell = rows[k].cells, - nchilds = cell.length; - - // checks if row has exact cell # - if (nchilds !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - // WTF: cyclomatic complexity hell - if (colIndex === j && (!isLinked || isLinked && tf.disableExcludedOptions) || colIndex == j && isLinked && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && tf.validRowsIndex.indexOf(k) != -1) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cell[j]), - - //Vary Peter's patch - cell_string = _string2.default.matchCase(cell_data, matchCase); - - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, matchCase)) { - this.opts.push(cell_data); - } - - if (isLinked && tf.disableExcludedOptions) { - var filteredCol = filteredDataCol[j]; - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, matchCase) && !_array2.default.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) { - excludedOpts.push(cell_data); - } - } - } //if colIndex==j - } //for j - } //for k - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (excludedOpts) { - excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - } - } - - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (excludedOpts) { - excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (excludedOpts) { - excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (excludedOpts) { - excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - //populates drop-down - this.addOptions(colIndex, slc, isLinked, excludedOpts); - - this.emitter.emit('after-populating-filter', tf, colIndex, slc); - } - - /** - * Add drop-down options - * @param {Number} colIndex Column index - * @param {Object} slc Select Dom element - * @param {Boolean} isLinked Enable linked refresh behaviour - * @param {Array} excludedOpts Array of excluded options - * @param {Array} fltsValues Collection of persisted filter values - * @param {Array} fltArr Collection of persisted filter values - */ - - }, { - key: 'addOptions', - value: function addOptions(colIndex, slc, isLinked, excludedOpts /*, fltsValues, fltArr*/) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod), - slcValue = slc.value; - - slc.innerHTML = ''; - slc = this.addFirstOption(slc); - - for (var y = 0; y < this.opts.length; y++) { - if (this.opts[y] === '') { - continue; - } - var val = this.opts[y]; //option value - var lbl = this.isCustom ? this.optsTxt[y] : val; //option text - var isDisabled = false; - if (isLinked && tf.disableExcludedOptions && _array2.default.has(excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - isDisabled = true; - } - - if (fillMethod === 'innerhtml') { - var slcAttr = ''; - if (tf.loadFltOnDemand && slcValue === this.opts[y]) { - slcAttr = 'selected="selected"'; - } - this.slcInnerHtml += ''; - } else { - var opt = undefined; - //fill select on demand - if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === tf.fltTypeSlc) { - opt = _dom2.default.createOpt(lbl, val, true); - } else { - opt = _dom2.default.createOpt(lbl, val, false); - } - if (isDisabled) { - opt.disabled = true; - } - slc.appendChild(opt); - } - } // for y - - if (fillMethod === 'innerhtml') { - slc.innerHTML += this.slcInnerHtml; - } - slc.setAttribute('filled', '1'); - } - - /** - * Add drop-down header option - * @param {Object} slc Select DOM element - */ - - }, { - key: 'addFirstOption', - value: function addFirstOption(slc) { - var tf = this.tf, - fillMethod = _string2.default.lower(this.slcFillingMethod); - - if (fillMethod === 'innerhtml') { - this.slcInnerHtml += ''; - } else { - var opt0 = _dom2.default.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, ''); - if (!this.enableSlcResetFilter) { - opt0.style.display = 'none'; - } - slc.appendChild(opt0); - if (tf.enableEmptyOption) { - var opt1 = _dom2.default.createOpt(tf.emptyText, tf.emOperator); - slc.appendChild(opt1); - } - if (tf.enableNonEmptyOption) { - var opt2 = _dom2.default.createOpt(tf.nonEmptyText, tf.nmOperator); - slc.appendChild(opt2); - } - } - return slc; - } - }, { - key: 'destroy', - value: function destroy() {} - }]); - - return Dropdown; - })(_feature.Feature); - -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = { - ignoreCase: function ignoreCase(a, b) { - var x = _string2.default.lower(a); - var y = _string2.default.lower(b); - return x < y ? -1 : x > y ? 1 : 0; - } - }; - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.CheckList = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _array = __webpack_require__(6); - - var _array2 = _interopRequireDefault(_array); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _sort = __webpack_require__(17); - - var _sort2 = _interopRequireDefault(_sort); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var CheckList = exports.CheckList = (function (_Feature) { - _inherits(CheckList, _Feature); - - /** - * Checklist UI component - * @param {Object} tf TableFilter instance - */ - - function CheckList(tf) { - _classCallCheck(this, CheckList); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CheckList).call(this, tf, 'checkList')); - - var f = tf.config(); - - _this.checkListDiv = []; //checklist container div - //defines css class for div containing checklist filter - _this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist'; - //defines css class for checklist filters - _this.checkListCssClass = f.checklist_css_class || 'flt_checklist'; - //defines css class for checklist item (li) - _this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item'; - //defines css class for selected checklist item (li) - _this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item'; - //Load on demand text - _this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data'; - //defines css class for checklist filters - _this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled'; - _this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true; - //checklist filter container div - _this.prfxCheckListDiv = 'chkdiv_'; - - _this.isCustom = null; - _this.opts = null; - _this.optsTxt = null; - _this.excludedOpts = null; - return _this; - } - - _createClass(CheckList, [{ - key: 'onChange', - value: function onChange(evt) { - var elm = evt.target; - var tf = this.tf; - tf.activeFilterId = elm.getAttribute('id'); - tf.activeFlt = _dom2.default.id(tf.activeFilterId); - tf.filter(); - // this.tf.Evt.onSlcChange.call(this.tf, evt); - } - }, { - key: 'optionClick', - value: function optionClick(evt) { - this.setCheckListValues(evt.target); - this.onChange(evt); - } - }, { - key: 'onCheckListClick', - value: function onCheckListClick(evt) { - var _this2 = this; - - var elm = _event2.default.target(evt); - if (this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0') { - var ct = elm.getAttribute('ct'); - var div = this.checkListDiv[ct]; - this.build(ct); - _event2.default.remove(div, 'click', function (evt) { - return _this2.onCheckListClick(evt); - }); - } - } - - /** - * Initialize checklist filter - * @param {Number} colIndex Column index - * @param {Boolean} isExternal External filter flag - * @param {DOMElement} container Dom element containing the filter - */ - - }, { - key: 'init', - value: function init(colIndex, isExternal, container) { - var _this3 = this; - - var tf = this.tf; - var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null; - - var divCont = _dom2.default.create('div', ['id', this.prfxCheckListDiv + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']); - divCont.className = this.checkListDivCssClass; - - //filter is appended in desired element - if (externalFltTgtId) { - _dom2.default.id(externalFltTgtId).appendChild(divCont); - tf.externalFltEls.push(divCont); - } else { - container.appendChild(divCont); - } - - this.checkListDiv[colIndex] = divCont; - tf.fltIds.push(tf.prfxFlt + colIndex + '_' + tf.id); - - if (!tf.loadFltOnDemand) { - this.build(colIndex); - } else { - _event2.default.add(divCont, 'click', function (evt) { - return _this3.onCheckListClick(evt); - }); - divCont.appendChild(_dom2.default.text(this.activateCheckListTxt)); - } - - this.initialized = true; - } - - /** - * Build checklist UI - * @param {Number} colIndex Column index - * @param {Boolean} isExternal Render in external container - * @param {String} extFltId External container id - */ - - }, { - key: 'build', - value: function build(colIndex) { - var _this4 = this; - - var isExternal = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - var extFltId = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - - var tf = this.tf; - colIndex = parseInt(colIndex, 10); - - this.emitter.emit('before-populating-filter', tf, colIndex); - - this.opts = []; - this.optsTxt = []; - - var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id; - if (!_dom2.default.id(divFltId) && !isExternal || !_dom2.default.id(extFltId) && isExternal) { - return; - } - - var flt = !isExternal ? this.checkListDiv[colIndex] : _dom2.default.id(extFltId); - var ul = _dom2.default.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]); - ul.className = this.checkListCssClass; - _event2.default.add(ul, 'change', function (evt) { - return _this4.onChange(evt); - }); - - var rows = tf.tbl.rows; - this.isCustom = tf.isCustomOptions(colIndex); - - var activeFlt = undefined; - if (tf.linkedFilters && tf.activeFilterId) { - activeFlt = tf.activeFilterId.split('_')[0]; - activeFlt = activeFlt.split(tf.prfxFlt)[1]; - } - - var filteredDataCol = []; - if (tf.linkedFilters && tf.disableExcludedOptions) { - this.excludedOpts = []; - } - - for (var k = tf.refRow; k < tf.nbRows; k++) { - // always visible rows don't need to appear on selects as always - // valid - if (tf.hasVisibleRows && tf.visibleRows.indexOf(k) !== -1) { - continue; - } - - var cells = rows[k].cells; - var ncells = cells.length; - - // checks if row has exact cell # - if (ncells !== tf.nbCells || this.isCustom) { - continue; - } - - // this loop retrieves cell data - for (var j = 0; j < ncells; j++) { - // WTF: cyclomatic complexity hell :) - if (colIndex === j && (!tf.linkedFilters || tf.linkedFilters && tf.disableExcludedOptions) || colIndex === j && tf.linkedFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && tf.validRowsIndex.indexOf(k) != -1))) { - var cell_data = tf.getCellData(cells[j]); - //Vary Peter's patch - var cell_string = _string2.default.matchCase(cell_data, tf.matchCase); - // checks if celldata is already in array - if (!_array2.default.has(this.opts, cell_string, tf.matchCase)) { - this.opts.push(cell_data); - } - var filteredCol = filteredDataCol[j]; - if (tf.linkedFilters && tf.disableExcludedOptions) { - if (!filteredCol) { - filteredCol = tf.getFilteredDataCol(j); - } - if (!_array2.default.has(filteredCol, cell_string, tf.matchCase) && !_array2.default.has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) { - this.excludedOpts.push(cell_data); - } - } - } - } - } - - //Retrieves custom values - if (this.isCustom) { - var customValues = tf.getCustomOptions(colIndex); - this.opts = customValues[0]; - this.optsTxt = customValues[1]; - } - - if (tf.sortSlc && !this.isCustom) { - if (!tf.matchCase) { - this.opts.sort(_sort2.default.ignoreCase); - if (this.excludedOpts) { - this.excludedOpts.sort(_sort2.default.ignoreCase); - } - } else { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - } - } - //asc sort - if (tf.sortNumAsc && tf.sortNumAsc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortAsc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortAsc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortAsc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - //desc sort - if (tf.sortNumDesc && tf.sortNumDesc.indexOf(colIndex) != -1) { - try { - this.opts.sort(numSortDesc); - if (this.excludedOpts) { - this.excludedOpts.sort(numSortDesc); - } - if (this.isCustom) { - this.optsTxt.sort(numSortDesc); - } - } catch (e) { - this.opts.sort(); - if (this.excludedOpts) { - this.excludedOpts.sort(); - } - if (this.isCustom) { - this.optsTxt.sort(); - } - } //in case there are alphanumeric values - } - - this.addChecks(colIndex, ul, tf.separator); - - if (tf.loadFltOnDemand) { - flt.innerHTML = ''; - } - flt.appendChild(ul); - flt.setAttribute('filled', '1'); - - this.emitter.emit('after-populating-filter', tf, colIndex, flt); - } - - /** - * Add checklist options - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addChecks', - value: function addChecks(colIndex, ul) { - var _this5 = this; - - var tf = this.tf; - var chkCt = this.addTChecks(colIndex, ul); - - for (var y = 0; y < this.opts.length; y++) { - var val = this.opts[y]; //item value - var lbl = this.isCustom ? this.optsTxt[y] : val; //item text - var li = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl); - li.className = this.checkListItemCssClass; - if (tf.linkedFilters && tf.disableExcludedOptions && _array2.default.has(this.excludedOpts, _string2.default.matchCase(val, tf.matchCase), tf.matchCase)) { - _dom2.default.addClass(li, this.checkListItemDisabledCssClass); - li.check.disabled = true; - li.disabled = true; - } else { - _event2.default.add(li.check, 'click', function (evt) { - return _this5.optionClick(evt); - }); - } - ul.appendChild(li); - - if (val === '') { - //item is hidden - li.style.display = 'none'; - } - } - } - - /** - * Add checklist header option - * @param {Number} colIndex Column index - * @param {Object} ul Ul element - */ - - }, { - key: 'addTChecks', - value: function addTChecks(colIndex, ul) { - var _this6 = this; - - var tf = this.tf; - var chkCt = 1; - var li0 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText); - li0.className = this.checkListItemCssClass; - ul.appendChild(li0); - - _event2.default.add(li0.check, 'click', function (evt) { - return _this6.optionClick(evt); - }); - - if (!this.enableCheckListResetFilter) { - li0.style.display = 'none'; - } - - if (tf.enableEmptyOption) { - var li1 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText); - li1.className = this.checkListItemCssClass; - ul.appendChild(li1); - _event2.default.add(li1.check, 'click', function (evt) { - return _this6.optionClick(evt); - }); - chkCt++; - } - - if (tf.enableNonEmptyOption) { - var li2 = _dom2.default.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText); - li2.className = this.checkListItemCssClass; - ul.appendChild(li2); - _event2.default.add(li2.check, 'click', function (evt) { - return _this6.optionClick(evt); - }); - chkCt++; - } - return chkCt; - } - - /** - * Store checked options in DOM element attribute - * @param {Object} o checklist option DOM element - */ - - }, { - key: 'setCheckListValues', - value: function setCheckListValues(o) { - if (!o) { - return; - } - var tf = this.tf; - var chkValue = o.value; //checked item value - var chkIndex = parseInt(o.id.split('_')[2], 10); - var filterTag = 'ul', - itemTag = 'li'; - var n = o; - - //ul tag search - while (_string2.default.lower(n.nodeName) !== filterTag) { - n = n.parentNode; - } - - var li = n.childNodes[chkIndex]; - var colIndex = n.getAttribute('colIndex'); - var fltValue = n.getAttribute('value'); //filter value (ul tag) - var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag) - - if (o.checked) { - //show all item - if (chkValue === '') { - if (fltIndexes && fltIndexes !== '') { - //items indexes - var indSplit = fltIndexes.split(tf.separator); - //checked items loop - for (var u = 0; u < indSplit.length; u++) { - //checked item - var cChk = _dom2.default.id(tf.fltIds[colIndex] + '_' + indSplit[u]); - if (cChk) { - cChk.checked = false; - _dom2.default.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass); - } - } - } - n.setAttribute('value', ''); - n.setAttribute('indexes', ''); - } else { - fltValue = fltValue ? fltValue : ''; - chkValue = _string2.default.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator); - chkIndex = fltIndexes + chkIndex + tf.separator; - n.setAttribute('value', chkValue); - n.setAttribute('indexes', chkIndex); - //1st option unchecked - if (_dom2.default.id(tf.fltIds[colIndex] + '_0')) { - _dom2.default.id(tf.fltIds[colIndex] + '_0').checked = false; - } - } - - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(n.childNodes[0], this.checkListSlcItemCssClass); - _dom2.default.addClass(li, this.checkListSlcItemCssClass); - } - } else { - //removes values and indexes - if (chkValue !== '') { - var replaceValue = new RegExp(_string2.default.rgxEsc(chkValue + ' ' + tf.orOperator)); - fltValue = fltValue.replace(replaceValue, ''); - n.setAttribute('value', _string2.default.trim(fltValue)); - - var replaceIndex = new RegExp(_string2.default.rgxEsc(chkIndex + tf.separator)); - fltIndexes = fltIndexes.replace(replaceIndex, ''); - n.setAttribute('indexes', fltIndexes); - } - if (_string2.default.lower(li.nodeName) === itemTag) { - _dom2.default.removeClass(li, this.checkListSlcItemCssClass); - } - } - } - }, { - key: 'destroy', - value: function destroy() {} - }]); - - return CheckList; - })(_feature.Feature); - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.RowsCounter = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var RowsCounter = exports.RowsCounter = (function (_Feature) { - _inherits(RowsCounter, _Feature); - - /** - * Rows counter - * @param {Object} tf TableFilter instance - */ - - function RowsCounter(tf) { - _classCallCheck(this, RowsCounter); - - // TableFilter configuration - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RowsCounter).call(this, tf, 'rowsCounter')); - - var f = _this.config; - - //id of custom container element - _this.rowsCounterTgtId = f.rows_counter_target_id || null; - //element containing tot nb rows - _this.rowsCounterDiv = null; - //element containing tot nb rows label - _this.rowsCounterSpan = null; - //defines rows counter text - _this.rowsCounterText = f.rows_counter_text || 'Rows: '; - _this.fromToTextSeparator = f.from_to_text_separator || '-'; - _this.overText = f.over_text || ' / '; - //defines css class rows counter - _this.totRowsCssClass = f.tot_rows_css_class || 'tot'; - //rows counter div - _this.prfxCounter = 'counter_'; - //nb displayed rows label - _this.prfxTotRows = 'totrows_span_'; - //label preceding nb rows label - _this.prfxTotRowsTxt = 'totRowsTextSpan_'; - //callback raised before counter is refreshed - _this.onBeforeRefreshCounter = _types2.default.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; - //callback raised after counter is refreshed - _this.onAfterRefreshCounter = _types2.default.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; - return _this; - } - - _createClass(RowsCounter, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - //rows counter container - var countDiv = _dom2.default.create('div', ['id', this.prfxCounter + tf.id]); - countDiv.className = this.totRowsCssClass; - //rows counter label - var countSpan = _dom2.default.create('span', ['id', this.prfxTotRows + tf.id]); - var countText = _dom2.default.create('span', ['id', this.prfxTotRowsTxt + tf.id]); - countText.appendChild(_dom2.default.text(this.rowsCounterText)); - - // counter is added to defined element - if (!this.rowsCounterTgtId) { - tf.setToolbar(); - } - var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom2.default.id(this.rowsCounterTgtId); - - //default container: 'lDiv' - if (!this.rowsCounterTgtId) { - countDiv.appendChild(countText); - countDiv.appendChild(countSpan); - targetEl.appendChild(countDiv); - } else { - //custom container, no need to append statusDiv - targetEl.appendChild(countText); - targetEl.appendChild(countSpan); - } - this.rowsCounterDiv = countDiv; - this.rowsCounterSpan = countSpan; - - // subscribe to events - this.emitter.on(['after-filtering', 'grouped-by-page'], function () { - return _this2.refresh(tf.nbVisibleRows); - }); - this.emitter.on(['rows-changed'], function () { - return _this2.refresh(); - }); - - this.initialized = true; - this.refresh(); - } - }, { - key: 'refresh', - value: function refresh(p) { - if (!this.initialized || !this.isEnabled()) { - return; - } - - var tf = this.tf; - - if (this.onBeforeRefreshCounter) { - this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan); - } - - var totTxt; - if (!tf.paging) { - if (p && p !== '') { - totTxt = p; - } else { - totTxt = tf.nbFilterableRows - tf.nbHiddenRows; - } - } else { - var paging = tf.feature('paging'); - if (paging) { - //paging start row - var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0); - var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows; - totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows; - } - } - - this.rowsCounterSpan.innerHTML = totTxt; - if (this.onAfterRefreshCounter) { - this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - - if (!this.rowsCounterTgtId && this.rowsCounterDiv) { - _dom2.default.remove(this.rowsCounterDiv); - } else { - _dom2.default.id(this.rowsCounterTgtId).innerHTML = ''; - } - this.rowsCounterSpan = null; - this.rowsCounterDiv = null; - - // unsubscribe to events - this.emitter.off(['after-filtering', 'grouped-by-page'], function () { - return _this3.refresh(tf.nbVisibleRows); - }); - this.emitter.off(['rows-changed'], function () { - return _this3.refresh(); - }); - - this.initialized = false; - } - }]); - - return RowsCounter; - })(_feature.Feature); - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.StatusBar = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var global = window; - - var StatusBar = exports.StatusBar = (function (_Feature) { - _inherits(StatusBar, _Feature); - - /** - * Status bar UI component - * @param {Object} tf TableFilter instance - */ - - function StatusBar(tf) { - _classCallCheck(this, StatusBar); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StatusBar).call(this, tf, 'statusBar')); - - var f = _this.config; - - //id of custom container element - _this.statusBarTgtId = f.status_bar_target_id || null; - //element containing status bar label - _this.statusBarDiv = null; - //status bar - _this.statusBarSpan = null; - //status bar label - _this.statusBarSpanText = null; - //defines status bar text - _this.statusBarText = f.status_bar_text || ''; - //defines css class status bar - _this.statusBarCssClass = f.status_bar_css_class || 'status'; - //delay for status bar clearing - _this.statusBarCloseDelay = 250; - - //calls function before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //calls function after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - - //status messages - _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 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)...'; - - // status bar div - _this.prfxStatus = 'status_'; - // status bar label - _this.prfxStatusSpan = 'statusSpan_'; - // text preceding status bar label - _this.prfxStatusTxt = 'statusText_'; - return _this; - } - - _createClass(StatusBar, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - var emitter = this.emitter; - - //status bar container - var statusDiv = _dom2.default.create('div', ['id', this.prfxStatus + tf.id]); - statusDiv.className = this.statusBarCssClass; - - //status bar label - var statusSpan = _dom2.default.create('span', ['id', this.prfxStatusSpan + tf.id]); - //preceding text - var statusSpanText = _dom2.default.create('span', ['id', this.prfxStatusTxt + tf.id]); - statusSpanText.appendChild(_dom2.default.text(this.statusBarText)); - - // target element container - if (!this.statusBarTgtId) { - tf.setToolbar(); - } - var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom2.default.id(this.statusBarTgtId); - - //default container: 'lDiv' - if (!this.statusBarTgtId) { - statusDiv.appendChild(statusSpanText); - statusDiv.appendChild(statusSpan); - targetEl.appendChild(statusDiv); - } else { - // custom container, no need to append statusDiv - targetEl.appendChild(statusSpanText); - targetEl.appendChild(statusSpan); - } - - this.statusBarDiv = statusDiv; - this.statusBarSpan = statusSpan; - this.statusBarSpanText = statusSpanText; - - // Subscribe to events - emitter.on(['before-filtering'], function () { - return _this2.message(_this2.msgFilter); - }); - emitter.on(['before-populating-filter'], function () { - return _this2.message(_this2.msgPopulate); - }); - emitter.on(['before-changing-page'], function () { - return _this2.message(_this2.msgChangePage); - }); - emitter.on(['before-clearing-filters'], function () { - return _this2.message(_this2.msgClear); - }); - emitter.on(['before-changing-results-per-page'], function () { - return _this2.message(_this2.msgChangeResults); - }); - emitter.on(['before-reset-page'], function () { - return _this2.message(_this2.msgResetPage); - }); - emitter.on(['before-reset-page-length'], function () { - return _this2.message(_this2.msgResetPageLength); - }); - emitter.on(['before-loading-extensions'], function () { - return _this2.message(_this2.msgLoadExtensions); - }); - emitter.on(['before-loading-themes'], function () { - return _this2.message(_this2.msgLoadThemes); - }); - - emitter.on(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this2.message(''); - }); - - this.initialized = true; - } - }, { - key: 'message', - value: function message() { - var _this3 = this; - - var t = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; - - if (!this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, t); - } - - var d = t === '' ? this.statusBarCloseDelay : 1; - global.setTimeout(function () { - if (!_this3.initialized) { - return; - } - _this3.statusBarSpan.innerHTML = t; - if (_this3.onAfterShowMsg) { - _this3.onAfterShowMsg.call(null, _this3.tf, t); - } - }, d); - } - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - if (!this.initialized) { - return; - } - - var emitter = this.emitter; - - this.statusBarDiv.innerHTML = ''; - _dom2.default.remove(this.statusBarDiv); - this.statusBarSpan = null; - this.statusBarSpanText = null; - this.statusBarDiv = null; - - // Unsubscribe to events - emitter.off(['before-filtering'], function () { - return _this4.message(_this4.msgFilter); - }); - emitter.off(['before-populating-filter'], function () { - return _this4.message(_this4.msgPopulate); - }); - emitter.off(['before-changing-page'], function () { - return _this4.message(_this4.msgChangePage); - }); - emitter.off(['before-clearing-filters'], function () { - return _this4.message(_this4.msgClear); - }); - emitter.off(['before-changing-results-per-page'], function () { - return _this4.message(_this4.msgChangeResults); - }); - emitter.off(['before-reset-page'], function () { - return _this4.message(_this4.msgResetPage); - }); - emitter.off(['before-reset-page-length'], function () { - return _this4.message(_this4.msgResetPageLength); - }); - emitter.off(['before-loading-extensions'], function () { - return _this4.message(_this4.msgLoadExtensions); - }); - emitter.off(['before-loading-themes'], function () { - return _this4.message(_this4.msgLoadThemes); - }); - - emitter.off(['after-filtering', 'after-populating-filter', 'after-changing-page', 'after-clearing-filters', 'after-changing-results-per-page', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () { - return _this4.message(''); - }); - - this.initialized = false; - } - }]); - - return StatusBar; - })(_feature.Feature); - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Paging = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var Paging = exports.Paging = (function (_Feature) { - _inherits(Paging, _Feature); - - /** - * Pagination component - * @param {Object} tf TableFilter instance - */ - - function Paging(tf) { - _classCallCheck(this, Paging); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Paging).call(this, tf, 'paging')); - - var f = _this.config; - - //css class for paging buttons (previous,next,etc.) - _this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; - //stores paging select element - _this.pagingSlc = null; - //results per page select element - _this.resultsPerPageSlc = null; - //id of container element - _this.pagingTgtId = f.paging_target_id || null; - //defines table paging length - _this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; - //id of container element - _this.resultsPerPageTgtId = f.results_per_page_target_id || null; - //css class for paging select element - _this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; - //css class for paging input element - _this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; - //stores results per page text and values - _this.resultsPerPage = f.results_per_page || null; - //enables/disables results per page drop-down - _this.hasResultsPerPage = _types2.default.isArray(_this.resultsPerPage); - //defines css class for results per page select - _this.resultsSlcCssClass = f.results_slc_css_class || 'rspg'; - //css class for label preceding results per page select - _this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan'; - //1st row index of current page - _this.startPagingRow = 0; - //total nb of pages - _this.nbPages = 0; - //current page nb - _this.currentPageNb = 1; - //defines next page button text - _this.btnNextPageText = f.btn_next_page_text || '>'; - //defines previous page button text - _this.btnPrevPageText = f.btn_prev_page_text || '<'; - //defines last page button text - _this.btnLastPageText = f.btn_last_page_text || '>|'; - //defines first page button text - _this.btnFirstPageText = f.btn_first_page_text || '|<'; - //defines next page button html - _this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ''); - //defines last page button html - _this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ''); - //defines previous page button html - _this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ''); - //defines text preceeding page selector drop-down - _this.pageText = f.page_text || ' Page '; - //defines text after page selector drop-down - _this.ofText = f.of_text || ' of '; - //css class for span containing tot nb of pages - _this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg'; - //enables/disables paging buttons - _this.hasPagingBtns = f.paging_btns === false ? false : true; - //defines previous page button html - _this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc; - //calls function before page is changed - _this.onBeforeChangePage = _types2.default.isFn(f.on_before_change_page) ? f.on_before_change_page : null; - //calls function before page is changed - _this.onAfterChangePage = _types2.default.isFn(f.on_after_change_page) ? f.on_after_change_page : null; - - //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_'; - - var start_row = tf.refRow; - var nrows = tf.nbRows; - //calculates page nb - _this.nbPages = Math.ceil((nrows - start_row) / _this.pagingLength); - - //Paging elements events - var o = _this; - // Paging DOM events - _this.evt = { - slcIndex: function slcIndex() { - return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1; - }, - nbOpts: function nbOpts() { - return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1; - }, - next: function next() { - var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0; - o.changePage(nextIndex); - }, - prev: function prev() { - var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts(); - o.changePage(prevIndex); - }, - last: function last() { - o.changePage(o.evt.nbOpts()); - }, - first: function first() { - o.changePage(0); - }, - _detectKey: function _detectKey(e) { - var key = _event2.default.keyCode(e); - if (key === 13) { - if (tf.sorted) { - tf.filter(); - o.changePage(o.evt.slcIndex()); - } else { - o.changePage(); - } - this.blur(); - } - }, - - slcPagesChange: null, - nextEvt: null, - prevEvt: null, - lastEvt: null, - firstEvt: null - }; - return _this; - } - - /** - * Initialize DOM elements - */ - - _createClass(Paging, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var slcPages; - var tf = this.tf; - var evt = this.evt; - - if (this.initialized) { - return; - } - - // Check resultsPerPage is in expected format and initialise the - // results per page component - if (this.hasResultsPerPage) { - if (this.resultsPerPage.length < 2) { - this.hasResultsPerPage = false; - } else { - this.pagingLength = this.resultsPerPage[1][0]; - this.setResultsPerPage(); - } - } - - evt.slcPagesChange = function (event) { - var slc = event.target; - _this2.changePage(slc.selectedIndex); - }; - - // Paging drop-down list selector - if (this.pageSelectorType === tf.fltTypeSlc) { - slcPages = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]); - slcPages.className = this.pgSlcCssClass; - _event2.default.add(slcPages, 'change', evt.slcPagesChange); - } - - // Paging input selector - if (this.pageSelectorType === tf.fltTypeInp) { - slcPages = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]); - slcPages.className = this.pgInpCssClass; - _event2.default.add(slcPages, 'keypress', evt._detectKey); - } - - // btns containers - var btnNextSpan = _dom2.default.create('span', ['id', this.prfxBtnNextSpan + tf.id]); - var btnPrevSpan = _dom2.default.create('span', ['id', this.prfxBtnPrevSpan + tf.id]); - var btnLastSpan = _dom2.default.create('span', ['id', this.prfxBtnLastSpan + tf.id]); - var btnFirstSpan = _dom2.default.create('span', ['id', this.prfxBtnFirstSpan + tf.id]); - - if (this.hasPagingBtns) { - // Next button - if (!this.btnNextPageHtml) { - var btn_next = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']); - btn_next.className = this.btnPageCssClass; - _event2.default.add(btn_next, 'click', evt.next); - btnNextSpan.appendChild(btn_next); - } else { - btnNextSpan.innerHTML = this.btnNextPageHtml; - _event2.default.add(btnNextSpan, 'click', evt.next); - } - // Previous button - if (!this.btnPrevPageHtml) { - var btn_prev = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']); - btn_prev.className = this.btnPageCssClass; - _event2.default.add(btn_prev, 'click', evt.prev); - btnPrevSpan.appendChild(btn_prev); - } else { - btnPrevSpan.innerHTML = this.btnPrevPageHtml; - _event2.default.add(btnPrevSpan, 'click', evt.prev); - } - // Last button - if (!this.btnLastPageHtml) { - var btn_last = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']); - btn_last.className = this.btnPageCssClass; - _event2.default.add(btn_last, 'click', evt.last); - btnLastSpan.appendChild(btn_last); - } else { - btnLastSpan.innerHTML = this.btnLastPageHtml; - _event2.default.add(btnLastSpan, 'click', evt.last); - } - // First button - if (!this.btnFirstPageHtml) { - var btn_first = _dom2.default.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']); - btn_first.className = this.btnPageCssClass; - _event2.default.add(btn_first, 'click', evt.first); - btnFirstSpan.appendChild(btn_first); - } else { - btnFirstSpan.innerHTML = this.btnFirstPageHtml; - _event2.default.add(btnFirstSpan, 'click', evt.first); - } - } - - // paging elements (buttons+drop-down list) are added to defined element - if (!this.pagingTgtId) { - tf.setToolbar(); - } - var targetEl = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - targetEl.appendChild(btnFirstSpan); - targetEl.appendChild(btnPrevSpan); - - var pgBeforeSpan = _dom2.default.create('span', ['id', this.prfxPgBeforeSpan + tf.id]); - pgBeforeSpan.appendChild(_dom2.default.text(this.pageText)); - pgBeforeSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgBeforeSpan); - targetEl.appendChild(slcPages); - var pgAfterSpan = _dom2.default.create('span', ['id', this.prfxPgAfterSpan + tf.id]); - pgAfterSpan.appendChild(_dom2.default.text(this.ofText)); - pgAfterSpan.className = this.nbPgSpanCssClass; - targetEl.appendChild(pgAfterSpan); - var pgspan = _dom2.default.create('span', ['id', this.prfxPgSpan + tf.id]); - pgspan.className = this.nbPgSpanCssClass; - pgspan.appendChild(_dom2.default.text(' ' + this.nbPages + ' ')); - targetEl.appendChild(pgspan); - targetEl.appendChild(btnNextSpan); - targetEl.appendChild(btnLastSpan); - this.pagingSlc = _dom2.default.id(this.prfxSlcPages + tf.id); - - if (!tf.rememberGridValues) { - this.setPagingInfo(); - } - if (!tf.fltGrid) { - tf.validateAllRows(); - this.setPagingInfo(tf.validRowsIndex); - } - - this.emitter.on(['after-filtering'], function () { - return _this2.resetPagingInfo(); - }); - this.emitter.on(['initialized'], function () { - return _this2.resetValues(); - }); - - this.initialized = true; - } - - /** - * Reset paging when filters are already instantiated - * @param {Boolean} filterTable Execute filtering once paging instanciated - */ - - }, { - key: 'reset', - value: function reset() { - var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; - - var tf = this.tf; - if (!tf.hasGrid() || this.isEnabled()) { - return; - } - this.enable(); - this.init(); - tf.resetValues(); - if (filterTable) { - tf.filter(); - } - } - - /** - * Reset paging info from scratch after a filtering process - */ - - }, { - key: 'resetPagingInfo', - value: function resetPagingInfo() { - this.startPagingRow = 0; - this.currentPageNb = 1; - this.setPagingInfo(this.tf.validRowsIndex); - } - - /** - * Calculate number of pages based on valid rows - * Refresh paging select according to number of pages - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'setPagingInfo', - value: function setPagingInfo(validRows) { - var tf = this.tf; - var mdiv = !this.pagingTgtId ? tf.mDiv : _dom2.default.id(this.pagingTgtId); - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - //store valid rows indexes - tf.validRowsIndex = validRows || tf.getValidRows(true); - - //calculate nb of pages - this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); - //refresh page nb span - pgspan.innerHTML = this.nbPages; - //select clearing shortcut - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.innerHTML = ''; - } - - if (this.nbPages > 0) { - mdiv.style.visibility = 'visible'; - if (this.pageSelectorType === tf.fltTypeSlc) { - for (var z = 0; z < this.nbPages; z++) { - var opt = _dom2.default.createOpt(z + 1, z * this.pagingLength, false); - this.pagingSlc.options[z] = opt; - } - } else { - //input type - this.pagingSlc.value = this.currentPageNb; - } - } else { - /*** if no results paging select and buttons are hidden ***/ - mdiv.style.visibility = 'hidden'; - } - this.groupByPage(tf.validRowsIndex); - } - - /** - * Group table rows by page and display valid rows - * @param {Array} validRows Collection of valid rows - */ - - }, { - key: 'groupByPage', - value: function groupByPage(validRows) { - var tf = this.tf; - var rows = tf.tbl.rows; - var startPagingRow = parseInt(this.startPagingRow, 10); - var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); - - //store valid rows indexes - if (validRows) { - tf.validRowsIndex = validRows; - } - - //this loop shows valid rows of current page - for (var h = 0, len = tf.validRowsIndex.length; h < len; h++) { - var validRowIdx = tf.validRowsIndex[h]; - var r = rows[validRowIdx]; - var isRowValid = r.getAttribute('validRow'); - var rowDisplayed = false; - - if (h >= startPagingRow && h < endPagingRow) { - if (_types2.default.isNull(isRowValid) || Boolean(isRowValid === 'true')) { - r.style.display = ''; - rowDisplayed = true; - } - } else { - r.style.display = 'none'; - } - this.emitter.emit('row-paged', tf, validRowIdx, h, rowDisplayed); - } - - tf.nbVisibleRows = tf.validRowsIndex.length; - - // broadcast grouping by page - this.emitter.emit('grouped-by-page', tf, this); - } - - /** - * Return the current page number - * @return {Number} Page number - */ - - }, { - key: 'getPage', - value: function getPage() { - return this.currentPageNb; - } - - /** - * Show page based on passed param value (string or number): - * @param {String} or {Number} cmd possible string values: 'next', - * 'previous', 'last', 'first' or page number as per param - */ - - }, { - key: 'setPage', - value: function setPage(cmd) { - var tf = this.tf; - if (!tf.hasGrid() || !this.isEnabled()) { - return; - } - var btnEvt = this.evt, - cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd); - if (cmdtype === 'string') { - switch (_string2.default.lower(cmd)) { - case 'next': - btnEvt.next(); - break; - case 'previous': - btnEvt.prev(); - break; - case 'last': - btnEvt.last(); - break; - case 'first': - btnEvt.first(); - break; - default: - btnEvt.next(); - break; - } - } else if (cmdtype === 'number') { - this.changePage(cmd - 1); - } - } - - /** - * Generates UI elements for the number of results per page drop-down - */ - - }, { - key: 'setResultsPerPage', - value: function setResultsPerPage() { - var _this3 = this; - - var tf = this.tf; - var evt = this.evt; - - if (!tf.hasGrid() && !tf.isFirstLoad) { - return; - } - if (this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - - evt.slcResultsChange = function (ev) { - _this3.changeResultsPerPage(); - ev.target.blur(); - }; - - var slcR = _dom2.default.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]); - slcR.className = this.resultsSlcCssClass; - var slcRText = this.resultsPerPage[0], - slcROpts = this.resultsPerPage[1]; - var slcRSpan = _dom2.default.create('span', ['id', this.prfxSlcResultsTxt + tf.id]); - slcRSpan.className = this.resultsSpanCssClass; - - // results per page select is added to external element - if (!this.resultsPerPageTgtId) { - tf.setToolbar(); - } - var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom2.default.id(this.resultsPerPageTgtId); - slcRSpan.appendChild(_dom2.default.text(slcRText)); - - var help = tf.feature('help'); - if (help && help.btn) { - help.btn.parentNode.insertBefore(slcRSpan, help.btn); - help.btn.parentNode.insertBefore(slcR, help.btn); - } else { - targetEl.appendChild(slcRSpan); - targetEl.appendChild(slcR); - } - - for (var r = 0; r < slcROpts.length; r++) { - var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); - slcR.options[r] = currOpt; - } - _event2.default.add(slcR, 'change', evt.slcResultsChange); - this.resultsPerPageSlc = slcR; - } - - /** - * Remove number of results per page UI elements - */ - - }, { - key: 'removeResultsPerPage', - value: function removeResultsPerPage() { - var tf = this.tf; - if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) { - return; - } - var slcR = this.resultsPerPageSlc, - slcRSpan = _dom2.default.id(this.prfxSlcResultsTxt + tf.id); - if (slcR) { - _dom2.default.remove(slcR); - } - if (slcRSpan) { - _dom2.default.remove(slcRSpan); - } - this.resultsPerPageSlc = null; - } - - /** - * Change the page according to passed index - * @param {Number} index Index of the page (0-n) - */ - - }, { - key: 'changePage', - value: function changePage(index) { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-changing-page', tf, index); - - if (index === null) { - index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; - } - if (index >= 0 && index <= this.nbPages - 1) { - if (this.onBeforeChangePage) { - this.onBeforeChangePage.call(null, this, index); - } - this.currentPageNb = parseInt(index, 10) + 1; - if (this.pageSelectorType === tf.fltTypeSlc) { - this.pagingSlc.options[index].selected = true; - } else { - this.pagingSlc.value = this.currentPageNb; - } - - if (tf.rememberPageNb) { - tf.feature('store').savePageNb(tf.pgNbCookie); - } - this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength; - - this.groupByPage(); - - if (this.onAfterChangePage) { - this.onAfterChangePage.call(null, this, index); - } - } - - this.emitter.emit('after-changing-page', tf, index); - } - - /** - * Change rows according to page results drop-down - * TODO: accept a parameter setting the results per page length - */ - - }, { - key: 'changeResultsPerPage', - value: function changeResultsPerPage() { - var tf = this.tf; - - if (!this.isEnabled()) { - return; - } - - this.emitter.emit('before-changing-results-per-page', tf); - - var slcR = this.resultsPerPageSlc; - var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10); - this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10); - this.startPagingRow = this.pagingLength * slcPagesSelIndex; - - if (!isNaN(this.pagingLength)) { - if (this.startPagingRow >= tf.nbFilterableRows) { - this.startPagingRow = tf.nbFilterableRows - this.pagingLength; - } - this.setPagingInfo(); - - if (this.pageSelectorType === tf.fltTypeSlc) { - var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex; - this.pagingSlc.options[slcIndex].selected = true; - } - if (tf.rememberPageLen) { - tf.feature('store').savePageLength(tf.pgLenCookie); - } - } - - this.emitter.emit('after-changing-results-per-page', tf); - } - - /** - * Re-set persisted pagination info - */ - - }, { - key: 'resetValues', - value: function resetValues() { - var tf = this.tf; - if (tf.rememberPageLen) { - this.resetPageLength(tf.pgLenCookie); - } - if (tf.rememberPageNb) { - this.resetPage(tf.pgNbCookie); - } - } - - /** - * Re-set page nb at page re-load - */ - - }, { - key: 'resetPage', - value: function resetPage(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page', tf); - var pgnb = tf.feature('store').getPageNb(name); - if (pgnb !== '') { - this.changePage(pgnb - 1); - } - this.emitter.emit('after-reset-page', tf, pgnb); - } - - /** - * Re-set page length value at page re-load - */ - - }, { - key: 'resetPageLength', - value: function resetPageLength(name) { - var tf = this.tf; - if (!this.isEnabled()) { - return; - } - this.emitter.emit('before-reset-page-length', tf); - var pglenIndex = tf.feature('store').getPageLength(name); - - if (pglenIndex !== '') { - this.resultsPerPageSlc.options[pglenIndex].selected = true; - this.changeResultsPerPage(); - } - this.emitter.emit('after-reset-page-length', tf, pglenIndex); - } - - /** - * Remove paging feature - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this4 = this; - - var tf = this.tf; - - if (!this.initialized) { - return; - } - // btns containers - var btnNextSpan = _dom2.default.id(this.prfxBtnNextSpan + tf.id); - var btnPrevSpan = _dom2.default.id(this.prfxBtnPrevSpan + tf.id); - var btnLastSpan = _dom2.default.id(this.prfxBtnLastSpan + tf.id); - var btnFirstSpan = _dom2.default.id(this.prfxBtnFirstSpan + tf.id); - //span containing 'Page' text - var pgBeforeSpan = _dom2.default.id(this.prfxPgBeforeSpan + tf.id); - //span containing 'of' text - var pgAfterSpan = _dom2.default.id(this.prfxPgAfterSpan + tf.id); - //span containing nb of pages - var pgspan = _dom2.default.id(this.prfxPgSpan + tf.id); - - var evt = this.evt; - - if (this.pagingSlc) { - if (this.pageSelectorType === tf.fltTypeSlc) { - _event2.default.remove(this.pagingSlc, 'change', evt.slcPagesChange); - } else if (this.pageSelectorType === tf.fltTypeInp) { - _event2.default.remove(this.pagingSlc, 'keypress', evt._detectKey); - } - _dom2.default.remove(this.pagingSlc); - } - - if (btnNextSpan) { - _event2.default.remove(btnNextSpan, 'click', evt.next); - _dom2.default.remove(btnNextSpan); - } - - if (btnPrevSpan) { - _event2.default.remove(btnPrevSpan, 'click', evt.prev); - _dom2.default.remove(btnPrevSpan); - } - - if (btnLastSpan) { - _event2.default.remove(btnLastSpan, 'click', evt.last); - _dom2.default.remove(btnLastSpan); - } - - if (btnFirstSpan) { - _event2.default.remove(btnFirstSpan, 'click', evt.first); - _dom2.default.remove(btnFirstSpan); - } - - if (pgBeforeSpan) { - _dom2.default.remove(pgBeforeSpan); - } - - if (pgAfterSpan) { - _dom2.default.remove(pgAfterSpan); - } - - if (pgspan) { - _dom2.default.remove(pgspan); - } - - if (this.hasResultsPerPage) { - this.removeResultsPerPage(); - } - - this.emitter.off(['after-filtering'], function () { - return _this4.resetPagingInfo(); - }); - this.emitter.off(['initialized'], function () { - return _this4.resetValues(); - }); - - this.pagingSlc = null; - this.nbPages = 0; - this.disable(); - this.initialized = false; - } - }]); - - return Paging; - })(_feature.Feature); - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.ClearButton = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var ClearButton = exports.ClearButton = (function (_Feature) { - _inherits(ClearButton, _Feature); - - /** - * Clear button component - * @param {Object} tf TableFilter instance - */ - - function ClearButton(tf) { - _classCallCheck(this, ClearButton); - - // Configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ClearButton).call(this, tf, 'btnReset')); - - var f = _this.config; - - //id of container element - _this.btnResetTgtId = f.btn_reset_target_id || null; - //reset button element - _this.btnResetEl = null; - //defines reset text - _this.btnResetText = f.btn_reset_text || 'Reset'; - //defines reset button tooltip - _this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters'; - //defines reset button innerHtml - _this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ''); - //span containing reset button - _this.prfxResetSpan = 'resetspan_'; - return _this; - } - - _createClass(ClearButton, [{ - key: 'onClick', - value: function onClick() { - if (!this.isEnabled()) { - return; - } - this.tf.clearFilters(); - } - - /** - * Build DOM elements - */ - - }, { - key: 'init', - value: function init() { - var _this2 = this; - - var tf = this.tf; - - if (this.initialized) { - return; - } - - var resetspan = _dom2.default.create('span', ['id', this.prfxResetSpan + tf.id]); - - // reset button is added to defined element - if (!this.btnResetTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom2.default.id(this.btnResetTgtId); - targetEl.appendChild(resetspan); - - if (!this.btnResetHtml) { - var fltreset = _dom2.default.create('a', ['href', 'javascript:void(0);']); - fltreset.className = tf.btnResetCssClass; - fltreset.appendChild(_dom2.default.text(this.btnResetText)); - resetspan.appendChild(fltreset); - _event2.default.add(fltreset, 'click', function () { - _this2.onClick(); - }); - } else { - resetspan.innerHTML = this.btnResetHtml; - var resetEl = resetspan.firstChild; - _event2.default.add(resetEl, 'click', function () { - _this2.onClick(); - }); - } - this.btnResetEl = resetspan.firstChild; - - this.initialized = true; - } - - /** - * Remove clear button UI - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - - if (!this.initialized) { - return; - } - - var resetspan = _dom2.default.id(this.prfxResetSpan + tf.id); - if (resetspan) { - _dom2.default.remove(resetspan); - } - this.btnResetEl = null; - this.initialized = false; - } - }]); - - return ClearButton; - })(_feature.Feature); - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Help = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' + '4.-Filter-operators'; - var WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/'; - - var Help = exports.Help = (function (_Feature) { - _inherits(Help, _Feature); - - /** - * Help UI component - * @param {Object} tf TableFilter instance - */ - - function Help(tf) { - _classCallCheck(this, Help); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Help).call(this, tf, 'help')); - - var f = _this.config; - - //id of custom container element for instructions - _this.tgtId = f.help_instructions_target_id || null; - //id of custom container element for instructions - _this.contTgtId = f.help_instructions_container_target_id || null; - //defines help text - _this.instrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Advanced searches can be performed by using the following ' + 'operators:
<, <=, >, ' + '>=, =, *, !, {, }, ' + '||,&&, [empty], [nonempty], ' + 'rgx:
' + 'Learn more
'; - //defines help innerHtml - _this.instrHtml = f.help_instructions_html || null; - //defines reset button text - _this.btnText = f.help_instructions_btn_text || '?'; - //defines reset button innerHtml - _this.btnHtml = f.help_instructions_btn_html || null; - //defines css class for help button - _this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn'; - //defines css class for help container - _this.contCssClass = f.help_instructions_container_css_class || 'helpCont'; - //help button element - _this.btn = null; - //help content div - _this.cont = null; - _this.defaultHtml = '

TableFilter ' + 'v' + tf.version + '

' + '' + WEBSITE_URL + '' + '
©2015-' + tf.year + ' Max Guglielmi' + '
' + 'Close
'; - - //id prefix for help elements - _this.prfxHelpSpan = 'helpSpan_'; - //id prefix for help elements - _this.prfxHelpDiv = 'helpDiv_'; - return _this; - } - - _createClass(Help, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - var tf = this.tf; - - var helpspan = _dom2.default.create('span', ['id', this.prfxHelpSpan + tf.id]); - var helpdiv = _dom2.default.create('div', ['id', this.prfxHelpDiv + tf.id]); - - //help button is added to defined element - if (!this.tgtId) { - tf.setToolbar(); - } - var targetEl = !this.tgtId ? tf.rDiv : _dom2.default.id(this.tgtId); - targetEl.appendChild(helpspan); - - var divContainer = !this.contTgtId ? helpspan : _dom2.default.id(this.contTgtId); - - if (!this.btnHtml) { - divContainer.appendChild(helpdiv); - var helplink = _dom2.default.create('a', ['href', 'javascript:void(0);']); - helplink.className = this.btnCssClass; - helplink.appendChild(_dom2.default.text(this.btnText)); - helpspan.appendChild(helplink); - _event2.default.add(helplink, 'click', function () { - _this2.toggle(); - }); - } else { - helpspan.innerHTML = this.btnHtml; - var helpEl = helpspan.firstChild; - _event2.default.add(helpEl, 'click', function () { - _this2.toggle(); - }); - divContainer.appendChild(helpdiv); - } - - if (!this.instrHtml) { - helpdiv.innerHTML = this.instrText; - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } else { - if (this.contTgtId) { - divContainer.appendChild(helpdiv); - } - helpdiv.innerHTML = this.instrHtml; - if (!this.contTgtId) { - helpdiv.className = this.contCssClass; - _event2.default.add(helpdiv, 'dblclick', function () { - _this2.toggle(); - }); - } - } - helpdiv.innerHTML += this.defaultHtml; - _event2.default.add(helpdiv, 'click', function () { - _this2.toggle(); - }); - - this.cont = helpdiv; - this.btn = helpspan; - this.initialized = true; - } - - /** - * Toggle help pop-up - */ - - }, { - key: 'toggle', - value: function toggle() { - // check only if explicitily set to false as in this case undefined - // signifies the help feature is enabled by default - if (this.enabled === false) { - return; - } - var divDisplay = this.cont.style.display; - if (divDisplay === '' || divDisplay === 'none') { - this.cont.style.display = 'inline'; - } else { - this.cont.style.display = 'none'; - } - } - - /** - * Remove help UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.initialized) { - return; - } - _dom2.default.remove(this.btn); - this.btn = null; - if (!this.cont) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - this.initialized = false; - } - }]); - - return Help; - })(_feature.Feature); - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.AlternateRows = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var AlternateRows = exports.AlternateRows = (function (_Feature) { - _inherits(AlternateRows, _Feature); - - /** - * Alternating rows color - * @param {Object} tf TableFilter instance - */ - - function AlternateRows(tf) { - _classCallCheck(this, AlternateRows); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AlternateRows).call(this, tf, 'alternateRows')); - - var config = _this.config; - //defines css class for even rows - _this.evenCss = config.even_row_css_class || 'even'; - //defines css class for odd rows - _this.oddCss = config.odd_row_css_class || 'odd'; - return _this; - } - - /** - * Sets alternating rows color - */ - - _createClass(AlternateRows, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - - this.processAll(); - - // Subscribe to events - this.emitter.on(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this2.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.on(['column-sorted'], function () { - return _this2.processAll(); - }); - - this.initialized = true; - } - }, { - key: 'processAll', - value: function processAll() { - if (!this.isEnabled()) { - return; - } - var tf = this.tf; - var validRowsIndex = tf.getValidRows(true); - var noValidRowsIndex = validRowsIndex.length === 0; - //1st index - var beginIndex = noValidRowsIndex ? tf.refRow : 0; - // nb indexes - var indexLen = noValidRowsIndex ? tf.nbFilterableRows + beginIndex : validRowsIndex.length; - var idx = 0; - - //alternates bg color - for (var j = beginIndex; j < indexLen; j++) { - var rowIdx = noValidRowsIndex ? j : validRowsIndex[j]; - this.setRowBg(rowIdx, idx); - idx++; - } - } - - /** - * Set/remove row background based on row validation - * @param {Number} rowIdx Row index - * @param {Boolean} isValid Valid row flag - */ - - }, { - key: 'processRow', - value: function processRow(rowIdx, arrIdx, isValid) { - if (isValid) { - this.setRowBg(rowIdx, arrIdx); - } else { - this.removeRowBg(rowIdx); - } - } - - /** - * Sets row background color - * @param {Number} rowIdx Row index - * @param {Number} idx Valid rows collection index needed to calculate bg - * color - */ - - }, { - key: 'setRowBg', - value: function setRowBg(rowIdx, idx) { - if (!this.isEnabled() || isNaN(rowIdx)) { - return; - } - var rows = this.tf.tbl.rows; - var i = isNaN(idx) ? rowIdx : idx; - this.removeRowBg(rowIdx); - - _dom2.default.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss); - } - - /** - * Removes row background color - * @param {Number} idx Row index - */ - - }, { - key: 'removeRowBg', - value: function removeRowBg(idx) { - if (isNaN(idx)) { - return; - } - var rows = this.tf.tbl.rows; - _dom2.default.removeClass(rows[idx], this.oddCss); - _dom2.default.removeClass(rows[idx], this.evenCss); - } - - /** - * Removes all alternating backgrounds - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - for (var i = this.tf.refRow; i < this.tf.nbRows; i++) { - this.removeRowBg(i); - } - - // Unsubscribe to events - this.emitter.off(['row-processed', 'row-paged'], function (tf, rowIndex, arrIndex, isValid) { - return _this3.processRow(rowIndex, arrIndex, isValid); - }); - this.emitter.off(['column-sorted'], function () { - return _this3.processAll(); - }); - - this.initialized = false; - } - }]); - - return AlternateRows; - })(_feature.Feature); - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.NoResults = undefined; - - var _feature = __webpack_require__(12); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var NoResults = exports.NoResults = (function (_Feature) { - _inherits(NoResults, _Feature); - - /** - * No results message UI component - * @param {Object} tf TableFilter instance - */ - - function NoResults(tf) { - _classCallCheck(this, NoResults); - - //configuration object - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NoResults).call(this, tf, 'noResults')); - - var f = _this.config.no_results_message; - - _this.content = f.content || 'No results'; - _this.customContainer = f.custom_container || null; - _this.customContainerId = f.custom_container_id || null; - _this.isExternal = !_types2.default.isEmpty(_this.customContainer) || !_types2.default.isEmpty(_this.customContainerId); - _this.cssClass = f.css_class || 'no-results'; - - _this.cont = null; - - //callback before message is displayed - _this.onBeforeShowMsg = _types2.default.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null; - //callback after message is displayed - _this.onAfterShowMsg = _types2.default.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null; - //callback before message is hidden - _this.onBeforeHideMsg = _types2.default.isFn(f.on_before_hide_msg) ? f.on_before_hide_msg : null; - //callback after message is hidden - _this.onAfterHideMsg = _types2.default.isFn(f.on_after_hide_msg) ? f.on_after_hide_msg : null; - - _this.prfxNoResults = 'nores_'; - return _this; - } - - _createClass(NoResults, [{ - key: 'init', - value: function init() { - var _this2 = this; - - if (this.initialized) { - return; - } - var tf = this.tf; - var target = this.customContainer || _dom2.default.id(this.customContainerId) || tf.tbl; - - //container - var cont = _dom2.default.create('div', ['id', this.prfxNoResults + tf.id]); - cont.className = this.cssClass; - cont.innerHTML = this.content; - - if (this.isExternal) { - target.appendChild(cont); - } else { - target.parentNode.insertBefore(cont, target.nextSibling); - } - - this.cont = cont; - - // subscribe to after-filtering event - this.emitter.on(['after-filtering'], function () { - return _this2.toggle(); - }); - - this.initialized = true; - this.hide(); - } - }, { - key: 'toggle', - value: function toggle() { - if (this.tf.nbVisibleRows > 0) { - this.hide(); - } else { - this.show(); - } - } - }, { - key: 'show', - value: function show() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeShowMsg) { - this.onBeforeShowMsg.call(null, this.tf, this); - } - - this.setWidth(); - this.cont.style.display = 'block'; - - if (this.onAfterShowMsg) { - this.onAfterShowMsg.call(null, this.tf, this); - } - } - }, { - key: 'hide', - value: function hide() { - if (!this.initialized || !this.isEnabled()) { - return; - } - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - - this.cont.style.display = 'none'; - - if (this.onBeforeHideMsg) { - this.onBeforeHideMsg.call(null, this.tf, this); - } - } - }, { - key: 'setWidth', - value: function setWidth() { - if (!this.initialized || this.isExternal || !this.isEnabled()) { - return; - } - if (this.tf.gridLayout) { - var gridLayout = this.tf.feature('gridLayout'); - this.cont.style.width = gridLayout.tblCont.clientWidth + 'px'; - } else { - this.cont.style.width = this.tf.tbl.clientWidth + 'px'; - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this3 = this; - - if (!this.initialized) { - return; - } - _dom2.default.remove(this.cont); - this.cont = null; - // unsubscribe to after-filtering event - this.emitter.off(['after-filtering'], function () { - return _this3.toggle(); - }); - - this.initialized = false; - } - }]); - - return NoResults; - })(_feature.Feature); - -/***/ } -/******/ ]) -}); -; -//# sourceMappingURL=tablefilter.js.map \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.6",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.emitter.emit("filter-blur",this)},onInpFocus:function(t){var e=o["default"].target(t);this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.emitter.emit("filter-focus",this)}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store||(e.store=new T.Store(this)),e.store.init()),this.gridLayout&&(e.gridLayout||(e.gridLayout=new k.GridLayout(this)),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new O.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new S.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),this.paging&&(e.paging?e.paging.reset():(e.paging=new L.Paging(this),e.paging.init())),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,s=t.length;s>e;e++){var n=t[e];this.ExtRegistry[n.name]||this.loadExtension(n)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),O=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),S),B=x&&_["default"].isValid(t.replace(r,""),S),M=T&&_["default"].isValid(t.replace(f,""),S),A=k&&_["default"].isValid(t.replace(o,""),S),H=P&&_["default"].isValid(t.replace(c,""),S),j=R&&_["default"].isValid(t.replace(g,""),S),V=void 0,U=void 0;if(_["default"].isValid(e,S))V=_["default"].format(e,S),D?(U=_["default"].format(t.replace(h,""),S),s=U>V):B?(U=_["default"].format(t.replace(r,""),S),s=U>=V):A?(U=_["default"].format(t.replace(o,""),S),s=V>=U):M?(U=_["default"].format(t.replace(f,""),S),s=V>U):H?(U=_["default"].format(t.replace(c,""),S),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),S),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,S)?(U=_["default"].format(t,S),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(O){var z=t.replace(b,"");s=e.lastIndexOf(z,e.length-1)===e.length-1-(z.length-1)&&e.lastIndexOf(z,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var G=t.replace(C,""),W=new RegExp(G);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var O=this.searchArgs[this.singleSearchFlt?0:I],S=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==O){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=O.split(this.orOperator),N=L.length>1?!0:!1,D=O.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(O),E,I),t.call(this,O,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive); +""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),O=0;O',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||this.isFirstLoad||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass, +b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;this.isEnabled()||(this.enable(),this.init(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if(!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index de8259b2..5942b0e5 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,2218 +1,8 @@ -webpackJsonp([1],{ +/** + * tablefilter v0.1.6 by Max Guglielmi + * build date: 2016-01-14T08:30:34.759Z + * MIT License + */ -/***/ 26: -/***/ function(module, exports, __webpack_require__) { - - var map = { - "./array": 6, - "./array.js": 6, - "./cookie": 4, - "./cookie.js": 4, - "./date": 7, - "./date.js": 7, - "./dom": 2, - "./dom.js": 2, - "./emitter": 9, - "./emitter.js": 9, - "./event": 1, - "./event.js": 1, - "./extensions/advancedGrid/adapterEzEditTable": 27, - "./extensions/advancedGrid/adapterEzEditTable.js": 27, - "./extensions/advancedGrid/advancedGrid": 28, - "./extensions/advancedGrid/advancedGrid.js": 28, - "./extensions/colOps/colOps": 29, - "./extensions/colOps/colOps.js": 29, - "./extensions/colsVisibility/colsVisibility": 30, - "./extensions/colsVisibility/colsVisibility.js": 30, - "./extensions/filtersVisibility/filtersVisibility": 31, - "./extensions/filtersVisibility/filtersVisibility.js": 31, - "./extensions/sort/adapterSortabletable": 32, - "./extensions/sort/adapterSortabletable.js": 32, - "./extensions/sort/sort": 33, - "./extensions/sort/sort.js": 33, - "./helpers": 8, - "./helpers.js": 8, - "./modules/alternateRows": 24, - "./modules/alternateRows.js": 24, - "./modules/checkList": 18, - "./modules/checkList.js": 18, - "./modules/clearButton": 22, - "./modules/clearButton.js": 22, - "./modules/dropdown": 16, - "./modules/dropdown.js": 16, - "./modules/feature": 12, - "./modules/feature.js": 12, - "./modules/gridLayout": 11, - "./modules/gridLayout.js": 11, - "./modules/help": 23, - "./modules/help.js": 23, - "./modules/highlightKeywords": 14, - "./modules/highlightKeywords.js": 14, - "./modules/loader": 13, - "./modules/loader.js": 13, - "./modules/noResults": 25, - "./modules/noResults.js": 25, - "./modules/paging": 21, - "./modules/paging.js": 21, - "./modules/popupFilter": 15, - "./modules/popupFilter.js": 15, - "./modules/rowsCounter": 19, - "./modules/rowsCounter.js": 19, - "./modules/statusBar": 20, - "./modules/statusBar.js": 20, - "./modules/store": 10, - "./modules/store.js": 10, - "./sort": 17, - "./sort.js": 17, - "./string": 3, - "./string.js": 3, - "./types": 5, - "./types.js": 5 - }; - function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); - }; - function webpackContextResolve(req) { - return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); - }; - webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); - }; - webpackContext.resolve = webpackContextResolve; - module.exports = webpackContext; - webpackContext.id = 26; - - -/***/ }, - -/***/ 27: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterEzEditTable = (function () { - /** - * Adapter module for ezEditTable, an external library providing advanced - * grid features (selection and edition): - * http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus - * - * @param {Object} tf TableFilter instance - */ - - function AdapterEzEditTable(tf, cfg) { - _classCallCheck(this, AdapterEzEditTable); - - // ezEditTable config - this.initialized = false; - this.desc = cfg.description || 'ezEditTable adapter'; - this.filename = cfg.filename || 'ezEditTable.js'; - this.vendorPath = cfg.vendor_path; - this.loadStylesheet = Boolean(cfg.load_stylesheet); - this.stylesheet = cfg.stylesheet || this.vendorPath + 'ezEditTable.css'; - this.stylesheetName = cfg.stylesheet_name || 'ezEditTableCss'; - this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' + 'dependency not found.'; - // Enable the ezEditTable's scroll into view behaviour if grid layout on - cfg.scroll_into_view = cfg.scroll_into_view === false ? false : tf.gridLayout; - - this._ezEditTable = null; - this.cfg = cfg; - this.tf = tf; - this.emitter = tf.emitter; - } - - /** - * Conditionally load ezEditTable library and set advanced grid - * @return {[type]} [description] - */ - - _createClass(AdapterEzEditTable, [{ - key: 'init', - value: function init() { - var _this = this; - - var tf = this.tf; - if (window.EditTable) { - this._setAdvancedGrid(); - } else { - var path = this.vendorPath + this.filename; - tf.import(this.filename, path, function () { - _this._setAdvancedGrid(); - }); - } - if (this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')) { - tf.import(this.stylesheetName, this.stylesheet, null, 'link'); - } - - // TODO: hack to prevent ezEditTable enter key event hijaking. - // Needs to be fixed in the vendor's library - this.emitter.on(['filter-focus', 'filter-blur'], function () { - return _this.toggle(); - }); - } - - /** - * Instantiate ezEditTable component for advanced grid features - */ - - }, { - key: '_setAdvancedGrid', - value: function _setAdvancedGrid() { - var tf = this.tf; - - //start row for EditTable constructor needs to be calculated - var startRow, - cfg = this.cfg, - thead = _dom2.default.tag(tf.tbl, 'thead'); - - //if thead exists and startRow not specified, startRow is calculated - //automatically by EditTable - if (thead.length > 0 && !cfg.startRow) { - startRow = undefined; - } - //otherwise startRow config property if any or TableFilter refRow - else { - startRow = cfg.startRow || tf.refRow; - } - - cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/'; - var editable = cfg.editable; - var selectable = cfg.selection; - - if (selectable) { - cfg.default_selection = cfg.default_selection || 'row'; - } - //CSS Styles - cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell'; - - var _lastValidRowIndex = 0; - var _lastRowIndex = 0; - - if (selectable) { - //Row navigation needs to be calculated according to TableFilter's - //validRowsIndex array - var onAfterSelection = function onAfterSelection(et, selectedElm, e) { - var slc = et.Selection; - //Next valid filtered row needs to be selected - var doSelect = function doSelect(nextRowIndex) { - if (et.defaultSelection === 'row') { - slc.SelectRowByIndex(nextRowIndex); - } else { - et.ClearSelections(); - var cellIndex = selectedElm.cellIndex, - row = tf.tbl.rows[nextRowIndex]; - if (et.defaultSelection === 'both') { - slc.SelectRowByIndex(nextRowIndex); - } - if (row) { - slc.SelectCell(row.cells[cellIndex]); - } - } - //Table is filtered - if (tf.validRowsIndex.length !== tf.getRowsNb()) { - var r = tf.tbl.rows[nextRowIndex]; - if (r) { - r.scrollIntoView(false); - } - if (cell) { - if (cell.cellIndex === tf.getCellsNb() - 1 && tf.gridLayout) { - tf.tblCont.scrollLeft = 100000000; - } else if (cell.cellIndex === 0 && tf.gridLayout) { - tf.tblCont.scrollLeft = 0; - } else { - cell.scrollIntoView(false); - } - } - } - }; - - //table is not filtered - if (!tf.validRowsIndex) { - return; - } - var validIndexes = tf.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 = validIndexes.indexOf(row.rowIndex) !== -1, - nextRowIndex, - paging = tf.feature('paging'), - - //pgup/pgdown keys - d = keyCode === 34 || keyCode === 33 ? paging && paging.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 > _lastRowIndex) { - //last row - if (row.rowIndex >= validIndexes[validIdxLen - 1]) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - var calcRowIndex = _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[_lastValidRowIndex - d]; - nextRowIndex = v ? v : validIndexes[0]; - } - } - _lastRowIndex = row.rowIndex; - doSelect(nextRowIndex); - } else { - //If filtered row is valid, special calculation for - //pgup/pgdown keys - if (keyCode !== 34 && keyCode !== 33) { - _lastValidRowIndex = validIndexes.indexOf(row.rowIndex); - _lastRowIndex = row.rowIndex; - } else { - if (keyCode === 34) { - //pgdown - //last row - if (_lastValidRowIndex + d <= validIdxLen - 1) { - nextRowIndex = validIndexes[_lastValidRowIndex + d]; - } else { - nextRowIndex = [validIdxLen - 1]; - } - } else { - //pgup - //first row - if (_lastValidRowIndex - d <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - nextRowIndex = validIndexes[_lastValidRowIndex - d]; - } - } - _lastRowIndex = nextRowIndex; - _lastValidRowIndex = validIndexes.indexOf(nextRowIndex); - doSelect(nextRowIndex); - } - } - }; - - //Page navigation has to be enforced whenever selected row is out of - //the current page range - var onBeforeSelection = function onBeforeSelection(et, selectedElm) { - var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm; - if (tf.paging) { - if (tf.feature('paging').nbPages > 1) { - var paging = tf.feature('paging'); - //page length is re-assigned in case it has changed - et.nbRowsPerPage = paging.pagingLength; - var validIndexes = tf.validRowsIndex, - validIdxLen = validIndexes.length, - pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10); - var rowIndex = row.rowIndex; - - if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) { - paging.setPage('last'); - } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) { - paging.setPage('first'); - } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { - paging.setPage('next'); - } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) { - paging.setPage('previous'); - } - } - } - }; - - //Selected row needs to be visible when paging is activated - if (tf.paging) { - tf.feature('paging').onAfterChangePage = function (paging) { - var advGrid = paging.tf.extension('advancedGrid'); - var et = advGrid._ezEditTable; - var slc = et.Selection; - var row = slc.GetActiveRow(); - if (row) { - row.scrollIntoView(false); - } - var cell = slc.GetActiveCell(); - if (cell) { - cell.scrollIntoView(false); - } - }; - } - - //Rows navigation when rows are filtered is performed with the - //EditTable row selection callback events - if (cfg.default_selection === 'row') { - var fnB = cfg.on_before_selected_row; - cfg.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 = cfg.on_after_selected_row; - cfg.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 = cfg.on_before_selected_cell; - cfg.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 = cfg.on_after_selected_cell; - cfg.on_after_selected_cell = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnC) { - fnC.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - } - } - if (editable) { - //Added or removed rows, TF rows number needs to be re-calculated - var fnE = cfg.on_added_dom_row; - cfg.on_added_dom_row = function () { - tf.nbFilterableRows++; - if (!tf.paging) { - tf.emitter.emit('rows-changed', tf, this); - //tf.feature('rowsCounter').refresh(); - } else { - tf.nbRows++; - tf.nbVisibleRows++; - tf.nbFilterableRows++; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnE) { - fnE.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - if (cfg.actions && cfg.actions['delete']) { - var fnF = cfg.actions['delete'].on_after_submit; - cfg.actions['delete'].on_after_submit = function () { - tf.nbFilterableRows--; - if (!tf.paging) { - // tf.feature('rowsCounter').refresh(); - tf.emitter.emit('rows-changed', tf, this); - } else { - tf.nbRows--; - tf.nbVisibleRows--; - tf.nbFilterableRows--; - tf.paging = false; - tf.feature('paging').destroy(); - tf.feature('paging').reset(false); - } - if (tf.alternateRows) { - tf.feature('alternateRows').init(); - } - if (fnF) { - fnF.call(null, arguments[0], arguments[1]); - } - }; - } - } - - try { - this._ezEditTable = new EditTable(tf.id, cfg, startRow); - this._ezEditTable.Init(); - } catch (e) { - throw new Error(this.err); - } - - this.initialized = true; - } - - /** - * Reset advanced grid when previously removed - */ - - }, { - key: 'reset', - value: function reset() { - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.Set(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Set(); - } - } - } - - /** - * Toggle behaviour - */ - - }, { - key: 'toggle', - value: function toggle() { - var ezEditTable = this._ezEditTable; - if (ezEditTable.editable) { - ezEditTable.Editable.Remove(); - } else { - ezEditTable.Editable.Set(); - } - if (ezEditTable.selection) { - ezEditTable.Selection.Remove(); - } else { - ezEditTable.Selection.Set(); - } - } - - /** - * Remove advanced grid - */ - - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - var ezEditTable = this._ezEditTable; - if (ezEditTable) { - if (this.cfg.selection) { - ezEditTable.Selection.ClearSelections(); - ezEditTable.Selection.Remove(); - } - if (this.cfg.editable) { - ezEditTable.Editable.Remove(); - } - } - - this.emitter.off(['filter-focus', 'filter-blur'], function () { - return _this2.toggle(); - }); - this.initialized = false; - } - }]); - - return AdapterEzEditTable; - })(); - - exports.default = AdapterEzEditTable; - -/***/ }, - -/***/ 28: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterEzEditTable = __webpack_require__(27); - - var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _adapterEzEditTable2.default; - -/***/ }, - -/***/ 29: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _string = __webpack_require__(3); - - var _string2 = _interopRequireDefault(_string); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColOps = (function () { - - /** - * Column calculations - * @param {Object} tf TableFilter instance - */ - - function ColOps(tf, opts) { - _classCallCheck(this, ColOps); - - //calls function before col operation - this.onBeforeOperation = _types2.default.isFn(opts.on_before_operation) ? opts.on_before_operation : null; - //calls function after col operation - this.onAfterOperation = _types2.default.isFn(opts.on_after_operation) ? opts.on_after_operation : null; - - this.opts = opts; - this.tf = tf; - } - - _createClass(ColOps, [{ - key: 'init', - value: function init() { - var _this = this; - - // subscribe to events - this.tf.emitter.on(['after-filtering'], function () { - return _this.calc(); - }); - - this.calc(); - } - - /** - * Calculates columns' values - * Configuration options are stored in 'opts' property - * - 'id' contains ids of elements showing result (array) - * - 'col' contains the columns' indexes (array) - * - 'operation' contains operation type (array, values: 'sum', 'mean', - * 'min', 'max', 'median', 'q1', 'q3') - * - 'write_method' array defines which method to use for displaying the - * result (innerHTML, setValue, createTextNode) - default: 'innerHTML' - * - 'tot_row_index' defines in which row results are displayed - * (integers array) - * - * - changes made by Nuovella: - * (1) optimized the routine (now it will only process each column once), - * (2) added calculations for the median, lower and upper quartile. - */ - - }, { - key: 'calc', - value: function calc() { - var tf = this.tf; - if (!tf.isFirstLoad && !tf.hasGrid()) { - return; - } - - if (this.onBeforeOperation) { - this.onBeforeOperation.call(null, tf); - } - - var opts = this.opts, - labelId = opts.id, - colIndex = opts.col, - operation = opts.operation, - outputType = opts.write_method, - totRowIndex = opts.tot_row_index, - excludeRow = opts.exclude_row, - decimalPrecision = _types2.default.isUndef(opts.decimal_precision) ? 2 : opts.decimal_precision; - - //nuovella: determine unique list of columns to operate on - var ucolIndex = [], - ucolMax = 0; - ucolIndex[ucolMax] = colIndex[0]; - - for (var ii = 1; ii < colIndex.length; ii++) { - var saved = 0; - //see if colIndex[ii] is already in the list of unique indexes - for (var jj = 0; jj <= ucolMax; jj++) { - if (ucolIndex[jj] === colIndex[ii]) { - saved = 1; - } - } - //if not saved then, save the index; - if (saved === 0) { - ucolMax++; - ucolIndex[ucolMax] = colIndex[ii]; - } - } - - if (_string2.default.lower(typeof labelId === 'undefined' ? 'undefined' : _typeof(labelId)) == 'object' && _string2.default.lower(typeof colIndex === 'undefined' ? 'undefined' : _typeof(colIndex)) == 'object' && _string2.default.lower(typeof operation === 'undefined' ? 'undefined' : _typeof(operation)) == 'object') { - var rows = tf.tbl.rows, - colvalues = []; - - for (var ucol = 0; ucol <= ucolMax; ucol++) { - //this retrieves col values - //use ucolIndex because we only want to pass through this loop - //once for each column get the values in this unique column - colvalues.push(tf.getColValues(ucolIndex[ucol], false, true, excludeRow)); - - //next: calculate all operations for this column - 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; - - for (var k = 0; k < colIndex.length; k++) { - if (colIndex[k] === ucolIndex[ucol]) { - mThisCol++; - opsThisCol[mThisCol] = _string2.default.lower(operation[k]); - decThisCol[mThisCol] = decimalPrecision[k]; - labThisCol[mThisCol] = labelId[k]; - oTypeThisCol = outputType !== undefined && _string2.default.lower(typeof outputType === 'undefined' ? 'undefined' : _typeof(outputType)) === 'object' ? outputType[k] : null; - - switch (opsThisCol[mThisCol]) { - case 'mean': - meanFlag = 1; - break; - case 'sum': - sumFlag = 1; - break; - case 'min': - minFlag = 1; - break; - case 'max': - maxFlag = 1; - break; - case 'median': - medFlag = 1; - break; - case 'q1': - q1Flag = 1; - break; - case 'q3': - q3Flag = 1; - break; - } - } - } - - for (var j = 0; j < colvalues[ucol].length; j++) { - //sort the list for calculation of median and quartiles - if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) { - if (j < colvalues[ucol].length - 1) { - for (k = j + 1; k < colvalues[ucol].length; k++) { - if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) { - temp = colvalues[ucol][j]; - colvalues[ucol][j] = colvalues[ucol][k]; - colvalues[ucol][k] = temp; - } - } - } - } - var cvalue = parseFloat(colvalues[ucol][j]); - theList[j] = parseFloat(cvalue); - - if (!isNaN(cvalue)) { - nbvalues++; - if (sumFlag === 1 || meanFlag === 1) { - sumValue += parseFloat(cvalue); - } - if (minFlag === 1) { - if (minValue === null) { - minValue = parseFloat(cvalue); - } else { - minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue; - } - } - if (maxFlag === 1) { - if (maxValue === null) { - maxValue = parseFloat(cvalue); - } else { - maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue; - } - } - } - } //for j - if (meanFlag === 1) { - meanValue = sumValue / nbvalues; - } - if (medFlag === 1) { - var aux = 0; - if (nbvalues % 2 === 1) { - aux = Math.floor(nbvalues / 2); - medValue = theList[aux]; - } else { - medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2; - } - } - var posa; - if (q1Flag === 1) { - posa = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa == nbvalues) { - q1Value = (theList[posa - 1] + theList[posa]) / 2; - } else { - q1Value = theList[posa]; - } - } - if (q3Flag === 1) { - posa = 0.0; - var posb = 0.0; - posa = Math.floor(nbvalues / 4); - if (4 * posa === nbvalues) { - posb = 3 * posa; - q3Value = (theList[posb] + theList[posb - 1]) / 2; - } else { - q3Value = theList[nbvalues - posa - 1]; - } - } - - for (var i = 0; i <= mThisCol; i++) { - switch (opsThisCol[i]) { - case 'mean': - result = meanValue; - break; - case 'sum': - result = sumValue; - break; - case 'min': - result = minValue; - break; - case 'max': - result = maxValue; - break; - case 'median': - result = medValue; - break; - case 'q1': - result = q1Value; - break; - case 'q3': - result = q3Value; - break; - } - - var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2; - - //if outputType is defined - if (oTypeThisCol && result) { - result = result.toFixed(precision); - - if (_dom2.default.id(labThisCol[i])) { - switch (_string2.default.lower(oTypeThisCol)) { - case 'innerhtml': - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result; - } - break; - case 'setvalue': - _dom2.default.id(labThisCol[i]).value = result; - break; - case 'createtextnode': - var oldnode = _dom2.default.id(labThisCol[i]).firstChild; - var txtnode = _dom2.default.text(result); - _dom2.default.id(labThisCol[i]).replaceChild(txtnode, oldnode); - break; - } //switch - } - } else { - try { - if (isNaN(result) || !isFinite(result) || nbvalues === 0) { - _dom2.default.id(labThisCol[i]).innerHTML = '.'; - } else { - _dom2.default.id(labThisCol[i]).innerHTML = result.toFixed(precision); - } - } catch (e) {} //catch - } //else - } //for i - - // row(s) with result are always visible - var totRow = totRowIndex && totRowIndex[ucol] ? rows[totRowIndex[ucol]] : null; - if (totRow) { - totRow.style.display = ''; - } - } //for ucol - } //if typeof - - if (this.onAfterOperation) { - this.onAfterOperation.call(null, tf); - } - } - }, { - key: 'destroy', - value: function destroy() { - var _this2 = this; - - // unsubscribe to events - this.tf.emitter.off(['after-filtering'], function () { - return _this2.calc(); - }); - } - }]); - - return ColOps; - })(); - - exports.default = ColOps; - -/***/ }, - -/***/ 30: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var ColsVisibility = (function () { - - /** - * Columns Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function ColsVisibility(tf, f) { - _classCallCheck(this, ColsVisibility); - - // Configuration object - var cfg = tf.config(); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Columns visibility manager'; - - //show/hide cols span element - this.spanEl = null; - //show/hide cols button element - this.btnEl = null; - //show/hide cols container div element - this.contEl = null; - - //tick to hide or show column - this.tickToHide = f.tick_to_hide === false ? false : true; - //enables/disables cols manager generation - this.manager = f.manager === false ? false : true; - //only if external headers - this.headersTbl = f.headers_table || false; - //only if external headers - this.headersIndex = f.headers_index || 1; - //id of container element - this.contElTgtId = f.container_target_id || null; - //alternative headers text - this.headersText = f.headers_text || null; - //id of button container element - this.btnTgtId = f.btn_target_id || null; - //defines show/hide cols text - this.btnText = f.btn_text || 'Columns▼'; - //defines show/hide cols button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for show/hide cols button - this.btnCssClass = f.btn_css_class || 'colVis'; - //defines close link text - this.btnCloseText = f.btn_close_text || 'Close'; - //defines close button innerHtml - this.btnCloseHtml = f.btn_close_html || null; - //defines css class for close button - this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass; - this.stylesheet = f.stylesheet || 'colsVisibility.css'; - //span containing show/hide cols button - this.prfx = 'colVis_'; - //defines css class span containing show/hide cols - this.spanCssClass = f.span_css_class || 'colVisSpan'; - this.prfxCont = this.prfx + 'Cont_'; - //defines css class div containing show/hide cols - this.contCssClass = f.cont_css_class || 'colVisCont'; - //defines css class for cols list (ul) - this.listCssClass = cfg.list_css_class || 'cols_checklist'; - //defines css class for list item (li) - this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item'; - //defines css class for selected list item (li) - this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item'; - //text preceding columns list - this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: '); - this.atStart = f.at_start || null; - this.enableHover = Boolean(f.enable_hover); - //enables select all option - this.enableTickAll = Boolean(f.enable_tick_all); - //text preceding columns list - this.tickAllText = f.tick_all_text || 'Select all:'; - - //array containing hidden columns indexes - this.hiddenCols = []; - this.tblHasColTag = _dom2.default.tag(tf.tbl, 'col').length > 0; - - //callback invoked just after cols manager is loaded - this.onLoaded = _types2.default.isFn(f.on_loaded) ? f.on_loaded : null; - //calls function before cols manager is opened - this.onBeforeOpen = _types2.default.isFn(f.on_before_open) ? f.on_before_open : null; - //calls function after cols manager is opened - this.onAfterOpen = _types2.default.isFn(f.on_after_open) ? f.on_after_open : null; - //calls function before cols manager is closed - this.onBeforeClose = _types2.default.isFn(f.on_before_close) ? f.on_before_close : null; - //calls function after cols manager is closed - this.onAfterClose = _types2.default.isFn(f.on_after_close) ? f.on_after_close : null; - - //callback before col is hidden - this.onBeforeColHidden = _types2.default.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null; - //callback after col is hidden - this.onAfterColHidden = _types2.default.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null; - //callback before col is displayed - this.onBeforeColDisplayed = _types2.default.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null; - //callback after col is displayed - this.onAfterColDisplayed = _types2.default.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null; - - //Grid layout compatibility - if (tf.gridLayout) { - this.headersTbl = tf.feature('gridLayout').headTbl; //headers table - this.headersIndex = 0; //headers index - this.onAfterColDisplayed = function () {}; - this.onAfterColHidden = function () {}; - } - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - _createClass(ColsVisibility, [{ - key: 'toggle', - value: function toggle() { - var contDisplay = this.contEl.style.display; - var onBeforeOpen = this.onBeforeOpen; - var onBeforeClose = this.onBeforeClose; - var onAfterOpen = this.onAfterOpen; - var onAfterClose = this.onAfterClose; - - if (onBeforeOpen && contDisplay !== 'inline') { - onBeforeOpen.call(null, this); - } - if (onBeforeClose && contDisplay === 'inline') { - onBeforeClose.call(null, this); - } - - this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline'; - - if (onAfterOpen && contDisplay !== 'inline') { - onAfterOpen.call(null, this); - } - if (onAfterClose && contDisplay === 'inline') { - onAfterClose.call(null, this); - } - } - }, { - key: 'checkItem', - value: function checkItem(lbl) { - var li = lbl.parentNode; - if (!li || !lbl) { - return; - } - var isChecked = lbl.firstChild.checked; - var colIndex = lbl.firstChild.getAttribute('id').split('_')[1]; - colIndex = parseInt(colIndex, 10); - if (isChecked) { - _dom2.default.addClass(li, this.listSlcItemCssClass); - } else { - _dom2.default.removeClass(li, this.listSlcItemCssClass); - } - - var hide = false; - if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) { - hide = true; - } - this.setHidden(colIndex, hide); - } - }, { - key: 'init', - value: function init() { - if (!this.manager) { - return; - } - this.buildBtn(); - this.buildManager(); - - this.initialized = true; - } - - /** - * Build main button UI - */ - - }, { - key: 'buildBtn', - value: function buildBtn() { - var _this = this; - - if (this.btnEl) { - return; - } - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.spanCssClass; - - //Container element (rdiv or custom element) - if (!this.btnTgtId) { - tf.setToolbar(); - } - var targetEl = !this.btnTgtId ? tf.rDiv : _dom2.default.id(this.btnTgtId); - - if (!this.btnTgtId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - if (!this.btnHtml) { - var btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCssClass; - btn.title = this.desc; - - btn.innerHTML = this.btnText; - span.appendChild(btn); - if (!this.enableHover) { - _event2.default.add(btn, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(btn, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } else { - //Custom html - span.innerHTML = this.btnHtml; - var colVisEl = span.firstChild; - if (!this.enableHover) { - _event2.default.add(colVisEl, 'click', function (evt) { - _this.toggle(evt); - }); - } else { - _event2.default.add(colVisEl, 'mouseover', function (evt) { - _this.toggle(evt); - }); - } - } - - this.spanEl = span; - this.btnEl = this.spanEl.firstChild; - - if (this.onLoaded) { - this.onLoaded.call(null, this); - } - } - - /** - * Build columns manager UI - */ - - }, { - key: 'buildManager', - value: function buildManager() { - var _this2 = this; - - var tf = this.tf; - - var container = !this.contElTgtId ? _dom2.default.create('div', ['id', this.prfxCont + tf.id]) : _dom2.default.id(this.contElTgtId); - container.className = this.contCssClass; - - //Extension description - var extNameLabel = _dom2.default.create('p'); - extNameLabel.innerHTML = this.text; - container.appendChild(extNameLabel); - - //Headers list - var ul = _dom2.default.create('ul', ['id', 'ul' + this.name + '_' + tf.id]); - ul.className = this.listCssClass; - - var tbl = this.headersTbl ? this.headersTbl : tf.tbl; - var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex(); - var headerRow = tbl.rows[headerIndex]; - - //Tick all option - if (this.enableTickAll) { - var li = _dom2.default.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText); - _dom2.default.addClass(li, this.listItemCssClass); - ul.appendChild(li); - li.check.checked = !this.tickToHide; - - _event2.default.add(li.check, 'click', function () { - for (var h = 0; h < headerRow.cells.length; h++) { - var itm = _dom2.default.id('col_' + h + '_' + tf.id); - if (itm && li.check.checked !== itm.checked) { - itm.click(); - itm.checked = li.check.checked; - } - } - }); - } - - for (var i = 0; i < headerRow.cells.length; i++) { - var cell = headerRow.cells[i]; - var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell); - var liElm = _dom2.default.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText); - _dom2.default.addClass(liElm, this.listItemCssClass); - if (!this.tickToHide) { - _dom2.default.addClass(liElm, this.listSlcItemCssClass); - } - ul.appendChild(liElm); - if (!this.tickToHide) { - liElm.check.checked = true; - } - - _event2.default.add(liElm.check, 'click', function (evt) { - var elm = _event2.default.target(evt); - var lbl = elm.parentNode; - _this2.checkItem(lbl); - }); - } - - //separator - var p = _dom2.default.create('p', ['align', 'center']); - var btn; - //Close link - if (!this.btnCloseHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:;']); - btn.className = this.btnCloseCssClass; - btn.innerHTML = this.btnCloseText; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - p.appendChild(btn); - } else { - p.innerHTML = this.btnCloseHtml; - btn = p.firstChild; - _event2.default.add(btn, 'click', function (evt) { - _this2.toggle(evt); - }); - } - - container.appendChild(ul); - container.appendChild(p); - - this.btnEl.parentNode.insertBefore(container, this.btnEl); - this.contEl = container; - - if (this.atStart) { - var a = this.atStart; - for (var k = 0; k < a.length; k++) { - var itm = _dom2.default.id('col_' + a[k] + '_' + tf.id); - if (itm) { - itm.click(); - } - } - } - } - - /** - * Hide or show specified columns - * @param {Numner} colIndex Column index - * @param {Boolean} hide hide column if true or show if false - */ - - }, { - key: 'setHidden', - value: function setHidden(colIndex, hide) { - var tf = this.tf; - var tbl = tf.tbl; - - if (this.onBeforeColHidden && hide) { - this.onBeforeColHidden.call(null, this, colIndex); - } - if (this.onBeforeColDisplayed && !hide) { - this.onBeforeColDisplayed.call(null, this, colIndex); - } - - this._hideCells(tbl, colIndex, hide); - if (this.headersTbl) { - this._hideCells(this.headersTbl, colIndex, hide); - } - - var hiddenCols = this.hiddenCols; - var itemIndex = hiddenCols.indexOf(colIndex); - if (hide) { - if (itemIndex === -1) { - this.hiddenCols.push(colIndex); - } - } else { - if (itemIndex !== -1) { - this.hiddenCols.splice(itemIndex, 1); - } - } - - var gridLayout; - var headTbl; - var gridColElms; - if (this.onAfterColHidden && hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var hiddenWidth = parseInt(gridColElms[colIndex].style.width, 10); - - var headTblW = parseInt(headTbl.style.width, 10); - headTbl.style.width = headTblW - hiddenWidth + 'px'; - tbl.style.width = headTbl.style.width; - } - this.onAfterColHidden.call(null, this, colIndex); - } - - if (this.onAfterColDisplayed && !hide) { - //This event is fired just after a column is displayed for - //grid_layout support - //TODO: grid layout module should be responsible for those - //calculations - if (tf.gridLayout) { - gridLayout = tf.feature('gridLayout'); - headTbl = gridLayout.headTbl; - gridColElms = gridLayout.gridColElms; - var width = parseInt(gridColElms[colIndex].style.width, 10); - headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px'; - tf.tbl.style.width = headTbl.style.width; - } - this.onAfterColDisplayed.call(null, this, colIndex); - } - } - - /** - * Show specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'showCol', - value: function showCol(colIndex) { - if (colIndex === undefined || !this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, false); - } - } - - /** - * Hide specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'hideCol', - value: function hideCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - return; - } - if (this.manager && this.contEl) { - var itm = _dom2.default.id('col_' + colIndex + '_' + this.tf.id); - if (itm) { - itm.click(); - } - } else { - this.setHidden(colIndex, true); - } - } - - /** - * Determine if specified column is hidden - * @param {Number} colIndex Column index - */ - - }, { - key: 'isColHidden', - value: function isColHidden(colIndex) { - if (this.hiddenCols.indexOf(colIndex) !== -1) { - return true; - } - return false; - } - - /** - * Toggle visibility of specified column - * @param {Number} colIndex Column index - */ - - }, { - key: 'toggleCol', - value: function toggleCol(colIndex) { - if (colIndex === undefined || this.isColHidden(colIndex)) { - this.showCol(colIndex); - } else { - this.hideCol(colIndex); - } - } - - /** - * Returns the indexes of the columns currently hidden - * @return {Array} column indexes - */ - - }, { - key: 'getHiddenCols', - value: function getHiddenCols() { - return this.hiddenCols; - } - - /** - * Remove the columns manager - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - if (_dom2.default.id(this.contElTgtId)) { - _dom2.default.id(this.contElTgtId).innerHTML = ''; - } else { - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - } - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - this.initialized = false; - } - }, { - key: '_getHeaderText', - value: function _getHeaderText(cell) { - if (!cell.hasChildNodes) { - return ''; - } - - for (var i = 0; i < cell.childNodes.length; i++) { - var n = cell.childNodes[i]; - if (n.nodeType === 3) { - return n.nodeValue; - } else if (n.nodeType === 1) { - if (n.id && n.id.indexOf('popUp') !== -1) { - continue; - } else { - return _dom2.default.getText(n); - } - } - continue; - } - return ''; - } - }, { - key: '_hideCells', - value: function _hideCells(tbl, colIndex, hide) { - for (var i = 0; i < tbl.rows.length; i++) { - var row = tbl.rows[i]; - var cell = row.cells[colIndex]; - if (cell) { - cell.style.display = hide ? 'none' : ''; - } - } - } - }]); - - return ColsVisibility; - })(); - - exports.default = ColsVisibility; - -/***/ }, - -/***/ 31: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var FiltersVisibility = (function () { - - /** - * Filters Row Visibility extension - * @param {Object} tf TableFilter instance - * @param {Object} f Config - */ - - function FiltersVisibility(tf, f) { - _classCallCheck(this, FiltersVisibility); - - this.initialized = false; - this.name = f.name; - this.desc = f.description || 'Filters row visibility manager'; - - // Path and image filenames - this.stylesheet = f.stylesheet || 'filtersVisibility.css'; - this.icnExpand = f.expand_icon_name || 'icn_exp.png'; - this.icnCollapse = f.collapse_icon_name || 'icn_clp.png'; - - //expand/collapse filters span element - this.contEl = null; - //expand/collapse filters btn element - this.btnEl = null; - - this.icnExpandHtml = 'Expand filters'; - this.icnCollapseHtml = 'Collapse filters'; - this.defaultText = 'Toggle filters'; - - //id of container element - this.targetId = f.target_id || null; - //enables/disables expand/collapse icon - this.enableIcon = f.enable_icon === false ? false : true; - this.btnText = f.btn_text || ''; - - //defines expand/collapse filters text - this.collapseBtnHtml = this.enableIcon ? this.icnCollapseHtml + this.btnText : this.btnText || this.defaultText; - this.expandBtnHtml = this.enableIcon ? this.icnExpandHtml + this.btnText : this.btnText || this.defaultText; - - //defines expand/collapse filters button innerHtml - this.btnHtml = f.btn_html || null; - //defines css class for expand/collapse filters button - this.btnCssClass = f.btn_css_class || 'btnExpClpFlt'; - //defines css class span containing expand/collapse filters - this.contCssClass = f.cont_css_class || 'expClpFlt'; - this.filtersRowIndex = !_types2.default.isUndef(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex(); - - this.visibleAtStart = !_types2.default.isUndef(f.visible_at_start) ? Boolean(f.visible_at_start) : true; - - // Prefix - this.prfx = 'fltsVis_'; - - //callback before filters row is shown - this.onBeforeShow = _types2.default.isFn(f.on_before_show) ? f.on_before_show : null; - //callback after filters row is shown - this.onAfterShow = _types2.default.isFn(f.on_after_show) ? f.on_after_show : null; - //callback before filters row is hidden - this.onBeforeHide = _types2.default.isFn(f.on_before_hide) ? f.on_before_hide : null; - //callback after filters row is hidden - this.onAfterHide = _types2.default.isFn(f.on_after_hide) ? f.on_after_hide : null; - - //Loads extension stylesheet - tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null, 'link'); - - this.tf = tf; - } - - /** - * Initialise extension - */ - - _createClass(FiltersVisibility, [{ - key: 'init', - value: function init() { - if (this.initialized) { - return; - } - - this.buildUI(); - this.initialized = true; - } - - /** - * Build UI elements - */ - - }, { - key: 'buildUI', - value: function buildUI() { - var _this = this; - - var tf = this.tf; - var span = _dom2.default.create('span', ['id', this.prfx + tf.id]); - span.className = this.contCssClass; - - //Container element (rdiv or custom element) - if (!this.targetId) { - tf.setToolbar(); - } - var targetEl = !this.targetId ? tf.rDiv : _dom2.default.id(this.targetId); - - if (!this.targetId) { - var firstChild = targetEl.firstChild; - firstChild.parentNode.insertBefore(span, firstChild); - } else { - targetEl.appendChild(span); - } - - var btn = undefined; - if (!this.btnHtml) { - btn = _dom2.default.create('a', ['href', 'javascript:void(0);']); - btn.className = this.btnCssClass; - btn.title = this.btnText || this.defaultText; - btn.innerHTML = this.collapseBtnHtml; - span.appendChild(btn); - } else { - //Custom html - span.innerHTML = this.btnHtml; - btn = span.firstChild; - } - - _event2.default.add(btn, 'click', function () { - return _this.toggle(); - }); - - this.contEl = span; - this.btnEl = btn; - - if (!this.visibleAtStart) { - this.toggle(); - } - } - - /** - * Toggle filters visibility - */ - - }, { - key: 'toggle', - value: function toggle() { - var tf = this.tf; - var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl; - var fltRow = tbl.rows[this.filtersRowIndex]; - var fltRowDisplay = fltRow.style.display; - - if (this.onBeforeShow && fltRowDisplay !== '') { - this.onBeforeShow.call(this, this); - } - if (this.onBeforeHide && fltRowDisplay === '') { - this.onBeforeHide.call(null, this); - } - - fltRow.style.display = fltRowDisplay === '' ? 'none' : ''; - if (this.enableIcon && !this.btnHtml) { - this.btnEl.innerHTML = fltRowDisplay === '' ? this.expandBtnHtml : this.collapseBtnHtml; - } - - if (this.onAfterShow && fltRowDisplay !== '') { - this.onAfterShow.call(null, this); - } - if (this.onAfterHide && fltRowDisplay === '') { - this.onAfterHide.call(null, this); - } - } - - /** - * Destroy the UI - */ - - }, { - key: 'destroy', - value: function destroy() { - if (!this.btnEl && !this.contEl) { - return; - } - - this.btnEl.innerHTML = ''; - _dom2.default.remove(this.btnEl); - this.btnEl = null; - - this.contEl.innerHTML = ''; - _dom2.default.remove(this.contEl); - this.contEl = null; - this.initialized = false; - } - }]); - - return FiltersVisibility; - })(); - - exports.default = FiltersVisibility; - -/***/ }, - -/***/ 32: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _types = __webpack_require__(5); - - var _types2 = _interopRequireDefault(_types); - - var _dom = __webpack_require__(2); - - var _dom2 = _interopRequireDefault(_dom); - - var _event = __webpack_require__(1); - - var _event2 = _interopRequireDefault(_event); - - var _date = __webpack_require__(7); - - var _date2 = _interopRequireDefault(_date); - - var _helpers = __webpack_require__(8); - - var _helpers2 = _interopRequireDefault(_helpers); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var AdapterSortableTable = (function () { - - /** - * SortableTable Adapter module - * @param {Object} tf TableFilter instance - */ - - function AdapterSortableTable(tf, opts) { - _classCallCheck(this, AdapterSortableTable); - - this.initialized = false; - this.name = opts.name; - this.desc = opts.description || 'Sortable table'; - - //indicates if tables was sorted - this.sorted = false; - - this.sortTypes = _types2.default.isArray(opts.types) ? opts.types : []; - this.sortColAtStart = _types2.default.isArray(opts.sort_col_at_start) ? opts.sort_col_at_start : null; - this.asyncSort = Boolean(opts.async_sort); - this.triggerIds = _types2.default.isArray(opts.trigger_ids) ? opts.trigger_ids : []; - - // edit .sort-arrow.descending / .sort-arrow.ascending in - // tablefilter.css to reflect any path change - this.imgPath = opts.images_path || tf.themesPath; - this.imgBlank = opts.image_blank || 'blank.png'; - this.imgClassName = opts.image_class_name || 'sort-arrow'; - this.imgAscClassName = opts.image_asc_class_name || 'ascending'; - this.imgDescClassName = opts.image_desc_class_name || 'descending'; - //cell attribute storing custom key - this.customKey = opts.custom_key || 'data-tf-sortKey'; - - // callback invoked after sort is loaded and instanciated - this.onSortLoaded = _types2.default.isFn(opts.on_sort_loaded) ? opts.on_sort_loaded : null; - // callback invoked before table is sorted - this.onBeforeSort = _types2.default.isFn(opts.on_before_sort) ? opts.on_before_sort : null; - // callback invoked after table is sorted - this.onAfterSort = _types2.default.isFn(opts.on_after_sort) ? opts.on_after_sort : null; - - this.tf = tf; - this.emitter = tf.emitter; - } - - _createClass(AdapterSortableTable, [{ - key: 'init', - value: function init() { - var tf = this.tf; - var adpt = this; - - // SortableTable class sanity check (sortabletable.js) - if (_types2.default.isUndef(SortableTable)) { - throw new Error('SortableTable class not found.'); - } - - this.overrideSortableTable(); - this.setSortTypes(); - - //Column sort at start - var sortColAtStart = adpt.sortColAtStart; - if (sortColAtStart) { - this.stt.sort(sortColAtStart[0], sortColAtStart[1]); - } - - if (this.onSortLoaded) { - this.onSortLoaded.call(null, tf, this); - } - - /*** SortableTable callbacks ***/ - this.stt.onbeforesort = function () { - if (adpt.onBeforeSort) { - adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn); - } - - /*** sort behaviour for paging ***/ - if (tf.paging) { - tf.feature('paging').disable(); - } - }; - - this.stt.onsort = function () { - adpt.sorted = true; - - //sort behaviour for paging - if (tf.paging) { - var paginator = tf.feature('paging'); - // recalculate valid rows index as sorting may have change it - tf.getValidRows(true); - paginator.enable(); - paginator.setPage(paginator.getPage()); - } - - if (adpt.onAfterSort) { - adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn); - } - - adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn); - }; - - this.initialized = true; - } - - /** - * Sort specified column - * @param {Number} colIdx Column index - * @param {Boolean} desc Optional: descending manner - */ - - }, { - key: 'sortByColumnIndex', - value: function sortByColumnIndex(colIdx, desc) { - this.stt.sort(colIdx, desc); - } - }, { - key: 'overrideSortableTable', - value: function overrideSortableTable() { - var adpt = this, - tf = this.tf; - - /** - * Overrides headerOnclick method in order to handle th event - * @param {Object} e [description] - */ - SortableTable.prototype.headerOnclick = function (evt) { - if (!adpt.initialized) { - return; - } - - // find Header element - var el = evt.target || evt.srcElement; - - while (el.tagName !== 'TD' && el.tagName !== 'TH') { - el = el.parentNode; - } - - this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex); - }; - - /** - * Overrides getCellIndex IE returns wrong cellIndex when columns are - * hidden - * @param {Object} oTd TD element - * @return {Number} Cell index - */ - SortableTable.getCellIndex = function (oTd) { - var cells = oTd.parentNode.cells, - l = cells.length, - i = undefined; - for (i = 0; cells[i] != oTd && i < l; i++) {} - return i; - }; - - /** - * Overrides initHeader in order to handle filters row position - * @param {Array} oSortTypes - */ - SortableTable.prototype.initHeader = function (oSortTypes) { - var stt = this; - if (!stt.tHead) { - if (tf.gridLayout) { - stt.tHead = tf.feature('gridLayout').headTbl.tHead; - } else { - return; - } - } - - stt.headersRow = tf.headersRow; - var cells = stt.tHead.rows[stt.headersRow].cells; - stt.sortTypes = oSortTypes || []; - var l = cells.length; - var img = undefined, - c = undefined; - - for (var i = 0; i < l; i++) { - c = cells[i]; - if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') { - c.style.cursor = 'pointer'; - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - c.appendChild(img); - if (stt.sortTypes[i] !== null) { - c.setAttribute('_sortType', stt.sortTypes[i]); - } - _event2.default.add(c, 'click', stt._headerOnclick); - } else { - c.setAttribute('_sortType', oSortTypes[i]); - c._sortType = 'None'; - } - } - stt.updateHeaderArrows(); - }; - - /** - * Overrides updateHeaderArrows in order to handle arrows indicators - */ - SortableTable.prototype.updateHeaderArrows = function () { - var stt = this; - var cells = undefined, - l = undefined, - img = undefined; - - // external headers - if (adpt.asyncSort && adpt.triggerIds.length > 0) { - var triggers = adpt.triggerIds; - cells = []; - l = triggers.length; - for (var j = 0; j < triggers.length; j++) { - cells.push(_dom2.default.id(triggers[j])); - } - } else { - if (!this.tHead) { - return; - } - cells = stt.tHead.rows[stt.headersRow].cells; - l = cells.length; - } - for (var i = 0; i < l; i++) { - var cellAttr = cells[i].getAttribute('_sortType'); - if (cellAttr !== null && cellAttr !== 'None') { - img = cells[i].lastChild || cells[i]; - if (img.nodeName.toLowerCase() !== 'img') { - img = _dom2.default.create('img', ['src', adpt.imgPath + adpt.imgBlank]); - cells[i].appendChild(img); - } - if (i === stt.sortColumn) { - img.className = adpt.imgClassName + ' ' + (this.descending ? adpt.imgDescClassName : adpt.imgAscClassName); - } else { - img.className = adpt.imgClassName; - } - } - } - }; - - /** - * Overrides getRowValue for custom key value feature - * @param {Object} oRow Row element - * @param {String} sType - * @param {Number} nColumn - * @return {String} - */ - SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { - var stt = this; - // if we have defined a custom getRowValue use that - var sortTypeInfo = stt._sortTypeInfo[sType]; - if (sortTypeInfo && sortTypeInfo.getRowValue) { - return sortTypeInfo.getRowValue(oRow, nColumn); - } - var c = oRow.cells[nColumn]; - var s = SortableTable.getInnerText(c); - return stt.getValueFromString(s, sType); - }; - - /** - * Overrides getInnerText in order to avoid Firefox unexpected sorting - * behaviour with untrimmed text elements - * @param {Object} oNode DOM element - * @return {String} DOM element inner text - */ - SortableTable.getInnerText = function (oNode) { - if (!oNode) { - return; - } - if (oNode.getAttribute(adpt.customKey)) { - return oNode.getAttribute(adpt.customKey); - } else { - return _dom2.default.getText(oNode); - } - }; - } - }, { - key: 'addSortType', - value: function addSortType() { - var args = arguments; - SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]); - } - }, { - key: 'setSortTypes', - value: function setSortTypes() { - var _this = this; - - var tf = this.tf, - sortTypes = this.sortTypes, - _sortTypes = []; - - for (var i = 0; i < tf.nbCells; i++) { - var colType = undefined; - - if (sortTypes[i]) { - colType = sortTypes[i].toLowerCase(); - if (colType === 'none') { - colType = 'None'; - } - } else { - // resolve column types - if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) { - colType = tf.colNbFormat[i].toLowerCase(); - } else if (tf.hasColDateType && tf.colDateType[i] !== null) { - colType = tf.colDateType[i].toLowerCase() + 'date'; - } else { - colType = 'String'; - } - } - _sortTypes.push(colType); - } - - //Public TF method to add sort type - - //Custom sort types - this.addSortType('number', Number); - this.addSortType('caseinsensitivestring', SortableTable.toUpperCase); - this.addSortType('date', SortableTable.toDate); - this.addSortType('string'); - this.addSortType('us', usNumberConverter); - this.addSortType('eu', euNumberConverter); - this.addSortType('dmydate', dmyDateConverter); - this.addSortType('ymddate', ymdDateConverter); - this.addSortType('mdydate', mdyDateConverter); - this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter); - this.addSortType('ipaddress', ipAddress, sortIP); - - this.stt = new SortableTable(tf.tbl, _sortTypes); - - /*** external table headers adapter ***/ - if (this.asyncSort && this.triggerIds.length > 0) { - (function () { - var triggers = _this.triggerIds; - for (var j = 0; j < triggers.length; j++) { - if (triggers[j] === null) { - continue; - } - var trigger = _dom2.default.id(triggers[j]); - if (trigger) { - trigger.style.cursor = 'pointer'; - - _event2.default.add(trigger, 'click', function (evt) { - var elm = evt.target; - if (!_this.tf.sort) { - return; - } - _this.stt.asyncSort(triggers.indexOf(elm.id)); - }); - trigger.setAttribute('_sortType', _sortTypes[j]); - } - } - })(); - } - } - - /** - * Destroy sort - */ - - }, { - key: 'destroy', - value: function destroy() { - var tf = this.tf; - this.sorted = false; - this.initialized = false; - this.stt.destroy(); - - var ids = tf.getFiltersId(); - for (var idx = 0; idx < ids.length; idx++) { - var header = tf.getHeaderElement(idx); - var img = _dom2.default.tag(header, 'img'); - - if (img.length === 1) { - header.removeChild(img[0]); - } - } - } - }]); - - return AdapterSortableTable; - })(); - - //Converters - - exports.default = AdapterSortableTable; - function usNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'us'); - } - function euNumberConverter(s) { - return _helpers2.default.removeNbFormat(s, 'eu'); - } - function dateConverter(s, format) { - return _date2.default.format(s, format); - } - function dmyDateConverter(s) { - return dateConverter(s, 'DMY'); - } - function mdyDateConverter(s) { - return dateConverter(s, 'MDY'); - } - function ymdDateConverter(s) { - return dateConverter(s, 'YMD'); - } - function ddmmmyyyyDateConverter(s) { - return dateConverter(s, 'DDMMMYYYY'); - } - - function ipAddress(value) { - var vals = value.split('.'); - for (var x in vals) { - var val = vals[x]; - while (3 > val.length) { - val = '0' + val; - } - vals[x] = val; - } - return vals.join('.'); - } - - function sortIP(a, b) { - var aa = ipAddress(a.value.toLowerCase()); - var bb = ipAddress(b.value.toLowerCase()); - if (aa == bb) { - return 0; - } else if (aa < bb) { - return -1; - } else { - return 1; - } - } - -/***/ }, - -/***/ 33: -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _adapterSortabletable = __webpack_require__(32); - - var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - if (!window.SortableTable) { - __webpack_require__(34); - } // import 'script!sortabletable'; - - exports.default = _adapterSortabletable2.default; - -/***/ }, - -/***/ 34: -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(35)(__webpack_require__(36)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js") - -/***/ }, - -/***/ 35: -/***/ function(module, exports) { - - /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra - */ - module.exports = function(src) { - if (typeof execScript === "function") - execScript(src); - else - eval.call(null, src); - } - -/***/ }, - -/***/ 36: -/***/ function(module, exports) { - - module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n" - -/***/ } - -}); -//# sourceMappingURL=tf-1.js.map \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"toggle",value:function(){var e=this._ezEditTable;e.editable?e.Editable.Remove():e.Editable.Set(),e.selection?e.Selection.Remove():e.Selection.Set()}},{key:"destroy",value:function(){var e=this,t=this._ezEditTable;t&&(this.cfg.selection&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return e.toggle()}),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/src/modules/gridLayout.js b/src/modules/gridLayout.js index eb68ca6f..09cc1b99 100644 --- a/src/modules/gridLayout.js +++ b/src/modules/gridLayout.js @@ -110,7 +110,7 @@ export class GridLayout extends Feature{ this.tblMainCont.className = this.gridMainContCssClass; if(this.gridWidth){ this.tblMainCont.style.width = this.gridWidth; - }console.log(tbl, tbl.parentNode); + } tbl.parentNode.insertBefore(this.tblMainCont, tbl); //Table container: div wrapping content table @@ -330,7 +330,7 @@ export class GridLayout extends Feature{ tbl.outerHTML = this.sourceTblHtml; //needed to keep reference of table element for future usage - this.tf.tbl = t; + this.tf.tbl = Dom.id(tf.id); this.initialized = false; } diff --git a/src/modules/paging.js b/src/modules/paging.js index f569a3c5..f6c50905 100644 --- a/src/modules/paging.js +++ b/src/modules/paging.js @@ -346,12 +346,12 @@ export class Paging extends Feature{ */ reset(filterTable=false){ var tf = this.tf; - if(!tf.hasGrid() || this.isEnabled()){ + if(this.isEnabled()){ return; } this.enable(); this.init(); - tf.resetValues(); + // tf.resetValues(); if(filterTable){ tf.filter(); } @@ -497,9 +497,9 @@ export class Paging extends Feature{ var tf = this.tf; var evt = this.evt; - if(!tf.hasGrid() && !tf.isFirstLoad){ - return; - } + // if(!tf.hasGrid() && !tf.isFirstLoad){ + // return; + // } if(this.resultsPerPageSlc || !this.resultsPerPage){ return; } diff --git a/src/modules/statusBar.js b/src/modules/statusBar.js index 203e918a..f64842ea 100644 --- a/src/modules/statusBar.js +++ b/src/modules/statusBar.js @@ -178,7 +178,9 @@ export class StatusBar extends Feature{ let emitter = this.emitter; this.statusBarDiv.innerHTML = ''; - Dom.remove(this.statusBarDiv); + if(!this.statusBarTgtId){ + Dom.remove(this.statusBarDiv); + } this.statusBarSpan = null; this.statusBarSpanText = null; this.statusBarDiv = null; diff --git a/src/tablefilter.js b/src/tablefilter.js index 9046f229..0d6f028b 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -617,12 +617,13 @@ export class TableFilter { Mod.statusBar = new StatusBar(this); Mod.statusBar.init(); } - if(this.paging || Mod.paging){ + if(this.paging){ if(!Mod.paging){ Mod.paging = new Paging(this); Mod.paging.init(); + } else{ + Mod.paging.reset(); } - Mod.paging.reset(); } if(this.btnReset){ Mod.clearButton = new ClearButton(this); @@ -1008,6 +1009,7 @@ export class TableFilter { Dom.removeClass(this.tbl, this.prfxTf); this.nbHiddenRows = 0; this.validRowsIndex = []; + this.fltIds = []; this.activeFlt = null; this._hasGrid = false; } @@ -2207,69 +2209,69 @@ export class TableFilter { /** * Re-generate the filters grid bar when previously removed */ - _resetGrid(){ - if(this.isFirstLoad){ - return; - } + // _resetGrid(){ + // if(this.isFirstLoad){ + // return; + // } - let Mod = this.Mod; - let tbl = this.tbl; - let rows = tbl.rows; - let filtersRowIndex = this.filtersRowIndex; - let filtersRow = rows[filtersRowIndex]; + // let Mod = this.Mod; + // let tbl = this.tbl; + // let rows = tbl.rows; + // let filtersRowIndex = this.filtersRowIndex; + // let filtersRow = rows[filtersRowIndex]; - // grid was removed, grid row element is stored in fltGridEl property - if(!this.gridLayout){ - // If table has a thead ensure the filters row is appended in the - // thead element - if(tbl.tHead){ - var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); - tbl.tHead.replaceChild(this.fltGridEl, tempRow); - } else { - filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); - } + // // grid was removed, grid row element is stored in fltGridEl property + // if(!this.gridLayout){ + // // If table has a thead ensure the filters row is appended in the + // // thead element + // if(tbl.tHead){ + // var tempRow = tbl.tHead.insertRow(this.filtersRowIndex); + // tbl.tHead.replaceChild(this.fltGridEl, tempRow); + // } else { + // filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow); + // } - Dom.addClass(tbl, this.prfxTf); - } + // Dom.addClass(tbl, this.prfxTf); + // } - // filters are appended in external placeholders elements - if(this.isExternalFlt){ - let externalFltTgtIds = this.externalFltTgtIds; - for(let ct=0, len=externalFltTgtIds.length; ct Date: Thu, 14 Jan 2016 21:13:19 +1100 Subject: [PATCH 29/41] Cleaned destroy method of TableFilter class --- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 10 +- dist/tablefilter/tf-1.js | 6 +- src/extensions/colOps/colOps.js | 2 +- src/modules/alternateRows.js | 2 +- src/modules/checkList.js | 3 +- src/modules/dropdown.js | 3 +- src/modules/highlightKeywords.js | 10 +- src/modules/paging.js | 3 - src/tablefilter.js | 140 +++++++++--------- test/test-highlight-keywords.js | 12 +- 16 files changed, 104 insertions(+), 99 deletions(-) diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 2da7ba1a..9d85ba69 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T08:30:34.837Z + * build date: 2016-01-14T10:08:13.993Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 55001878..498606c5 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T08:30:34.837Z + * build date: 2016-01-14T10:08:13.993Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 3a201200..cf5377e9 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T08:30:34.837Z + * build date: 2016-01-14T10:08:13.993Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 64278f05..ab9fa4d0 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T08:30:34.837Z + * build date: 2016-01-14T10:08:13.993Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 2a154374..b3fbb029 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T08:30:34.837Z + * build date: 2016-01-14T10:08:13.993Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 0560153d..7ea2b7b3 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T08:30:34.837Z + * build date: 2016-01-14T10:08:13.993Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index fea33ed3..055e7216 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,10 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T08:30:34.759Z + * build date: 2016-01-14T10:08:13.903Z * MIT License */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.6",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.emitter.emit("filter-blur",this)},onInpFocus:function(t){var e=o["default"].target(t);this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.emitter.emit("filter-focus",this)}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store||(e.store=new T.Store(this)),e.store.init()),this.gridLayout&&(e.gridLayout||(e.gridLayout=new k.GridLayout(this)),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new O.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new S.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),this.paging&&(e.paging?e.paging.reset():(e.paging=new L.Paging(this),e.paging.init())),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,s=t.length;s>e;e++){var n=t[e];this.ExtRegistry[n.name]||this.loadExtension(n)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.markActiveColumns&&(this.clearActiveColumns(),this.emitter.off(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions();for(var s=this.refRow;s0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),O=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),S),B=x&&_["default"].isValid(t.replace(r,""),S),M=T&&_["default"].isValid(t.replace(f,""),S),A=k&&_["default"].isValid(t.replace(o,""),S),H=P&&_["default"].isValid(t.replace(c,""),S),j=R&&_["default"].isValid(t.replace(g,""),S),V=void 0,U=void 0;if(_["default"].isValid(e,S))V=_["default"].format(e,S),D?(U=_["default"].format(t.replace(h,""),S),s=U>V):B?(U=_["default"].format(t.replace(r,""),S),s=U>=V):A?(U=_["default"].format(t.replace(o,""),S),s=V>=U):M?(U=_["default"].format(t.replace(f,""),S),s=V>U):H?(U=_["default"].format(t.replace(c,""),S),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),S),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,S)?(U=_["default"].format(t,S),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(O){var z=t.replace(b,"");s=e.lastIndexOf(z,e.length-1)===e.length-1-(z.length-1)&&e.lastIndexOf(z,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var G=t.replace(C,""),W=new RegExp(G);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var O=this.searchArgs[this.singleSearchFlt?0:I],S=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==O){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=O.split(this.orOperator),N=L.length>1?!0:!1,D=O.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(O),E,I),t.call(this,O,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive); -""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),O=0;O',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||this.isFirstLoad||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||n.isFirstLoad||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass, -b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;this.isEnabled()||(this.enable(),this.init(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if(!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=this.tf.refRow;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.6",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.emitter.emit("filter-blur",this)},onInpFocus:function(t){var e=o["default"].target(t);this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.emitter.emit("filter-focus",this)}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store||(e.store=new T.Store(this)),e.store.init()),this.gridLayout&&(e.gridLayout||(e.gridLayout=new k.GridLayout(this)),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new O.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new S.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),this.paging&&(e.paging?e.paging.reset():(e.paging=new L.Paging(this),e.paging.init())),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,s=t.length;s>e;e++){var n=t[e];this.ExtRegistry[n.name]||this.loadExtension(n)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod,s=this.emitter;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.markActiveColumns&&(this.clearActiveColumns(),s.off(["before-filtering"],function(){return t.clearActiveColumns()}),s.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions(),this.validateAllRows(),this.fltGrid&&!this.gridLayout&&(this.fltGridEl=e[this.filtersRowIndex],this.tbl.deleteRow(this.filtersRowIndex)),s.emit("destroy",this),Object.keys(i).forEach(function(t){var e=i[t];e&&v["default"].isFn(e.destroy)&&e.destroy()}),this.hasVisibleRows&&s.off(["after-filtering"],function(){return t.enforceVisibility()}),this.linkedFilters&&s.off(["after-filtering"],function(){return t.linkFilters()}),u["default"].removeClass(this.tbl,this.prfxTf),this.nbHiddenRows=0,this.validRowsIndex=[],this.fltIds=[],this.activeFlt=null,this._hasGrid=!1}}},{key:"setToolbar",value:function(){if(!this.infDiv){var t=u["default"].create("div",["id",this.prfxInfDiv+this.id]);if(t.className=this.infDivCssClass,this.toolBarTgtId)u["default"].id(this.toolBarTgtId).appendChild(t);else if(this.gridLayout){var e=this.Mod.gridLayout;e.tblMainCont.appendChild(t),t.className=e.gridInfDivCssClass}else{var i=u["default"].create("caption");i.appendChild(t),this.tbl.insertBefore(i,this.tbl.firstChild)}this.infDiv=u["default"].id(this.prfxInfDiv+this.id);var s=u["default"].create("div",["id",this.prfxLDiv+this.id]);s.className=this.lDivCssClass,t.appendChild(s),this.lDiv=u["default"].id(this.prfxLDiv+this.id);var n=u["default"].create("div",["id",this.prfxRDiv+this.id]);n.className=this.rDivCssClass,t.appendChild(n),this.rDiv=u["default"].id(this.prfxRDiv+this.id);var l=u["default"].create("div",["id",this.prfxMDiv+this.id]);l.className=this.mDivCssClass,t.appendChild(l),this.mDiv=u["default"].id(this.prfxMDiv+this.id),v["default"].isUndef(this.help)&&(this.Mod.help||(this.Mod.help=new D.Help(this)),this.Mod.help.init(),this.help=!0)}}},{key:"removeToolbar",value:function(){if(this.infDiv){u["default"].remove(this.infDiv),this.infDiv=null;var t=this.tbl,e=u["default"].tag(t,"caption");e.length>0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),O=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),S),B=x&&_["default"].isValid(t.replace(r,""),S),M=T&&_["default"].isValid(t.replace(f,""),S),A=k&&_["default"].isValid(t.replace(o,""),S),H=P&&_["default"].isValid(t.replace(c,""),S),j=R&&_["default"].isValid(t.replace(g,""),S),V=void 0,U=void 0;if(_["default"].isValid(e,S))V=_["default"].format(e,S),D?(U=_["default"].format(t.replace(h,""),S),s=U>V):B?(U=_["default"].format(t.replace(r,""),S),s=U>=V):A?(U=_["default"].format(t.replace(o,""),S),s=V>=U):M?(U=_["default"].format(t.replace(f,""),S),s=V>U):H?(U=_["default"].format(t.replace(c,""),S),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),S),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,S)?(U=_["default"].format(t,S),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(O){var z=t.replace(b,"");s=e.lastIndexOf(z,e.length-1)===e.length-1-(z.length-1)&&e.lastIndexOf(z,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var G=t.replace(C,""),W=new RegExp(G);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&this._hasGrid){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var O=this.searchArgs[this.singleSearchFlt?0:I],S=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==O){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=O.split(this.orOperator),N=L.length>1?!0:!1,D=O.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(O),E,I),t.call(this,O,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){ +for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),O=0;O',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]); +d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;this.isEnabled()||(this.enable(),this.init(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if(!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=0;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 5942b0e5..693b9f5e 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,8 +1,8 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T08:30:34.759Z + * build date: 2016-01-14T10:08:13.903Z * MIT License */ -webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"toggle",value:function(){var e=this._ezEditTable;e.editable?e.Editable.Remove():e.Editable.Set(),e.selection?e.Selection.Remove():e.Selection.Set()}},{key:"destroy",value:function(){var e=this,t=this._ezEditTable;t&&(this.cfg.selection&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return e.toggle()}),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file +webpackJsonp([1],{26:function(e,t,n){function r(e){return n(s(e))}function s(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":6,"./array.js":6,"./cookie":4,"./cookie.js":4,"./date":7,"./date.js":7,"./dom":2,"./dom.js":2,"./emitter":9,"./emitter.js":9,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":27,"./extensions/advancedGrid/adapterEzEditTable.js":27,"./extensions/advancedGrid/advancedGrid":28,"./extensions/advancedGrid/advancedGrid.js":28,"./extensions/colOps/colOps":29,"./extensions/colOps/colOps.js":29,"./extensions/colsVisibility/colsVisibility":30,"./extensions/colsVisibility/colsVisibility.js":30,"./extensions/filtersVisibility/filtersVisibility":31,"./extensions/filtersVisibility/filtersVisibility.js":31,"./extensions/sort/adapterSortabletable":32,"./extensions/sort/adapterSortabletable.js":32,"./extensions/sort/sort":33,"./extensions/sort/sort.js":33,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/feature":12,"./modules/feature.js":12,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/store":10,"./modules/store.js":10,"./sort":17,"./sort.js":17,"./string":3,"./string.js":3,"./types":5,"./types.js":5};r.keys=function(){return Object.keys(i)},r.resolve=s,e.exports=r,r.id=26},27:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var s=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;if(i){var d=function(e,n,r){var s=e.Selection,i=function(r){if("row"===e.defaultSelection)s.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,l=t.tbl.rows[r];"both"===e.defaultSelection&&s.SelectRowByIndex(r),l&&s.SelectCell(l.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var o=t.tbl.rows[r];o&&o.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var o,d=t.validRowsIndex,u=d.length,c="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,f=void 0!==r?e.Event.GetKey(r):0,p=-1!==d.indexOf(c.rowIndex),b=t.feature("paging"),m=34===f||33===f?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==f&&33!==f?(l=d.indexOf(c.rowIndex),a=c.rowIndex):(o=34===f?u-1>=l+m?d[l+m]:[u-1]:l-m<=d[0]?d[0]:d[l-m],a=o,l=d.indexOf(o),i(o));else{if(c.rowIndex>a)if(c.rowIndex>=d[u-1])o=d[u-1];else{var g=l+m;o=g>u-1?d[u-1]:d[g]}else if(c.rowIndex<=d[0])o=d[0];else{var y=d[l-m];o=y?y:d[0]}a=c.rowIndex,i(o)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var s=t.feature("paging");e.nbRowsPerPage=s.pagingLength;var i=t.validRowsIndex,l=i.length,o=parseInt(s.startPagingRow,10)+parseInt(s.pagingLength,10),a=r.rowIndex;a===i[l-1]&&s.currentPageNb!==s.nbPages?s.setPage("last"):a==i[0]&&1!==s.currentPageNb?s.setPage("first"):a>i[o-1]&&ai[0]&&s.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,s=r.GetActiveRow();s&&s.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var c=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),c&&c.call(null,arguments[0],arguments[1],arguments[2])};var h=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(s){var b=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),b&&b.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var m=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(this.err)}this.initialized=!0}},{key:"reset",value:function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())}},{key:"toggle",value:function(){var e=this._ezEditTable;e.editable?e.Editable.Remove():e.Editable.Set(),e.selection?e.Selection.Remove():e.Selection.Set()}},{key:"destroy",value:function(){var e=this,t=this._ezEditTable;t&&(this.cfg.selection&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return e.toggle()}),this.initialized=!1}}]),e}();t["default"]=a},28:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(27),i=r(s);t["default"]=i["default"]},29:function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_string2["default"].lower("undefined"==typeof labelId?"undefined":_typeof(labelId))&&"object"==_string2["default"].lower("undefined"==typeof colIndex?"undefined":_typeof(colIndex))&&"object"==_string2["default"].lower("undefined"==typeof operation?"undefined":_typeof(operation)))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),_dom2["default"].id(labThisCol[i]))switch(_string2["default"].lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result;break;case"setvalue":_dom2["default"].id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_dom2["default"].id(labThisCol[i]).firstChild,txtnode=_dom2["default"].text(result);_dom2["default"].id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_dom2["default"].id(labThisCol[i]).innerHTML=".":_dom2["default"].id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}}},{key:"destroy",value:function(){var e=this;this.tf.emitter.off(["after-filtering"],function(){return e.calc()})}}]),ColOps}();exports["default"]=ColOps},30:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0,this.onLoaded=d["default"].isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=d["default"].isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=d["default"].isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=d["default"].isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=d["default"].isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=d["default"].isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=d["default"].isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=d["default"].isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=d["default"].isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,t.gridLayout&&(this.headersTbl=t.feature("gridLayout").headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"toggle",value:function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,s=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),s&&"inline"===e&&s.call(null,this)}},{key:"checkItem",value:function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?o["default"].addClass(t,this.listSlcItemCssClass):o["default"].removeClass(t,this.listSlcItemCssClass);var s=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(s=!0),this.setHidden(r,s)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var e=this;if(!this.btnEl){var t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?o["default"].id(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?c["default"].add(i,"mouseover",function(t){e.toggle(t)}):c["default"].add(i,"click",function(t){e.toggle(t)})}else{var l=o["default"].create("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?c["default"].add(l,"mouseover",function(t){e.toggle(t)}):c["default"].add(l,"click",function(t){e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var e=this,t=this.tf,n=this.contElTgtId?o["default"].id(this.contElTgtId):o["default"].create("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=o["default"].create("p");r.innerHTML=this.text,n.appendChild(r);var s=o["default"].create("ul",["id","ul"+this.name+"_"+t.id]);s.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[l];if(this.enableTickAll){var d=o["default"].createCheckItem("col__"+t.id,this.tickAllText,this.tickAllText);o["default"].addClass(d,this.listItemCssClass),s.appendChild(d),d.check.checked=!this.tickToHide,c["default"].add(d.check,"click",function(){for(var e=0;e',this.icnCollapseHtml='Collapse filters',this.defaultText="Toggle filters",this.targetId=n.target_id||null,this.enableIcon=n.enable_icon===!1?!1:!0,this.btnText=n.btn_text||"",this.collapseBtnHtml=this.enableIcon?this.icnCollapseHtml+this.btnText:this.btnText||this.defaultText,this.expandBtnHtml=this.enableIcon?this.icnExpandHtml+this.btnText:this.btnText||this.defaultText,this.btnHtml=n.btn_html||null,this.btnCssClass=n.btn_css_class||"btnExpClpFlt",this.contCssClass=n.cont_css_class||"expClpFlt",this.filtersRowIndex=d["default"].isUndef(n.filters_row_index)?t.getFiltersRowIndex():n.filters_row_index,this.visibleAtStart=d["default"].isUndef(n.visible_at_start)?!0:Boolean(n.visible_at_start),this.prfx="fltsVis_",this.onBeforeShow=d["default"].isFn(n.on_before_show)?n.on_before_show:null,this.onAfterShow=d["default"].isFn(n.on_after_show)?n.on_after_show:null,this.onBeforeHide=d["default"].isFn(n.on_before_hide)?n.on_before_hide:null,this.onAfterHide=d["default"].isFn(n.on_after_hide)?n.on_after_hide:null,t["import"](n.name+"Style",t.stylePath+this.stylesheet,null,"link"),this.tf=t}return i(e,[{key:"init",value:function(){this.initialized||(this.buildUI(),this.initialized=!0)}},{key:"buildUI",value:function(){var e=this,t=this.tf,n=o["default"].create("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?o["default"].id(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var s=r.firstChild;s.parentNode.insertBefore(n,s)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=o["default"].create("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),c["default"].add(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()}},{key:"toggle",value:function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=n.style.display;this.onBeforeShow&&""!==r&&this.onBeforeShow.call(this,this),this.onBeforeHide&&""===r&&this.onBeforeHide.call(null,this),n.style.display=""===r?"none":"",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=""===r?this.expandBtnHtml:this.collapseBtnHtml),this.onAfterShow&&""!==r&&this.onAfterShow.call(null,this),this.onAfterHide&&""===r&&this.onAfterHide.call(null,this)}},{key:"destroy",value:function(){(this.btnEl||this.contEl)&&(this.btnEl.innerHTML="",o["default"].remove(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",o["default"].remove(this.contEl),this.contEl=null,this.initialized=!1)}}]),e}();t["default"]=h},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return S["default"].removeNbFormat(e,"us")}function l(e){return S["default"].removeNbFormat(e,"eu")}function o(e,t){return C["default"].format(e,t)}function a(e){return o(e,"DMY")}function d(e){return o(e,"MDY")}function u(e){return o(e,"YMD")}function c(e){return o(e,"DDMMMYYYY")}function h(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=h(e.value.toLowerCase()),r=h(t.value.toLowerCase());return n==r?0:r>n?-1:1}var p=function(){function e(e,t){for(var n=0;nr;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var s=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=s.length,l=void 0,o=void 0,a=0;i>a;a++)o=s[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(o.style.cursor="pointer",l=y["default"].create("img",["src",e.imgPath+e.imgBlank]),o.appendChild(l),null!==r.sortTypes[a]&&o.setAttribute("_sortType",r.sortTypes[a]),T["default"].add(o,"click",r._headerOnclick)):(o.setAttribute("_sortType",n[a]),o._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,s=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var l=0;lo;o++){var a=n[o].getAttribute("_sortType");null!==a&&"None"!==a&&(s=n[o].lastChild||n[o],"img"!==s.nodeName.toLowerCase()&&(s=y["default"].create("img",["src",e.imgPath+e.imgBlank]),n[o].appendChild(s)),o===t.sortColumn?s.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):s.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,s=r._sortTypeInfo[t];if(s&&s.getRowValue)return s.getRowValue(e,n);var i=e.cells[n],l=SortableTable.getInnerText(i);return r.getValueFromString(l,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):y["default"].getText(t):void 0}}},{key:"addSortType",value:function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])}},{key:"setSortTypes",value:function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],s=0;s0&&!function(){for(var t=e.triggerIds,n=0;n descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}}); \ No newline at end of file diff --git a/src/extensions/colOps/colOps.js b/src/extensions/colOps/colOps.js index 17fb63db..fb6badc1 100644 --- a/src/extensions/colOps/colOps.js +++ b/src/extensions/colOps/colOps.js @@ -46,7 +46,7 @@ export default class ColOps{ */ calc() { var tf = this.tf; - if(!tf.isFirstLoad && !tf.hasGrid()){ + if(!tf.hasGrid()){ return; } diff --git a/src/modules/alternateRows.js b/src/modules/alternateRows.js index 7abbeaf0..85e6f616 100644 --- a/src/modules/alternateRows.js +++ b/src/modules/alternateRows.js @@ -112,7 +112,7 @@ export class AlternateRows extends Feature { if(!this.initialized){ return; } - for(var i=this.tf.refRow; i this.unhighlightAll()); + this.emitter.on( + ['before-filtering', 'destroy'], + ()=> this.unhighlightAll() + ); } /** @@ -112,6 +115,9 @@ export class HighlightKeyword{ } destroy(){ - this.emitter.off(['before-filtering'], ()=> this.unhighlightAll()); + this.emitter.off( + ['before-filtering', 'destroy'], + ()=> this.unhighlightAll() + ); } } \ No newline at end of file diff --git a/src/modules/paging.js b/src/modules/paging.js index f6c50905..121219f5 100644 --- a/src/modules/paging.js +++ b/src/modules/paging.js @@ -497,9 +497,6 @@ export class Paging extends Feature{ var tf = this.tf; var evt = this.evt; - // if(!tf.hasGrid() && !tf.isFirstLoad){ - // return; - // } if(this.resultsPerPageSlc || !this.resultsPerPage){ return; } diff --git a/src/tablefilter.js b/src/tablefilter.js index 0d6f028b..aacbdf0a 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -123,8 +123,6 @@ export class TableFilter { this.validRowsIndex = []; //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 @@ -544,63 +542,58 @@ export class TableFilter { if(!this.fltGrid){ this._initNoFilters(); } else { - // if(this.isFirstLoad){ - let fltrow = this._insertFiltersRow(); + let fltrow = this._insertFiltersRow(); - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = this.tbl.rows.length; + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.tbl.rows.length; - // Generate filters - for(let i=0; i this.clearActiveColumns()); - this.emitter.off(['cell-processed'], + emitter.off(['before-filtering'], ()=> this.clearActiveColumns()); + emitter.off(['cell-processed'], (tf, colIndex)=> this.markActiveColumn(colIndex)); } if(this.hasExtensions){ this.destroyExtensions(); } - for(let j=this.refRow; j this.enforceVisibility()); + emitter.off(['after-filtering'], ()=> this.enforceVisibility()); } if(this.linkedFilters){ - this.emitter.off(['after-filtering'], ()=> this.linkFilters()); + emitter.off(['after-filtering'], ()=> this.linkFilters()); } Dom.removeClass(this.tbl, this.prfxTf); @@ -1272,7 +1267,7 @@ export class TableFilter { * TODO: Reduce complexity of this massive method */ filter(){ - if(!this.fltGrid || (!this._hasGrid && !this.isFirstLoad)){ + if(!this.fltGrid || !this._hasGrid){ return; } //invoke onbefore callback @@ -1981,8 +1976,7 @@ export class TableFilter { * @param {String} searcharg Search term */ setFilterValue(index, searcharg=''){ - if((!this.fltGrid && !this.isFirstLoad) || - !this.getFilterElement(index)){ + if(!this.fltGrid || !this.getFilterElement(index)){ return; } let slc = this.getFilterElement(index), diff --git a/test/test-highlight-keywords.js b/test/test-highlight-keywords.js index 98a9ae0c..b3276590 100644 --- a/test/test-highlight-keywords.js +++ b/test/test-highlight-keywords.js @@ -26,8 +26,18 @@ test('Highlighted keywords', function() { 0, 'Number of highlighted words'); }); +module('Reset feature'); +test('can destroy and init TableFilter', function() { + tf.destroy(); + tf.init(); + deepEqual(typeof highlightKeyword, 'object', 'Instanciated'); + deepEqual(highlightKeyword.highlightedNodes instanceof Array, + true, 'Property check'); +}); + module('Tear-down'); -test('can destroy TableFilter DOM elements', function() { +test('can destroy TableFilter DOM elements and clean highlighted words', + function() { tf.setFilterValue(1, 'Perth'); tf.filter(); tf.destroy(); From 0c032efbd8e2fc6cce9248479247e7fce6461b73 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Sun, 17 Jan 2016 17:56:15 +1100 Subject: [PATCH 30/41] Removed _resetGridValues logic --- dist/tablefilter/style/colsVisibility.css | 2 +- dist/tablefilter/style/filtersVisibility.css | 2 +- dist/tablefilter/style/tablefilter.css | 2 +- .../style/themes/default/default.css | 2 +- .../style/themes/mytheme/mytheme.css | 2 +- .../style/themes/skyblue/skyblue.css | 2 +- dist/tablefilter/tablefilter.js | 7802 ++++++++++++++++- dist/tablefilter/tf-1.js | 2224 ++++- src/modules/checkList.js | 12 +- src/modules/dropdown.js | 16 +- src/tablefilter.js | 197 +- static/templates/load-filters-on-demand.html | 1 + 12 files changed, 10152 insertions(+), 112 deletions(-) diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 9d85ba69..3904407d 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T10:08:13.993Z + * build date: 2016-01-17T05:48:49.785Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index 498606c5..89f11d84 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T10:08:13.993Z + * build date: 2016-01-17T05:48:49.785Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index cf5377e9..65c00382 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T10:08:13.993Z + * build date: 2016-01-17T05:48:49.785Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index ab9fa4d0..fb3889ce 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T10:08:13.993Z + * build date: 2016-01-17T05:48:49.785Z * MIT License */ table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index b3fbb029..7493c2ca 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T10:08:13.993Z + * build date: 2016-01-17T05:48:49.785Z * MIT License */ table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 7ea2b7b3..c392b5e0 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T10:08:13.993Z + * build date: 2016-01-17T05:48:49.785Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 055e7216..bf1cac5e 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,7794 @@ -/** - * tablefilter v0.1.6 by Max Guglielmi - * build date: 2016-01-14T10:08:13.903Z - * MIT License - */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else { + var a = factory(); + for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; + } +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ var parentJsonpFunction = window["webpackJsonp"]; +/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, callbacks = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) +/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); +/******/ while(callbacks.length) +/******/ callbacks.shift().call(null, __webpack_require__); +/******/ +/******/ }; +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // object to store loaded and loading chunks +/******/ // "0" means "already loaded" +/******/ // Array means "loading", array contains callbacks +/******/ var installedChunks = { +/******/ 0:0 +/******/ }; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // This file contains only the entry chunk. +/******/ // The chunk loading function for additional chunks +/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { +/******/ // "0" is the signal for "already loaded" +/******/ if(installedChunks[chunkId] === 0) +/******/ return callback.call(null, __webpack_require__); +/******/ +/******/ // an array means "currently loading". +/******/ if(installedChunks[chunkId] !== undefined) { +/******/ installedChunks[chunkId].push(callback); +/******/ } else { +/******/ // start chunk loading +/******/ installedChunks[chunkId] = [callback]; +/******/ var head = document.getElementsByTagName('head')[0]; +/******/ var script = document.createElement('script'); +/******/ script.type = 'text/javascript'; +/******/ script.charset = 'utf-8'; +/******/ script.async = true; +/******/ +/******/ script.src = __webpack_require__.p + "tf-" + ({}[chunkId]||chunkId) + ".js"; +/******/ head.appendChild(script); +/******/ } +/******/ }; +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var n=s[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i=window.webpackJsonp;window.webpackJsonp=function(s,l){for(var a,r,o=0,h=[];oa;a++)s[a]=arguments[a];if(0!==s.length){if(this.id=null,this.version="0.1.6",this.year=(new Date).getFullYear(),this.tbl=null,this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,s.forEach(function(t){var i="undefined"==typeof t?"undefined":n(t);"object"===i&&t&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):"string"===i?(e.id=t,e.tbl=u["default"].id(t)):"number"===i?e.startRow=t:"object"===i&&(e.cfg=t)}),!this.tbl||"TABLE"!=this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table not found.");var r=this.cfg;this.emitter=new x.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(h){this.nbCells=this.getCellsNb(0)}this.basePath=r.base_path||"tablefilter/",this.fltTypeInp="input",this.fltTypeSlc="select",this.fltTypeMulti="multiple",this.fltTypeCheckList="checklist",this.fltTypeNone="none",this.fltGrid=r.grid===!1?!1:!0,this.gridLayout=Boolean(r.grid_layout),this.filtersRowIndex=isNaN(r.filters_row_index)?0:r.filters_row_index,this.headersRow=isNaN(r.headers_row_index)?0===this.filtersRowIndex?1:0:r.headers_row_index,this.fltCellTag="th"!==r.filters_cell_tag||"td"!==r.filters_cell_tag?"td":r.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.validRowsIndex=[],this.fltGridEl=null,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=r.inf_div_css_class||"inf",this.lDivCssClass=r.left_div_css_class||"ldiv",this.rDivCssClass=r.right_div_css_class||"rdiv",this.mDivCssClass=r.middle_div_css_class||"mdiv",this.contDivCssClass=r.content_div_css_class||"cont",this.stylePath=r.style_path||this.basePath+"style/",this.stylesheet=r.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=r.flts_row_css_class||"fltrow",this.enableIcons=r.enable_icons===!1?!1:!0,this.alternateRows=Boolean(r.alternate_rows),this.hasColWidths=v["default"].isArray(r.col_widths),this.colWidths=this.hasColWidths?r.col_widths:null,this.fltCssClass=r.flt_css_class||"flt",this.fltMultiCssClass=r.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=r.flt_small_css_class||"flt_s",this.singleFltCssClass=r.single_flt_css_class||"single_flt",this.enterKey=r.enter_key===!1?!1:!0,this.onBeforeFilter=v["default"].isFn(r.on_before_filter)?r.on_before_filter:null,this.onAfterFilter=v["default"].isFn(r.on_after_filter)?r.on_after_filter:null,this.caseSensitive=Boolean(r.case_sensitive),this.hasExactMatchByCol=v["default"].isArray(r.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?r.columns_exact_match:[],this.exactMatch=Boolean(r.exact_match),this.linkedFilters=Boolean(r.linked_filters),this.disableExcludedOptions=Boolean(r.disable_excluded_options),this.activeFlt=null,this.activeFilterId=null,this.hasVisibleRows=Boolean(r.rows_always_visible),this.visibleRows=this.hasVisibleRows?r.rows_always_visible:[],this.isExternalFlt=Boolean(r.external_flt_grid),this.externalFltTgtIds=r.external_flt_grid_ids||[],this.externalFltEls=[],this.execDelay=isNaN(r.exec_delay)?100:parseInt(r.exec_delay,10),this.onFiltersLoaded=v["default"].isFn(r.on_filters_loaded)?r.on_filters_loaded:null,this.singleSearchFlt=Boolean(r.single_filter),this.onRowValidated=v["default"].isFn(r.on_row_validated)?r.on_row_validated:null,this.customCellDataCols=r.custom_cell_data_cols?r.custom_cell_data_cols:[],this.customCellData=v["default"].isFn(r.custom_cell_data)?r.custom_cell_data:null,this.watermark=r.watermark||"",this.isWatermarkArray=v["default"].isArray(this.watermark),this.toolBarTgtId=r.toolbar_target_id||null,this.help=v["default"].isUndef(r.help_instructions)?void 0:Boolean(r.help_instructions),this.popupFilters=Boolean(r.popup_filters),this.markActiveColumns=Boolean(r.mark_active_columns),this.activeColumnsCssClass=r.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=v["default"].isFn(r.on_before_active_column)?r.on_before_active_column:null,this.onAfterActiveColumn=v["default"].isFn(r.on_after_active_column)?r.on_after_active_column:null,this.displayAllText=r.display_all_text||"Clear",this.enableEmptyOption=Boolean(r.enable_empty_option),this.emptyText=r.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(r.enable_non_empty_option),this.nonEmptyText=r.non_empty_text||"(Non empty)",this.onSlcChange=r.on_change===!1?!1:!0,this.sortSlc=r.sort_select===!1?!1:!0,this.isSortNumAsc=Boolean(r.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?r.sort_num_asc:null,this.isSortNumDesc=Boolean(r.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?r.sort_num_desc:null,this.loadFltOnDemand=Boolean(r.load_filters_on_demand),this.hasCustomOptions=v["default"].isObj(r.custom_options),this.customOptions=r.custom_options,this.rgxOperator=r.regexp_operator||"rgx:",this.emOperator=r.empty_operator||"[empty]",this.nmOperator=r.nonempty_operator||"[nonempty]",this.orOperator=r.or_operator||"||",this.anOperator=r.and_operator||"&&",this.grOperator=r.greater_operator||">",this.lwOperator=r.lower_operator||"<",this.leOperator=r.lower_equal_operator||"<=",this.geOperator=r.greater_equal_operator||">=",this.dfOperator=r.different_operator||"!",this.lkOperator=r.like_operator||"*",this.eqOperator=r.equal_operator||"=",this.stOperator=r.start_with_operator||"{",this.enOperator=r.end_with_operator||"}",this.curExp=r.cur_exp||"^[¥£€$]",this.separator=r.separator||",",this.rowsCounter=Boolean(r.rows_counter),this.statusBar=Boolean(r.status_bar),this.loader=Boolean(r.loader),this.displayBtn=Boolean(r.btn),this.btnText=r.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=r.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(r.btn_reset),this.btnResetCssClass=r.btn_reset_css_class||"reset",this.onBeforeReset=v["default"].isFn(r.on_before_reset)?r.on_before_reset:null,this.onAfterReset=v["default"].isFn(r.on_after_reset)?r.on_after_reset:null,this.paging=Boolean(r.paging),this.nbVisibleRows=0,this.nbHiddenRows=0,this.autoFilter=Boolean(r.auto_filter),this.autoFilterDelay=isNaN(r.auto_filter_delay)?900:r.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(r.highlight_keywords),this.noResults=v["default"].isObj(r.no_results_message)||Boolean(r.no_results_message),this.defaultDateType=r.default_date_type||"DMY",this.thousandsSeparator=r.thousands_separator||",",this.decimalSeparator=r.decimal_separator||".",this.hasColNbFormat=v["default"].isArray(r.col_number_format),this.colNbFormat=this.hasColNbFormat?r.col_number_format:null,this.hasColDateType=v["default"].isArray(r.col_date_type),this.colDateType=this.hasColDateType?r.col_date_type:null,this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=Boolean(r.remember_grid_values),this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&r.remember_page_number,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&r.remember_page_length,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=r.extensions,this.hasExtensions=v["default"].isArray(this.extensions),this.enableDefaultTheme=Boolean(r.enable_default_theme),this.hasThemes=this.enableDefaultTheme||v["default"].isArray(r.themes),this.themes=r.themes||[],this.themesPath=r.themes_path||this.stylePath+"themes/",this.Mod={},this.ExtRegistry={},this.Evt={detectKey:function(t){if(this.enterKey&&t){var e=o["default"].keyCode(t);13===e?(this.filter(),o["default"].cancel(t),o["default"].stop(t)):(this.isUserTyping=!0,A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyUp:function(t){function e(){A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=o["default"].keyCode(t);this.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?null===this.autoFilterTimer&&(this.autoFilterTimer=A.setInterval(e.bind(this),this.autoFilterDelay)):(A.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},onKeyDown:function(){this.autoFilter&&(this.isUserTyping=!0)},onInpBlur:function(){this.autoFilter&&(this.isUserTyping=!1,A.clearInterval(this.autoFilterTimer)),this.emitter.emit("filter-blur",this)},onInpFocus:function(t){var e=o["default"].target(t);this.activeFilterId=e.getAttribute("id"),this.activeFlt=u["default"].id(this.activeFilterId),this.emitter.emit("filter-focus",this)}}}}return a(t,[{key:"init",value:function(){var t=this;if(!this._hasGrid){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,s=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(e.store||(e.store=new T.Store(this)),e.store.init()),this.gridLayout&&(e.gridLayout||(e.gridLayout=new k.GridLayout(this)),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new P.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new R.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new F.PopupFilter(this)),e.popupFilter.init()),this.fltGrid){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var l=0;i>l;l++){this.emitter.emit("before-filter-init",this,l);var a=u["default"].create(this.fltCellTag),r=this.getFilterType(l);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=l==i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(r=this.fltTypeInp,s=this.singleFltCssClass),r===this.fltTypeSlc||r===this.fltTypeMulti?(e.dropdown||(e.dropdown=new I.Dropdown(this)),e.dropdown.init(l,this.isExternalFlt,a)):r===this.fltTypeCheckList?(e.checkList||(e.checkList=new O.CheckList(this)),e.checkList.init(l,this.isExternalFlt,a)):this._buildInputFilter(l,s,a),l==i-1&&this.displayBtn&&this._buildSubmitButton(l,a),this.emitter.emit("after-filter-init",this,l)}}else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new S.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new E.StatusBar(this),e.statusBar.init()),this.paging&&(e.paging?e.paging.reset():(e.paging=new L.Paging(this),e.paging.init())),this.btnReset&&(e.clearButton=new N.ClearButton(this),e.clearButton.init()),this.help&&(e.help||(e.help=new D.Help(this)),e.help.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new B.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new M.NoResults(this)),e.noResults.init()),this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||u["default"].addClass(this.tbl,this.prfxTf),this.hasExtensions&&this.initExtensions(),this.markActiveColumns&&(this.emitter.on(["before-filtering"],function(){return t.clearActiveColumns()}),this.emitter.on(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.linkedFilters&&this.emitter.on(["after-filtering"],function(){return t.linkFilters()}),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this),this.emitter.emit("initialized",this)}}},{key:"_insertFiltersRow",value:function(){if(!this.gridLayout){var t=void 0,e=u["default"].tag(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&this.headersRow++,t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display="none"),this.emitter.emit("filters-row-inserted",this,t),t}}},{key:"_initNoFilters",value:function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow)}},{key:"_buildInputFilter",value:function(t,e,i){var s=this.getFilterType(t),n=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===this.fltTypeInp?"text":"hidden",a=u["default"].create(this.fltTypeInp,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&a.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),a.className=e||this.fltCssClass,o["default"].add(a,"focus",this.Evt.onInpFocus.bind(this)),n?(u["default"].id(n).appendChild(a),this.externalFltEls.push(a)):i.appendChild(a),this.fltIds.push(a.id),o["default"].add(a,"keypress",this.Evt.detectKey.bind(this)),o["default"].add(a,"keydown",this.Evt.onKeyDown.bind(this)),o["default"].add(a,"keyup",this.Evt.onKeyUp.bind(this)),o["default"].add(a,"blur",this.Evt.onInpBlur.bind(this))}},{key:"_buildSubmitButton",value:function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=u["default"].create(this.fltTypeInp,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?u["default"].id(s).appendChild(n):e.appendChild(n),o["default"].add(n,"click",function(){return i.filter()})}},{key:"feature",value:function(t){return this.Mod[t]}},{key:"initExtensions",value:function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,s=t.length;s>e;e++){var n=t[e];this.ExtRegistry[n.name]||this.loadExtension(n)}this.emitter.emit("after-loading-extensions",this)}},{key:"loadExtension",value:function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,l=void 0;s&&n?l=t.path+s:(s=s.replace(".js",""),l="extensions/{}/{}".replace(/{}/g,s)),i.e(1,function(i){var n=[i(26)("./"+l)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}}},{key:"extension",value:function(t){return this.ExtRegistry[t]}},{key:"hasExtension",value:function(t){return!v["default"].isEmpty(this.ExtRegistry[t])}},{key:"destroyExtensions",value:function(){for(var t=this.extensions,e=0,i=t.length;i>e;e++){var s=t[e],n=this.ExtRegistry[s.name];n&&(n.destroy(),this.ExtRegistry[s.name]=null)}}},{key:"loadThemes",value:function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if(v["default"].isArray(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],l=n.name,a=n.path,r=this.prfxTf+l;l&&!a?a=this.themesPath+l+"/"+l+".css":!l&&n.path&&(l="theme{0}".replace("{0}",i)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null,this.emitter.emit("after-loading-themes",this)}},{key:"getStylesheet",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return u["default"].id(this.prfxTf+t)}},{key:"destroy",value:function(){var t=this;if(this._hasGrid){var e=this.tbl.rows,i=this.Mod,s=this.emitter;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.markActiveColumns&&(this.clearActiveColumns(),s.off(["before-filtering"],function(){return t.clearActiveColumns()}),s.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions(),this.validateAllRows(),this.fltGrid&&!this.gridLayout&&(this.fltGridEl=e[this.filtersRowIndex],this.tbl.deleteRow(this.filtersRowIndex)),s.emit("destroy",this),Object.keys(i).forEach(function(t){var e=i[t];e&&v["default"].isFn(e.destroy)&&e.destroy()}),this.hasVisibleRows&&s.off(["after-filtering"],function(){return t.enforceVisibility()}),this.linkedFilters&&s.off(["after-filtering"],function(){return t.linkFilters()}),u["default"].removeClass(this.tbl,this.prfxTf),this.nbHiddenRows=0,this.validRowsIndex=[],this.fltIds=[],this.activeFlt=null,this._hasGrid=!1}}},{key:"setToolbar",value:function(){if(!this.infDiv){var t=u["default"].create("div",["id",this.prfxInfDiv+this.id]);if(t.className=this.infDivCssClass,this.toolBarTgtId)u["default"].id(this.toolBarTgtId).appendChild(t);else if(this.gridLayout){var e=this.Mod.gridLayout;e.tblMainCont.appendChild(t),t.className=e.gridInfDivCssClass}else{var i=u["default"].create("caption");i.appendChild(t),this.tbl.insertBefore(i,this.tbl.firstChild)}this.infDiv=u["default"].id(this.prfxInfDiv+this.id);var s=u["default"].create("div",["id",this.prfxLDiv+this.id]);s.className=this.lDivCssClass,t.appendChild(s),this.lDiv=u["default"].id(this.prfxLDiv+this.id);var n=u["default"].create("div",["id",this.prfxRDiv+this.id]);n.className=this.rDivCssClass,t.appendChild(n),this.rDiv=u["default"].id(this.prfxRDiv+this.id);var l=u["default"].create("div",["id",this.prfxMDiv+this.id]);l.className=this.mDivCssClass,t.appendChild(l),this.mDiv=u["default"].id(this.prfxMDiv+this.id),v["default"].isUndef(this.help)&&(this.Mod.help||(this.Mod.help=new D.Help(this)),this.Mod.help.init(),this.help=!0)}}},{key:"removeToolbar",value:function(){if(this.infDiv){u["default"].remove(this.infDiv),this.infDiv=null;var t=this.tbl,e=u["default"].tag(t,"caption");e.length>0&&[].forEach.call(e,function(e){t.removeChild(e)})}}},{key:"removeExternalFlts",value:function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=u["default"].id(s);n&&(n.innerHTML="")}}},{key:"isCustomOptions",value:function(t){return this.hasCustomOptions&&-1!=this.customOptions.cols.indexOf(t)}},{key:"getCustomOptions",value:function(t){if(!v["default"].isEmpty(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],l=i.indexOf(t),a=e.values[l],r=e.texts[l],o=e.sorts[l],h=0,u=a.length;u>h;h++)n.push(a[h]),r[h]?s.push(r[h]):s.push(a[h]);return o&&(n.sort(),s.sort()),[n,s]}}},{key:"resetValues",value:function(){var t=this;if(this.rememberGridValues)if(this.loadFltOnDemand)this._resetGridValues(this.fltsValuesCookie);else{var e=this.Mod.store.getFilterValues(this.fltsValuesCookie);e.forEach(function(e,i){" "!==e&&t.setFilterValue(i,e)})}this.filter()}},{key:"_resetGridValues",value:function(t){if(this.loadFltOnDemand){var e=this.Mod.store.getFilterValues(t),i=this.getFiltersByType(this.fltTypeSlc,!0),s=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var n=0;nh;h++)""!==l[h]&&(a=u["default"].createOpt(l[h],l[h],!0),o.appendChild(a),this.hasStoredValues=!0)}}else if(r===this.fltTypeCheckList){var d=this.Mod.checkList,c=d.checkListDiv[n];c.title=c.innerHTML,c.innerHTML="";var p=u["default"].create("ul",["id",this.fltIds[n]],["colIndex",n]);p.className=d.checkListCssClass;var g=u["default"].createCheckItem(this.fltIds[n]+"_0","",this.displayAllText);g.className=d.checkListItemCssClass,p.appendChild(g),c.appendChild(p),l=e[n].split(" "+this.orOperator+" ");for(var h=0,f=l.length;f>h;h++)if(""!==l[h]){var v=u["default"].createCheckItem(this.fltIds[n]+"_"+(h+1),l[h],l[h]);v.className=d.checkListItemCssClass,p.appendChild(v),v.check.checked=!0,d.setCheckListValues(v.check),this.hasStoredValues=!0}}else r===this.fltTypeInp&&this.setFilterValue(n,e[n])}!this.hasStoredValues&&this.paging&&this.Mod.paging.setPagingInfo()}}}},{key:"filter",value:function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(p,""),t=t.replace(g,""),t=t.replace(v,""),t=t.replace(b,"");var n=t;(r.test(t)||o.test(t)||h.test(t)||f.test(t)||c.test(t))&&(n=u["default"].getText(i)),""!==n&&s.highlightKeyword.highlight(i,n,s.highlightKeyword.highlightCssClass)}}function e(t,e,i){var s=void 0,n=w["default"].removeNbFormat,u=h.test(t),x=r.test(t),T=f.test(t),k=o.test(t),P=c.test(t),R=g.test(t),F=p.test(t),I=v.test(t),O=b.test(t),E=m===t,L=y===t,N=C.test(t),D=u&&_["default"].isValid(t.replace(h,""),S),B=x&&_["default"].isValid(t.replace(r,""),S),M=T&&_["default"].isValid(t.replace(f,""),S),A=k&&_["default"].isValid(t.replace(o,""),S),H=P&&_["default"].isValid(t.replace(c,""),S),j=R&&_["default"].isValid(t.replace(g,""),S),V=void 0,U=void 0;if(_["default"].isValid(e,S))V=_["default"].format(e,S),D?(U=_["default"].format(t.replace(h,""),S),s=U>V):B?(U=_["default"].format(t.replace(r,""),S),s=U>=V):A?(U=_["default"].format(t.replace(o,""),S),s=V>=U):M?(U=_["default"].format(t.replace(f,""),S),s=V>U):H?(U=_["default"].format(t.replace(c,""),S),s=V.toString()!=U.toString()):j?(U=_["default"].format(t.replace(g,""),S),s=V.toString()==U.toString()):p.test(t)?s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive):_["default"].isValid(t,S)?(U=_["default"].format(t,S),s=V.toString()===U.toString()):s=E?d["default"].isEmpty(e):L?!d["default"].isEmpty(e):d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(l=n(e,this.colNbFormat[i]),a=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(l=n(e,"us"),a="us"):(l=n(e,"eu"),a="eu"),x)s=l<=n(t.replace(r,""),a);else if(k)s=l>=n(t.replace(o,""),a);else if(u)s=ln(t.replace(f,""),a);else if(P)s=d["default"].contains(t.replace(c,""),e,!1,this.caseSensitive)?!1:!0;else if(F)s=d["default"].contains(t.replace(p,""),e,!1,this.caseSensitive);else if(R)s=d["default"].contains(t.replace(g,""),e,!0,this.caseSensitive);else if(I)s=0===e.indexOf(t.replace(v,""))?!0:!1;else if(O){var z=t.replace(b,"");s=e.lastIndexOf(z,e.length-1)===e.length-1-(z.length-1)&&e.lastIndexOf(z,e.length-1)>-1?!0:!1}else if(E)s=d["default"].isEmpty(e);else if(L)s=!d["default"].isEmpty(e);else if(N)try{var G=t.replace(C,""),W=new RegExp(G);s=W.test(e)}catch($){s=!1}else s=d["default"].contains(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&this._hasGrid){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.Mod,n=0;this.validRowsIndex=[],this.searchArgs=this.getFiltersValue();for(var l,a,r=new RegExp(this.leOperator),o=new RegExp(this.geOperator),h=new RegExp(this.lwOperator),f=new RegExp(this.grOperator),c=new RegExp(this.dfOperator),p=new RegExp(d["default"].rgxEsc(this.lkOperator)),g=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),b=new RegExp(this.enOperator),m=this.emOperator,y=this.nmOperator,C=new RegExp(d["default"].rgxEsc(this.rgxOperator)),x=this.refRow;xI;I++){var O=this.searchArgs[this.singleSearchFlt?0:I],S=this.hasColDateType?this.colDateType[I]:this.defaultDateType;if(""!==O){var E=d["default"].matchCase(this.getCellData(T[I]),this.caseSensitive),L=O.split(this.orOperator),N=L.length>1?!0:!1,D=O.split(this.anOperator),B=D.length>1?!0:!1;if(N||B){for(var M=void 0,A=!1,H=N?L:D,j=0,V=H.length;V>j&&(M=d["default"].trim(H[j]),A=e.call(this,M,E,I),t.call(this,M,A,T[I]),!N||!A)&&(!B||A);j++);P[I]=A}else P[I]=e.call(this,d["default"].trim(O),E,I),t.call(this,O,P[I],T[I]);P[I]||(R=!1),this.singleSearchFlt&&P[I]&&(F=!0),this.emitter.emit("cell-processed",this,I,T[I])}}this.singleSearchFlt&&F&&(R=!0),R?this.validateRow(x,!0):(this.validateRow(x,!1),n++),this.emitter.emit("row-processed",this,x,this.validRowsIndex.length,R)}}this.nbVisibleRows=this.validRowsIndex.length,this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this)}}},{key:"getColValues",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],s=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(this.fltGrid){var n=this.tbl.rows,l=[];e&&l.push(this.getHeadersText()[t]);for(var a=this.refRow;a0&&(r=-1!=s.indexOf(a));var o=n[a].cells,h=o.length;if(h===this.nbCells&&!r)for(var u=0;h>u;u++)if(u==t&&""===n[a].style.display){var f=this.getCellData(o[u]),d=this.colNbFormat?this.colNbFormat[t]:null,c=i?w["default"].removeNbFormat(f,d):f;l.push(c)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e=void 0,i=this.getFilterElement(t);if(!i)return"";var s=this.getFilterType(t);if(s!==this.fltTypeMulti&&s!==this.fltTypeCheckList)e=i.value;else if(s===this.fltTypeMulti){e="";for(var n=0,l=i.options.length;l>n;n++)i.options[n].selected&&(e=e.concat(i.options[n].value+" "+this.orOperator+" "));e=e.substr(0,e.length-4)}else s===this.fltTypeCheckList&&(null!==i.getAttribute("value")?(e=i.getAttribute("value"),e=e.substr(0,e.length-3)):e="");return e}}},{key:"getFiltersValue",value:function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++)t.push(d["default"].trim(d["default"].matchCase(this.getFilterValue(e),this.caseSensitive)));return t}}},{key:"getFilterId",value:function(t){return this.fltGrid?this.fltIds[t]:void 0}},{key:"getFiltersByType",value:function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var l=this.getFilterType(s);if(l===d["default"].lower(t)){var a=e?s:this.fltIds[s];i.push(a)}}return i}}},{key:"getFilterElement",value:function(t){var e=this.fltIds[t];return u["default"].id(e)}},{key:"getCellsNb",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length}},{key:"getRowsNb",value:function(t){var e=v["default"].isUndef(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)}},{key:"getCellData",value:function(t){var e=t.cellIndex;return this.customCellData&&-1!=this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):u["default"].getText(t)}},{key:"getTableData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.refRow;lo;o++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(o))){var u=this.getCellData(r[o]);a[1].push(u)}s.push(a)}return s}},{key:"getFilteredData",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,s=[];if(t){var n=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),n])}for(var l=this.getValidRows(!0),a=0;an;n++){var a=i[n],r=a[1],o=r[t];s.push(o)}return s}},{key:"getRowDisplay",value:function(t){return v["default"].isObj(t)?t.style.display:null}},{key:"validateRow",value:function(t,e){var i=this.tbl.rows[t];if(i&&"boolean"==typeof e){this.hasVisibleRows&&-1!==this.visibleRows.indexOf(t)&&(e=!0);var s=e?"":"none",n=e?"true":"false";i.style.display=s,this.paging&&i.setAttribute("validRow",n),e&&(-1===this.validRowsIndex.indexOf(t)&&this.validRowsIndex.push(t),this.onRowValidated&&this.onRowValidated.call(null,this,t),this.emitter.emit("row-validated",this,t))}}},{key:"validateAllRows",value:function(){if(this._hasGrid){this.validRowsIndex=[];for(var t=this.refRow;tl;l++){var r=i.options[l];(""===n||""===n[0])&&(r.selected=!1),""===r.value&&(r.selected=!1),""!==r.value&&m["default"].has(n,r.value,!0)&&(r.selected=!0)}else if(s===this.fltTypeCheckList){e=d["default"].matchCase(e,this.caseSensitive);var o=e.split(" "+this.orOperator+" "),h=u["default"].tag(i,"li").length;i.setAttribute("value",""),i.setAttribute("indexes","");for(var f=0;h>f;f++){var c=u["default"].tag(i,"li")[f],p=u["default"].tag(c,"label")[0],g=u["default"].tag(c,"input")[0],v=d["default"].matchCase(u["default"].getText(p),this.caseSensitive);""!==v&&m["default"].has(o,v,!0)?(g.checked=!0,this.Mod.checkList.setCheckListValues(g)):(g.checked=!1,this.Mod.checkList.setCheckListValues(g))}}}}},{key:"setColWidths",value:function(t,e){function i(){ -for(var t=this.nbCells,i=this.colWidths,s=u["default"].tag(e,"col"),n=s.length>0,l=n?null:H.createDocumentFragment(),a=0;t>a;a++){var r=void 0;n?r=s[a]:(r=u["default"].create("col",["id",this.id+"_col_"+a]),l.appendChild(r)),r.style.width=i[a]}n||e.insertBefore(l,e.firstChild)}if(this.fltGrid&&this.hasColWidths){e=e||this.tbl;var s=void 0;s=void 0===t?"none"!=e.rows[0].style.display?0:1:t,i.call(this)}}},{key:"enforceVisibility",value:function(){if(this.hasVisibleRows)for(var t=0,e=this.visibleRows.length;e>t;t++){var i=this.visibleRows[t];i<=this.nbRows&&this.validateRow(i,!0)}}},{key:"clearFilters",value:function(){if(this.fltGrid){this.emitter.emit("before-clearing-filters",this),this.onBeforeReset&&this.onBeforeReset.call(null,this,this.getFiltersValue());for(var t=0,e=this.fltIds.length;e>t;t++)this.setFilterValue(t,"");this.rememberPageLen&&p["default"].remove(this.pgLenCookie),this.rememberPageNb&&p["default"].remove(this.pgNbCookie),this.onAfterReset&&this.onAfterReset.call(null,this),this.filter(),this.emitter.emit("after-clearing-filters",this)}}},{key:"clearActiveColumns",value:function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)u["default"].removeClass(this.getHeaderElement(t),this.activeColumnsCssClass)}},{key:"markActiveColumn",value:function(t){var e=this.getHeaderElement(t);u["default"].hasClass(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),u["default"].addClass(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))}},{key:"linkFilters",value:function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(this.fltTypeSlc,!0),e=this.getFiltersByType(this.fltTypeMulti,!0),i=this.getFiltersByType(this.fltTypeCheckList,!0),s=t.concat(e);s=s.concat(i);var n=this.activeFilterId.split("_")[0];n=n.split(this.prfxFlt)[1];for(var l=void 0,a=0,r=s.length;r>a;a++){var o=u["default"].id(this.fltIds[s[a]]);if(l=this.getFilterValue(s[a]),n!==s[a]||this.paging&&-1!=t.indexOf(s[a])&&n===s[a]||!this.paging&&(-1!=i.indexOf(s[a])||-1!=e.indexOf(s[a]))||l===this.displayAllText){if(-1!=i.indexOf(s[a])?this.Mod.checkList.checkListDiv[s[a]].innerHTML="":o.innerHTML="",this.loadFltOnDemand){var h=u["default"].createOpt(this.displayAllText,"");o&&o.appendChild(h)}-1!=i.indexOf(s[a])?this.Mod.checkList.build(s[a]):this.Mod.dropdown.build(s[a],!0),this.setFilterValue(s[a],l)}}}}},{key:"isExactMatch",value:function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==this.fltTypeInp}},{key:"isImported",value:function(t,e){for(var i=!1,s=e?e:"script",n="script"==s?"src":"href",l=u["default"].tag(H,s),a=0,r=l.length;r>a;a++)if(void 0!==l[a][n]&&l[a][n].match(t)){i=!0;break}return i}},{key:"import",value:function(t,e,i,s){var n=s?s:"script",l=this.isImported(e,n);if(!l){var a=this,r=!1,o=void 0,h=u["default"].tag(H,"head")[0];o="link"===d["default"].lower(n)?u["default"].create("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):u["default"].create("script",["id",t],["type","text/javascript"],["src",e]),o.onload=o.onreadystatechange=function(){r||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(r=!0,"function"==typeof i&&i.call(null,a))},o.onerror=function(){throw new Error("TF script could not load: "+e)},h.appendChild(o)}}},{key:"hasGrid",value:function(){return this._hasGrid}},{key:"getFiltersId",value:function(){return this.fltIds||[]}},{key:"getValidRows",value:function(t){if(!t)return this.validRowsIndex;this.validRowsIndex=[];for(var e=this.refRow;e]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},create:function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var n=0;n0){var s=document.cookie,n=s.indexOf(i);if(-1!==n){n+=i.length;var l=s.indexOf(";",n);-1===l&&(l=s.length),e=unescape(s.substring(n,l))}}return e},remove:function(t){this.write(t,"",-1)},valueToArray:function(t,e){e||(e=",");var i=this.read(t),s=i.split(e);return s},getValueByIndex:function(t,e,i){i||(i=",");var s=this.valueToArray(t,i);return s[e]}}},function(t,e){"use strict";function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}Object.defineProperty(e,"__esModule",{value:!0});var s=void 0;e["default"]={isObj:function(t){var e=!1;return"string"==typeof t?window[t]&&"object"===i(window[t])&&(e=!0):t&&"object"===("undefined"==typeof t?"undefined":i(t))&&(e=!0),e},isFn:function(t){return t&&t.constructor==Function},isArray:function(t){return t&&t.constructor==Array},isUndef:function(t){return t===s},isNull:function(t){return null===t},isEmpty:function(t){return this.isUndef(t)||this.isNull(t)||0===t.length}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={has:function(t,e,i){for(var s=void 0===i?!1:i,n=0;n2)return t;var e=void 0;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function s(t){if(void 0===t)return 0;for(var e=void 0,i=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],s=0;s11||23>e)&&(e-=12),1>e||e>12?0:e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var i=this.format(t,e);t=i.getDate()+"/"+(i.getMonth()+1)+"/"+i.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var s=void 0,n=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,n=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,n=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,n=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&n.test(t)===!1)return!1;var l=t.split(RegExp.$1),a=void 0,r=void 0,o=void 0;a="M"===e.substring(0,1)?l[0]:"M"===e.substring(1,2)?l[1]:l[2],r="D"===e.substring(0,1)?l[0]:"D"===e.substring(1,2)?l[1]:l[2],o="Y"===e.substring(0,1)?l[0]:"Y"===e.substring(1,2)?l[1]:l[2],parseInt(o,10)<=50&&(o=(parseInt(o,10)+2e3).toString()),parseInt(o,10)<=99&&(o=(parseInt(o,10)+1900).toString());var h=new Date(parseInt(o,10),parseInt(a,10)-1,parseInt(r,10),0,0,0,0);return parseInt(r,10)!=h.getDate()?!1:parseInt(a,10)-1!=h.getMonth()?!1:!0},format:function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,l=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":l=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(l[2]),s(l[1])-1,l[0]);break;case"DMY":l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0]);break;case"MDY":l=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[0]-1,l[1]);break;case"YMD":l=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),n=new Date(i(l[0]),l[1]-1,l[2]);break;default:l=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),n=new Date(i(l[2]),l[1]-1,l[0])}return n}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={removeNbFormat:function(t,e){if(t){e||(e="us");var i=t;return i="us"===l["default"].lower(e)?+i.replace(/[^\d\.-]/g,""):+i.replace(/[^\d\,-]/g,"").replace(",",".")}}}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(t,e){for(var i=0;i0&&s.removeChild(P[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(0,this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",p["default"].add(this.tblCont,"scroll",function(e){var i=p["default"].target(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var R=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===R.length&&(R[0].async_sort=!0,R[0].trigger_ids=g),this.tblHasColTag=u["default"].tag(s,"col").length>0?!0:!1;var F=function(){for(var t=e.nbCells-1;t>=0;t--){var i=u["default"].create("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.gridColElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var I=u["default"].tag(s,"col"),O=0;O',e.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",e.onBeforePopUpOpen=u["default"].isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,e.onAfterPopUpOpen=u["default"].isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,e.onBeforePopUpClose=u["default"].isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,e.onAfterPopUpClose=u["default"].isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,e.popUpFltSpans=[],e.popUpFltImgs=[],e.popUpFltElms=e.popUpFltElmCache||[],e.popUpFltAdjustToContainer=!0,e.prfxPopUpSpan="popUpSpan_",e.prfxPopUpDiv="popUpDiv_",e}return a(i,e),r(i,[{key:"onClick",value:function(e){var i=e||t.event,s=i.target.parentNode,n=parseInt(s.getAttribute("ci"),10);if(this.closeAll(n),this.toggle(n),this.popUpFltAdjustToContainer){var l=this.popUpFltElms[n],a=this.tf.getHeaderElement(n),r=.95*a.clientWidth;l.style.width=parseInt(r,10)+"px"}p["default"].cancel(i),p["default"].stop(i)}},{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;iy;y++)if(t===y&&(!e||e&&n.disableExcludedOptions)||t==y&&e&&(""===r[g].style.display&&!n.paging||n.paging&&(!n.validRowsIndex||n.validRowsIndex&&-1!=n.validRowsIndex.indexOf(g))&&(void 0===h||h==t||h!=t&&-1!=n.validRowsIndex.indexOf(g)))){var _=n.getCellData(b[y]),C=p["default"].matchCase(_,o);if(d["default"].has(this.opts,C,o)||this.opts.push(_),e&&n.disableExcludedOptions){var w=c[y];w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,o)||d["default"].has(f,C,o)||f.push(_)}}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(o?(this.opts.sort(),f&&f.sort()):(this.opts.sort(v["default"].ignoreCase),f&&f.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),f&&f.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),f&&f.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),f&&f.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,a,e,f),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addOptions",value:function(t,e,i,s){var n=this.tf,l=p["default"].lower(this.slcFillingMethod),a=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var r=0;r"+h+""}else{var g=void 0;g=n.loadFltOnDemand&&a===this.opts[r]&&n.getFilterType(t)===n.fltTypeSlc?u["default"].createOpt(h,o,!0):u["default"].createOpt(h,o,!1),f&&(g.disabled=!0),e.appendChild(g)}}"innerhtml"===l&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,i=p["default"].lower(this.slcFillingMethod);if("innerhtml"===i)this.slcInnerHtml+='";else{var s=u["default"].createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(s.style.display="none"),t.appendChild(s),e.enableEmptyOption){var n=u["default"].createOpt(e.emptyText,e.emOperator);t.appendChild(n)}if(e.enableNonEmptyOption){var l=u["default"].createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(l)}}return t}},{key:"destroy",value:function(){}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),l=s(n);e["default"]={ignoreCase:function(t,e){var i=l["default"].lower(t),s=l["default"].lower(e);return s>i?-1:i>s?1:0}}},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;iy;y++)if(t===y&&(!n.linkedFilters||n.linkedFilters&&n.disableExcludedOptions)||t===y&&n.linkedFilters&&(""===o[c].style.display&&!n.paging||n.paging&&(!h||h===t||h!=t&&-1!=n.validRowsIndex.indexOf(c)))){var _=n.getCellData(g[y]),C=p["default"].matchCase(_,n.matchCase);d["default"].has(this.opts,C,n.matchCase)||this.opts.push(_);var w=f[y];n.linkedFilters&&n.disableExcludedOptions&&(w||(w=n.getFilteredDataCol(y)),d["default"].has(w,C,n.matchCase)||d["default"].has(this.excludedOpts,C,n.matchCase)||this.excludedOpts.push(_))}}if(this.isCustom){var x=n.getCustomOptions(t);this.opts=x[0],this.optsTxt=x[1]}if(n.sortSlc&&!this.isCustom&&(n.matchCase?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(v["default"].ignoreCase),this.excludedOpts&&this.excludedOpts.sort(v["default"].ignoreCase))),n.sortNumAsc&&-1!=n.sortNumAsc.indexOf(t))try{this.opts.sort(numSortAsc),this.excludedOpts&&this.excludedOpts.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}if(n.sortNumDesc&&-1!=n.sortNumDesc.indexOf(t))try{this.opts.sort(numSortDesc),this.excludedOpts&&this.excludedOpts.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(T){this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,r,n.separator),n.loadFltOnDemand&&(a.innerHTML=""),a.appendChild(r),a.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",n,t,a)}}},{key:"addChecks",value:function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),l=0;l0?1:0),l=n+s.pagingLength-1<=e.nbVisibleRows?n+s.pagingLength-1:e.nbVisibleRows;i=n+this.fromToTextSeparator+l+this.overText+e.nbVisibleRows}}else i=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}}},{key:"destroy",value:function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?u["default"].remove(this.rowsCounterDiv):u["default"].id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.nbVisibleRows)}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i",i.btnPrevPageText=s.btn_prev_page_text||"<",i.btnLastPageText=s.btn_last_page_text||">|",i.btnFirstPageText=s.btn_first_page_text||"|<",i.btnNextPageHtml=s.btn_next_page_html||(t.enableIcons?'':null),i.btnPrevPageHtml=s.btn_prev_page_html||(t.enableIcons?'':null),i.btnFirstPageHtml=s.btn_first_page_html||(t.enableIcons?'':null),i.btnLastPageHtml=s.btn_last_page_html||(t.enableIcons?'':null),i.pageText=s.page_text||" Page ",i.ofText=s.of_text||" of ",i.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",i.hasPagingBtns=s.paging_btns===!1?!1:!0,i.pageSelectorType=s.page_selector_type||t.fltTypeSlc,i.onBeforeChangePage=c["default"].isFn(s.on_before_change_page)?s.on_before_change_page:null,i.onAfterChangePage=c["default"].isFn(s.on_after_change_page)?s.on_after_change_page:null,i.prfxSlcPages="slcPages_",i.prfxSlcResults="slcResults_",i.prfxSlcResultsTxt="slcResultsTxt_",i.prfxBtnNextSpan="btnNextSpan_",i.prfxBtnPrevSpan="btnPrevSpan_",i.prfxBtnLastSpan="btnLastSpan_",i.prfxBtnFirstSpan="btnFirstSpan_",i.prfxBtnNext="btnNext_",i.prfxBtnPrev="btnPrev_",i.prfxBtnLast="btnLast_",i.prfxBtnFirst="btnFirst_",i.prfxPgSpan="pgspan_",i.prfxPgBeforeSpan="pgbeforespan_",i.prfxPgAfterSpan="pgafterspan_";var n=t.refRow,r=t.nbRows;i.nbPages=Math.ceil((r-n)/i.pagingLength);var o=i;return i.evt={slcIndex:function(){return o.pageSelectorType===t.fltTypeSlc?o.pagingSlc.options.selectedIndex:parseInt(o.pagingSlc.value,10)-1},nbOpts:function(){return o.pageSelectorType===t.fltTypeSlc?parseInt(o.pagingSlc.options.length,10)-1:o.nbPages-1},next:function(){var t=o.evt.slcIndex()0?o.evt.slcIndex()-1:o.evt.nbOpts();o.changePage(t)},last:function(){o.changePage(o.evt.nbOpts())},first:function(){o.changePage(0)},_detectKey:function(e){var i=b["default"].keyCode(e);13===i&&(t.sorted?(t.filter(),o.changePage(o.evt.slcIndex())):o.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},i}return r(e,t),o(e,[{key:"init",value:function(){var t,e=this,i=this.tf,s=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),s.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===i.fltTypeSlc&&(t=f["default"].create(i.fltTypeSlc,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,b["default"].add(t,"change",s.slcPagesChange)),this.pageSelectorType===i.fltTypeInp&&(t=f["default"].create(i.fltTypeInp,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,b["default"].add(t,"keypress",s._detectKey));var n=f["default"].create("span",["id",this.prfxBtnNextSpan+i.id]),l=f["default"].create("span",["id",this.prfxBtnPrevSpan+i.id]),a=f["default"].create("span",["id",this.prfxBtnLastSpan+i.id]),r=f["default"].create("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,b["default"].add(n,"click",s.next);else{var o=f["default"].create(i.fltTypeInp,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);o.className=this.btnPageCssClass,b["default"].add(o,"click",s.next),n.appendChild(o)}if(this.btnPrevPageHtml)l.innerHTML=this.btnPrevPageHtml,b["default"].add(l,"click",s.prev);else{var h=f["default"].create(i.fltTypeInp,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,b["default"].add(h,"click",s.prev),l.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,b["default"].add(a,"click",s.last);else{var u=f["default"].create(i.fltTypeInp,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,b["default"].add(u,"click",s.last),a.appendChild(u)}if(this.btnFirstPageHtml)r.innerHTML=this.btnFirstPageHtml,b["default"].add(r,"click",s.first);else{var d=f["default"].create(i.fltTypeInp,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]); -d.className=this.btnPageCssClass,b["default"].add(d,"click",s.first),r.appendChild(d)}}this.pagingTgtId||i.setToolbar();var c=this.pagingTgtId?f["default"].id(this.pagingTgtId):i.mDiv;c.appendChild(r),c.appendChild(l);var p=f["default"].create("span",["id",this.prfxPgBeforeSpan+i.id]);p.appendChild(f["default"].text(this.pageText)),p.className=this.nbPgSpanCssClass,c.appendChild(p),c.appendChild(t);var g=f["default"].create("span",["id",this.prfxPgAfterSpan+i.id]);g.appendChild(f["default"].text(this.ofText)),g.className=this.nbPgSpanCssClass,c.appendChild(g);var v=f["default"].create("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild(f["default"].text(" "+this.nbPages+" ")),c.appendChild(v),c.appendChild(n),c.appendChild(a),this.pagingSlc=f["default"].id(this.prfxSlcPages+i.id),i.rememberGridValues||this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["initialized"],function(){return e.resetValues()}),this.initialized=!0}}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!1:arguments[0],e=this.tf;this.isEnabled()||(this.enable(),this.init(),t&&e.filter())}},{key:"resetPagingInfo",value:function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)}},{key:"setPagingInfo",value:function(t){var e=this.tf,i=this.pagingTgtId?f["default"].id(this.pagingTgtId):e.mDiv,s=f["default"].id(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),s.innerHTML=this.nbPages,this.pageSelectorType===e.fltTypeSlc&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var n=0;nl;l++){var r=e.validRowsIndex[l],o=i[r],h=o.getAttribute("validRow"),u=!1;l>=s&&n>l?(c["default"].isNull(h)||Boolean("true"===h))&&(o.style.display="",u=!0):o.style.display="none",this.emitter.emit("row-paged",e,r,l,u)}e.nbVisibleRows=e.validRowsIndex.length,this.emitter.emit("grouped-by-page",e,this)}},{key:"getPage",value:function(){return this.currentPageNb}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":n(t);if("string"===s)switch(g["default"].lower(t)){case"next":i.next();break;case"previous":i.prev();break;case"last":i.last();break;case"first":i.first();break;default:i.next()}else"number"===s&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,i=this.evt;if(!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var s=f["default"].create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],l=this.resultsPerPage[1],a=f["default"].create("span",["id",this.prfxSlcResultsTxt+e.id]);a.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var r=this.resultsPerPageTgtId?f["default"].id(this.resultsPerPageTgtId):e.rDiv;a.appendChild(f["default"].text(n));var o=e.feature("help");o&&o.btn?(o.btn.parentNode.insertBefore(a,o.btn),o.btn.parentNode.insertBefore(s,o.btn)):(r.appendChild(a),r.appendChild(s));for(var h=0;h=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.feature("store").savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)),this.emitter.emit("after-changing-page",e,t))}},{key:"changeResultsPerPage",value:function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-changing-results-per-page",t);var e=this.resultsPerPageSlc,i=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*i,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var s=this.pagingSlc.options.length-1<=i?this.pagingSlc.options.length-1:i;this.pagingSlc.options[s].selected=!0}t.rememberPageLen&&t.feature("store").savePageLength(t.pgLenCookie)}this.emitter.emit("after-changing-results-per-page",t)}}},{key:"resetValues",value:function(){var t=this.tf;t.rememberPageLen&&this.resetPageLength(t.pgLenCookie),t.rememberPageNb&&this.resetPage(t.pgNbCookie)}},{key:"resetPage",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",e);var i=e.feature("store").getPageNb(t);""!==i&&this.changePage(i-1),this.emitter.emit("after-reset-page",e,i)}}},{key:"resetPageLength",value:function(t){var e=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",e);var i=e.feature("store").getPageLength(t);""!==i&&(this.resultsPerPageSlc.options[i].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",e,i)}}},{key:"destroy",value:function(){var t=this,e=this.tf;if(this.initialized){var i=f["default"].id(this.prfxBtnNextSpan+e.id),s=f["default"].id(this.prfxBtnPrevSpan+e.id),n=f["default"].id(this.prfxBtnLastSpan+e.id),l=f["default"].id(this.prfxBtnFirstSpan+e.id),a=f["default"].id(this.prfxPgBeforeSpan+e.id),r=f["default"].id(this.prfxPgAfterSpan+e.id),o=f["default"].id(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===e.fltTypeSlc?b["default"].remove(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===e.fltTypeInp&&b["default"].remove(this.pagingSlc,"keypress",h._detectKey),f["default"].remove(this.pagingSlc)),i&&(b["default"].remove(i,"click",h.next),f["default"].remove(i)),s&&(b["default"].remove(s,"click",h.prev),f["default"].remove(s)),n&&(b["default"].remove(n,"click",h.last),f["default"].remove(n)),l&&(b["default"].remove(l,"click",h.first),f["default"].remove(l)),a&&f["default"].remove(a),r&&f["default"].remove(r),o&&f["default"].remove(o),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["initialized"],function(){return t.resetValues()}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}}}]),e}(h.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i':null),i.prfxResetSpan="resetspan_",i}return a(e,t),r(e,[{key:"onClick",value:function(){this.isEnabled()&&this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(!this.initialized){var i=u["default"].create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?u["default"].id(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;d["default"].add(n,"click",function(){t.onClick()})}else{var l=u["default"].create("a",["href","javascript:void(0);"]);l.className=e.btnResetCssClass,l.appendChild(u["default"].text(this.btnResetText)),i.appendChild(l),d["default"].add(l,"click",function(){t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}}},{key:"destroy",value:function(){var t=this.tf;if(this.initialized){var e=u["default"].id(this.prfxResetSpan+t.id);e&&u["default"].remove(e),this.btnResetEl=null,this.initialized=!1}}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;i<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',i.instrHtml=s.help_instructions_html||null,i.btnText=s.help_instructions_btn_text||"?",i.btnHtml=s.help_instructions_btn_html||null,i.btnCssClass=s.help_instructions_btn_css_class||"helpBtn",i.contCssClass=s.help_instructions_container_css_class||"helpCont",i.btn=null,i.cont=null,i.defaultHtml='

TableFilter v'+t.version+'

'+p+"
©2015-"+t.year+' Max Guglielmi
',i.prfxHelpSpan="helpSpan_",i.prfxHelpDiv="helpDiv_",i}return a(e,t),r(e,[{key:"init",value:function(){var t=this;if(!this.initialized){var e=this.tf,i=u["default"].create("span",["id",this.prfxHelpSpan+e.id]),s=u["default"].create("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?u["default"].id(this.tgtId):e.rDiv;n.appendChild(i);var l=this.contTgtId?u["default"].id(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;d["default"].add(a,"click",function(){t.toggle()}),l.appendChild(s)}else{l.appendChild(s);var r=u["default"].create("a",["href","javascript:void(0);"]);r.className=this.btnCssClass,r.appendChild(u["default"].text(this.btnText)),i.appendChild(r),d["default"].add(r,"click",function(){t.toggle()})}this.instrHtml?(this.contTgtId&&l.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,d["default"].add(s,"dblclick",function(){t.toggle()})),s.innerHTML+=this.defaultHtml,d["default"].add(s,"click",function(){t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}}},{key:"toggle",value:function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||"none"===t?this.cont.style.display="inline":this.cont.style.display="none"}}},{key:"destroy",value:function(){this.initialized&&(u["default"].remove(this.btn),this.btn=null,this.cont&&(u["default"].remove(this.cont),this.cont=null,this.initialized=!1))}}]),e}(o.Feature)},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var r=function(){function t(t,e){for(var i=0;ia;a++){var r=i?a:e[a];this.setRowBg(r,l),l++}}},{key:"processRow",value:function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)}},{key:"setRowBg",value:function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),u["default"].addClass(i[t],s%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;u["default"].removeClass(e[t],this.oddCss),u["default"].removeClass(e[t],this.evenCss)}}},{key:"destroy",value:function(){var t=this;if(this.initialized){for(var e=0;e0?this.hide():this.show()}},{key:"show",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this.tf,this))}},{key:"hide",value:function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display="none",this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))}},{key:"setWidth",value:function(){if(this.initialized&&!this.isExternal&&this.isEnabled())if(this.tf.gridLayout){var t=this.tf.feature("gridLayout");this.cont.style.width=t.tblCont.clientWidth+"px"}else this.cont.style.width=this.tf.tbl.clientWidth+"px"}},{key:"destroy",value:function(){var t=this;this.initialized&&(u["default"].remove(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)}}]),e}(o.Feature)}])}); \ No newline at end of file + 'use strict'; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + // Features + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.TableFilter = undefined; + + var _event = __webpack_require__(1); + + var _event2 = _interopRequireDefault(_event); + + var _dom = __webpack_require__(2); + + var _dom2 = _interopRequireDefault(_dom); + + var _string = __webpack_require__(3); + + var _string2 = _interopRequireDefault(_string); + + var _cookie = __webpack_require__(4); + + var _cookie2 = _interopRequireDefault(_cookie); + + var _types = __webpack_require__(5); + + var _types2 = _interopRequireDefault(_types); + + var _array = __webpack_require__(6); + + var _array2 = _interopRequireDefault(_array); + + var _date = __webpack_require__(7); + + var _date2 = _interopRequireDefault(_date); + + var _helpers = __webpack_require__(8); + + var _helpers2 = _interopRequireDefault(_helpers); + + var _emitter = __webpack_require__(9); + + var _store = __webpack_require__(10); + + var _gridLayout = __webpack_require__(11); + + var _loader = __webpack_require__(13); + + var _highlightKeywords = __webpack_require__(14); + + var _popupFilter = __webpack_require__(15); + + var _dropdown = __webpack_require__(16); + + var _checkList = __webpack_require__(18); + + var _rowsCounter = __webpack_require__(19); + + var _statusBar = __webpack_require__(20); + + var _paging = __webpack_require__(21); + + var _clearButton = __webpack_require__(22); + + var _help = __webpack_require__(23); + + var _alternateRows = __webpack_require__(24); + + var _noResults = __webpack_require__(25); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var global = window, + doc = global.document; + + var TableFilter = exports.TableFilter = (function () { + + /** + * TableFilter object constructor + * requires `table` or `id` arguments, `row` and `configuration` optional + * @param {DOMElement} table Table DOM element + * @param {String} id Table id + * @param {Number} row index indicating the 1st row + * @param {Object} configuration object + */ + + function TableFilter() { + var _this = this; + + _classCallCheck(this, TableFilter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (args.length === 0) { + return; + } + + this.id = null; + this.version = '0.1.6'; + this.year = new Date().getFullYear(); + this.tbl = null; + this.startRow = null; + this.refRow = null; + this.headersRow = null; + this.cfg = {}; + this.nbFilterableRows = null; + this.nbRows = null; + this.nbCells = null; + this._hasGrid = false; + + // TODO: use for-of with babel plug-in + args.forEach(function (arg) { + // for (let arg of args) { + var argtype = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); + if (argtype === 'object' && arg && arg.nodeName === 'TABLE') { + _this.tbl = arg; + _this.id = arg.id || 'tf_' + new Date().getTime() + '_'; + } else if (argtype === 'string') { + _this.id = arg; + _this.tbl = _dom2.default.id(arg); + } else if (argtype === 'number') { + _this.startRow = arg; + } else if (argtype === 'object') { + _this.cfg = arg; + } + // } + }); + + if (!this.tbl || this.tbl.nodeName != 'TABLE' || this.getRowsNb() === 0) { + throw new Error('Could not instantiate TableFilter: HTML table not found.'); + } + + // configuration object + var f = this.cfg; + + this.emitter = new _emitter.Emitter(); + + //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 || 'tablefilter/'; + + /*** filter types ***/ + this.fltTypeInp = 'input'; + this.fltTypeSlc = 'select'; + this.fltTypeMulti = 'multiple'; + this.fltTypeCheckList = 'checklist'; + this.fltTypeNone = 'none'; + + /*** filters' grid properties ***/ + + //enables/disables filter grid + this.fltGrid = f.grid === false ? false : true; + + //enables/disables grid layout (fixed headers) + this.gridLayout = Boolean(f.grid_layout); + + this.filtersRowIndex = isNaN(f.filters_row_index) ? 0 : f.filters_row_index; + this.headersRow = isNaN(f.headers_row_index) ? this.filtersRowIndex === 0 ? 1 : 0 : f.headers_row_index; + + //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 valid rows indexes (rows visible upon filtering) + this.validRowsIndex = []; + //stores filters row element + this.fltGridEl = null; + //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; + + //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.stylePath = f.style_path || this.basePath + 'style/'; + this.stylesheet = f.stylesheet || this.stylePath + 'tablefilter.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.alternateRows = Boolean(f.alternate_rows); + //defines widths of columns + this.hasColWidths = _types2.default.isArray(f.col_widths); + this.colWidths = this.hasColWidths ? f.col_widths : null; + //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'; + + /*** filters' grid behaviours ***/ + //enables/disables enter key + this.enterKey = f.enter_key === false ? false : true; + //calls function before filtering starts + this.onBeforeFilter = _types2.default.isFn(f.on_before_filter) ? f.on_before_filter : null; + //calls function after filtering + this.onAfterFilter = _types2.default.isFn(f.on_after_filter) ? f.on_after_filter : null; + //enables/disables case sensitivity + this.caseSensitive = Boolean(f.case_sensitive); + //has exact match per column + this.hasExactMatchByCol = _types2.default.isArray(f.columns_exact_match); + this.exactMatchByCol = this.hasExactMatchByCol ? f.columns_exact_match : []; + //enables/disbles exact match for search + this.exactMatch = Boolean(f.exact_match); + //refreshes drop-down lists upon validation + this.linkedFilters = Boolean(f.linked_filters); + //wheter excluded options are disabled + this.disableExcludedOptions = Boolean(f.disable_excluded_options); + //stores active filter element + this.activeFlt = null; + //id of active filter + this.activeFilterId = null; + //enables always visible rows + this.hasVisibleRows = Boolean(f.rows_always_visible); + //array containing always visible rows + this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; + //enables/disables external filters generation + this.isExternalFlt = Boolean(f.external_flt_grid); + //array containing ids of external elements containing filters + this.externalFltTgtIds = f.external_flt_grid_ids || []; + //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 = _types2.default.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null; + //enables/disables single filter search + this.singleSearchFlt = Boolean(f.single_filter); + //calls function after row is validated + this.onRowValidated = _types2.default.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 = _types2.default.isFn(f.custom_cell_data) ? f.custom_cell_data : null; + //input watermark text array + this.watermark = f.watermark || ''; + this.isWatermarkArray = _types2.default.isArray(this.watermark); + //id of toolbar container element + this.toolBarTgtId = f.toolbar_target_id || null; + //enables/disables help div + this.help = _types2.default.isUndef(f.help_instructions) ? undefined : Boolean(f.help_instructions); + //popup filters + this.popupFilters = Boolean(f.popup_filters); + //active columns color + this.markActiveColumns = Boolean(f.mark_active_columns); + //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 = _types2.default.isFn(f.on_before_active_column) ? f.on_before_active_column : null; + //calls function after active column header is marked + this.onAfterActiveColumn = _types2.default.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 || 'Clear'; + //enables/disables empty option in combo-box filters + this.enableEmptyOption = Boolean(f.enable_empty_option); + //defines empty option text + this.emptyText = f.empty_text || '(Empty)'; + //enables/disables non empty option in combo-box filters + this.enableNonEmptyOption = Boolean(f.enable_non_empty_option); + //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 = Boolean(f.sort_num_asc); + this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null; + //enables/disables descending numeric options sorting + this.isSortNumDesc = Boolean(f.sort_num_desc); + this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null; + //Select filters are populated on demand + this.loadFltOnDemand = Boolean(f.load_filters_on_demand); + this.hasCustomOptions = _types2.default.isObj(f.custom_options); + this.customOptions = f.custom_options; + + /*** 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 || '^[¥£€$]'; + this.separator = f.separator || ','; + + /*** rows counter ***/ + //show/hides rows counter + this.rowsCounter = Boolean(f.rows_counter); + + /*** status bar ***/ + //show/hides status bar + this.statusBar = Boolean(f.status_bar); + + /*** loader ***/ + //enables/disables loader/spinner indicator + this.loader = Boolean(f.loader); + + /*** validation - reset buttons/links ***/ + //show/hides filter's validation button + this.displayBtn = Boolean(f.btn); + //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 = Boolean(f.btn_reset); + //defines css class for reset button + this.btnResetCssClass = f.btn_reset_css_class || 'reset'; + //callback function before filters are cleared + this.onBeforeReset = _types2.default.isFn(f.on_before_reset) ? f.on_before_reset : null; + //callback function after filters are cleared + this.onAfterReset = _types2.default.isFn(f.on_after_reset) ? f.on_after_reset : null; + + /*** paging ***/ + //enables/disables table paging + this.paging = Boolean(f.paging); + this.nbVisibleRows = 0; //nb visible rows + this.nbHiddenRows = 0; //nb hidden rows + + /*** autofilter on typing ***/ + //enables/disables auto filtering, table is filtered when user stops + //typing + this.autoFilter = Boolean(f.auto_filter); + //onkeyup delay timer (msecs) + this.autoFilterDelay = !isNaN(f.auto_filter_delay) ? f.auto_filter_delay : 900; + //typing indicator + this.isUserTyping = null; + this.autoFilterTimer = null; + + /*** keyword highlighting ***/ + //enables/disables keyword highlighting + this.highlightKeywords = Boolean(f.highlight_keywords); + + /*** No results feature ***/ + this.noResults = _types2.default.isObj(f.no_results_message) || Boolean(f.no_results_message); + + /*** 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 = _types2.default.isArray(f.col_number_format); + //array containing columns nb formats + this.colNbFormat = this.hasColNbFormat ? f.col_number_format : null; + //enables date type per column + this.hasColDateType = _types2.default.isArray(f.col_date_type); + //array containing columns date type + this.colDateType = this.hasColDateType ? f.col_date_type : null; + + /*** 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_'; + //filter values cookie + this.prfxCookieFltsValues = 'tf_flts_'; + //page nb cookie + this.prfxCookiePageNb = 'tf_pgnb_'; + //page length cookie + this.prfxCookiePageLen = 'tf_pglen_'; + + /*** cookies ***/ + this.hasStoredValues = false; + //remembers filters values on page load + this.rememberGridValues = Boolean(f.remember_grid_values); + //cookie storing filter values + this.fltsValuesCookie = this.prfxCookieFltsValues + this.id; + //remembers page nb on page load + this.rememberPageNb = this.paging && f.remember_page_number; + //cookie storing page nb + this.pgNbCookie = this.prfxCookiePageNb + this.id; + //remembers page length on page load + this.rememberPageLen = this.paging && f.remember_page_length; + //cookie storing page length + this.pgLenCookie = this.prfxCookiePageLen + this.id; + + /*** extensions ***/ + //imports external script + this.extensions = f.extensions; + this.hasExtensions = _types2.default.isArray(this.extensions); + + /*** themes ***/ + this.enableDefaultTheme = Boolean(f.enable_default_theme); + //imports themes + this.hasThemes = this.enableDefaultTheme || _types2.default.isArray(f.themes); + this.themes = f.themes || []; + //themes path + this.themesPath = f.themes_path || this.stylePath + 'themes/'; + + // Features registry + this.Mod = {}; + + // Extensions registry + this.ExtRegistry = {}; + + /*** TF events ***/ + this.Evt = { + // Detect key + + detectKey: function detectKey(e) { + if (!this.enterKey) { + return; + } + if (e) { + var key = _event2.default.keyCode(e); + if (key === 13) { + this.filter(); + _event2.default.cancel(e); + _event2.default.stop(e); + } else { + this.isUserTyping = true; + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + } + }, + + // if auto-filter on, detect user is typing and filter columns + onKeyUp: function onKeyUp(e) { + if (!this.autoFilter) { + return; + } + var key = _event2.default.keyCode(e); + this.isUserTyping = false; + + function filter() { + /*jshint validthis:true */ + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + if (!this.isUserTyping) { + this.filter(); + this.isUserTyping = null; + } + } + + if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) { + if (this.autoFilterTimer === null) { + this.autoFilterTimer = global.setInterval(filter.bind(this), this.autoFilterDelay); + } + } else { + global.clearInterval(this.autoFilterTimer); + this.autoFilterTimer = null; + } + }, + + // if auto-filter on, detect user is typing + onKeyDown: function onKeyDown() { + if (!this.autoFilter) { + return; + } + this.isUserTyping = true; + }, + + // if auto-filter on, clear interval on filter blur + onInpBlur: function onInpBlur() { + if (this.autoFilter) { + this.isUserTyping = false; + global.clearInterval(this.autoFilterTimer); + } + this.emitter.emit('filter-blur', this); + }, + + // set focused text-box filter as active + onInpFocus: function onInpFocus(e) { + var elm = _event2.default.target(e); + this.activeFilterId = elm.getAttribute('id'); + this.activeFlt = _dom2.default.id(this.activeFilterId); + // if(this.popupFilters){ + // Event.cancel(e); + // Event.stop(e); + // } + this.emitter.emit('filter-focus', this); + } + }; + } + + /** + * Initialise features and layout + */ + + _createClass(TableFilter, [{ + key: 'init', + value: function init() { + var _this2 = this; + + if (this._hasGrid) { + return; + } + + var Mod = this.Mod; + var n = this.singleSearchFlt ? 1 : this.nbCells, + inpclass = undefined; + + //loads stylesheet if not imported + this.import(this.stylesheetId, this.stylesheet, null, 'link'); + + //loads theme + if (this.hasThemes) { + this.loadThemes(); + } + + if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { + if (!Mod.store) { + Mod.store = new _store.Store(this); + } + Mod.store.init(); + } + + if (this.gridLayout) { + if (!Mod.gridLayout) { + Mod.gridLayout = new _gridLayout.GridLayout(this); + } + Mod.gridLayout.init(); + } + + if (this.loader) { + if (!Mod.loader) { + Mod.loader = new _loader.Loader(this); + } + Mod.loader.init(); + } + + if (this.highlightKeywords) { + Mod.highlightKeyword = new _highlightKeywords.HighlightKeyword(this); + Mod.highlightKeyword.init(); + } + + if (this.popupFilters) { + if (!Mod.popupFilter) { + Mod.popupFilter = new _popupFilter.PopupFilter(this); + } + Mod.popupFilter.init(); + } + + //filters grid is not generated + if (!this.fltGrid) { + this._initNoFilters(); + } else { + var fltrow = this._insertFiltersRow(); + + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.tbl.rows.length; + + // Generate filters + for (var i = 0; i < n; i++) { + this.emitter.emit('before-filter-init', this, i); + + var fltcell = _dom2.default.create(this.fltCellTag), + col = this.getFilterType(i); + + if (this.singleSearchFlt) { + fltcell.colSpan = this.nbCells; + } + if (!this.gridLayout) { + fltrow.appendChild(fltcell); + } + inpclass = i == n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass; + + //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 (!Mod.dropdown) { + Mod.dropdown = new _dropdown.Dropdown(this); + } + Mod.dropdown.init(i, this.isExternalFlt, fltcell); + } + // checklist + else if (col === this.fltTypeCheckList) { + if (!Mod.checkList) { + Mod.checkList = new _checkList.CheckList(this); + } + Mod.checkList.init(i, this.isExternalFlt, fltcell); + } else { + this._buildInputFilter(i, inpclass, fltcell); + } + + // this adds submit button + if (i == n - 1 && this.displayBtn) { + this._buildSubmitButton(i, fltcell); + } + + this.emitter.emit('after-filter-init', this, i); + } + } //if this.fltGrid + + /* Features */ + if (this.hasVisibleRows) { + this.emitter.on(['after-filtering'], function () { + return _this2.enforceVisibility(); + }); + this.enforceVisibility(); + } + if (this.rowsCounter) { + Mod.rowsCounter = new _rowsCounter.RowsCounter(this); + Mod.rowsCounter.init(); + } + if (this.statusBar) { + Mod.statusBar = new _statusBar.StatusBar(this); + Mod.statusBar.init(); + } + if (this.paging) { + if (!Mod.paging) { + Mod.paging = new _paging.Paging(this); + Mod.paging.init(); + } else { + Mod.paging.reset(); + } + } + if (this.btnReset) { + Mod.clearButton = new _clearButton.ClearButton(this); + Mod.clearButton.init(); + } + if (this.help) { + if (!Mod.help) { + Mod.help = new _help.Help(this); + } + Mod.help.init(); + } + if (this.hasColWidths && !this.gridLayout) { + this.setColWidths(); + } + if (this.alternateRows) { + Mod.alternateRows = new _alternateRows.AlternateRows(this); + Mod.alternateRows.init(); + } + if (this.noResults) { + if (!Mod.noResults) { + Mod.noResults = new _noResults.NoResults(this); + } + Mod.noResults.init(); + } + + this._hasGrid = true; + + if (this.rememberGridValues || this.rememberPageLen || this.rememberPageNb) { + this.resetValues(); + } + + //TF css class is added to table + if (!this.gridLayout) { + _dom2.default.addClass(this.tbl, this.prfxTf); + } + + /* Loads extensions */ + if (this.hasExtensions) { + this.initExtensions(); + } + + // Subscribe to events + if (this.markActiveColumns) { + this.emitter.on(['before-filtering'], function () { + return _this2.clearActiveColumns(); + }); + this.emitter.on(['cell-processed'], function (tf, colIndex) { + return _this2.markActiveColumn(colIndex); + }); + } + if (this.linkedFilters) { + this.emitter.on(['after-filtering'], function () { + return _this2.linkFilters(); + }); + } + + if (this.onFiltersLoaded) { + this.onFiltersLoaded.call(null, this); + } + + this.initialized = true; + this.emitter.emit('initialized', this); + } + + /** + * Insert filters row at initialization + */ + + }, { + key: '_insertFiltersRow', + value: function _insertFiltersRow() { + if (this.gridLayout) { + return; + } + var fltrow = undefined; + + var thead = _dom2.default.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.headersRow++; + } + + fltrow.className = this.fltsRowCssClass; + + if (this.isExternalFlt) { + fltrow.style.display = 'none'; + } + + this.emitter.emit('filters-row-inserted', this, fltrow); + return fltrow; + } + + /** + * Initialize filtersless table + */ + + }, { + key: '_initNoFilters', + value: function _initNoFilters() { + if (this.fltGrid) { + return; + } + this.refRow = this.refRow > 0 ? this.refRow - 1 : 0; + this.nbFilterableRows = this.getRowsNb(); + this.nbVisibleRows = this.nbFilterableRows; + this.nbRows = this.nbFilterableRows + this.refRow; + } + + /** + * Build input filter type + * @param {Number} colIndex Column index + * @param {String} cssClass Css class applied to filter + * @param {DOMElement} container Container DOM element + */ + + }, { + key: '_buildInputFilter', + value: function _buildInputFilter(colIndex, cssClass, container) { + var col = this.getFilterType(colIndex); + var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; + var inptype = col === this.fltTypeInp ? 'text' : 'hidden'; + var inp = _dom2.default.create(this.fltTypeInp, ['id', this.prfxFlt + colIndex + '_' + this.id], ['type', inptype], ['ct', colIndex]); + + if (inptype !== 'hidden' && this.watermark) { + inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[colIndex] || '' : this.watermark); + } + inp.className = cssClass || this.fltCssClass; + _event2.default.add(inp, 'focus', this.Evt.onInpFocus.bind(this)); + + //filter is appended in custom element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(inp); + this.externalFltEls.push(inp); + } else { + container.appendChild(inp); + } + + this.fltIds.push(inp.id); + + _event2.default.add(inp, 'keypress', this.Evt.detectKey.bind(this)); + _event2.default.add(inp, 'keydown', this.Evt.onKeyDown.bind(this)); + _event2.default.add(inp, 'keyup', this.Evt.onKeyUp.bind(this)); + _event2.default.add(inp, 'blur', this.Evt.onInpBlur.bind(this)); + } + + /** + * Build submit button + * @param {Number} colIndex Column index + * @param {DOMElement} container Container DOM element + */ + + }, { + key: '_buildSubmitButton', + value: function _buildSubmitButton(colIndex, container) { + var _this3 = this; + + var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null; + var btn = _dom2.default.create(this.fltTypeInp, ['id', this.prfxValButton + colIndex + '_' + this.id], ['type', 'button'], ['value', this.btnText]); + btn.className = this.btnCssClass; + + //filter is appended in custom element + if (externalFltTgtId) { + _dom2.default.id(externalFltTgtId).appendChild(btn); + } else { + container.appendChild(btn); + } + + _event2.default.add(btn, 'click', function () { + return _this3.filter(); + }); + } + + /** + * Return a feature instance for a given name + * @param {String} name Name of the feature + * @return {Object} + */ + + }, { + key: 'feature', + value: function feature(name) { + return this.Mod[name]; + } + + /** + * Initialise all the extensions defined in the configuration object + */ + + }, { + key: 'initExtensions', + value: function initExtensions() { + var exts = this.extensions; + // Set config's publicPath dynamically for Webpack... + __webpack_require__.p = this.basePath; + + this.emitter.emit('before-loading-extensions', this); + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + if (!this.ExtRegistry[ext.name]) { + this.loadExtension(ext); + } + } + this.emitter.emit('after-loading-extensions', this); + } + + /** + * Load an extension module + * @param {Object} ext Extension config object + */ + + }, { + key: 'loadExtension', + value: function loadExtension(ext) { + var _this4 = this; + + if (!ext || !ext.name) { + return; + } + + var name = ext.name; + var path = ext.path; + var modulePath = undefined; + + if (name && path) { + modulePath = ext.path + name; + } else { + name = name.replace('.js', ''); + modulePath = 'extensions/{}/{}'.replace(/{}/g, name); + } + + // Require pattern for Webpack + __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(26)("./" + modulePath)]; (function (mod) { + var inst = new mod.default(_this4, ext); + inst.init(); + _this4.ExtRegistry[name] = inst; + }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}); + } + + /** + * Get an extension instance + * @param {String} name Name of the extension + * @return {Object} Extension instance + */ + + }, { + key: 'extension', + value: function extension(name) { + return this.ExtRegistry[name]; + } + + /** + * Check passed extension name exists + * @param {String} name Name of the extension + * @return {Boolean} + */ + + }, { + key: 'hasExtension', + value: function hasExtension(name) { + return !_types2.default.isEmpty(this.ExtRegistry[name]); + } + + /** + * Destroy all the extensions defined in the configuration object + */ + + }, { + key: 'destroyExtensions', + value: function destroyExtensions() { + var exts = this.extensions; + + for (var i = 0, len = exts.length; i < len; i++) { + var ext = exts[i]; + var extInstance = this.ExtRegistry[ext.name]; + if (extInstance) { + extInstance.destroy(); + this.ExtRegistry[ext.name] = null; + } + } + } + + /** + * Load themes defined in the configuration object + */ + + }, { + key: 'loadThemes', + value: function loadThemes() { + var themes = this.themes; + this.emitter.emit('before-loading-themes', this); + + //Default theme config + if (this.enableDefaultTheme) { + var defaultTheme = { name: 'default' }; + this.themes.push(defaultTheme); + } + if (_types2.default.isArray(themes)) { + for (var i = 0, len = themes.length; i < len; i++) { + var theme = themes[i]; + var name = theme.name; + var path = theme.path; + var styleId = this.prfxTf + name; + if (name && !path) { + path = this.themesPath + name + '/' + name + '.css'; + } else if (!name && theme.path) { + name = 'theme{0}'.replace('{0}', i); + } + + if (!this.isImported(path, 'link')) { + this.import(styleId, path, null, 'link'); + } + } + } + + //Some elements need to be overriden for default 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; + + this.emitter.emit('after-loading-themes', this); + } + + /** + * Return stylesheet DOM element for a given theme name + * @return {DOMElement} stylesheet element + */ + + }, { + key: 'getStylesheet', + value: function getStylesheet() { + var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0]; + + return _dom2.default.id(this.prfxTf + name); + } + + /** + * Destroy filter grid + */ + + }, { + key: 'destroy', + value: function destroy() { + var _this5 = this; + + if (!this._hasGrid) { + return; + } + var rows = this.tbl.rows, + Mod = this.Mod, + emitter = this.emitter; + + if (this.isExternalFlt && !this.popupFilters) { + this.removeExternalFlts(); + } + if (this.infDiv) { + this.removeToolbar(); + } + // if(this.highlightKeywords){ + // Mod.highlightKeyword.unhighlightAll(); + // } + if (this.markActiveColumns) { + this.clearActiveColumns(); + emitter.off(['before-filtering'], function () { + return _this5.clearActiveColumns(); + }); + emitter.off(['cell-processed'], function (tf, colIndex) { + return _this5.markActiveColumn(colIndex); + }); + } + if (this.hasExtensions) { + this.destroyExtensions(); + } + + // for(let j=this.refRow; j 0) { + [].forEach.call(captions, function (elm) { + tbl.removeChild(elm); + }); + } + } + + /** + * Remove all the external column filters + */ + + }, { + key: 'removeExternalFlts', + value: function removeExternalFlts() { + if (!this.isExternalFlt) { + return; + } + var ids = this.externalFltTgtIds, + len = ids.length; + for (var ct = 0; ct < len; ct++) { + var externalFltTgtId = ids[ct], + externalFlt = _dom2.default.id(externalFltTgtId); + if (externalFlt) { + externalFlt.innerHTML = ''; + } + } + } + + /** + * Check if given column implements a filter with custom options + * @param {Number} colIndex Column's index + * @return {Boolean} + */ + + }, { + key: 'isCustomOptions', + value: function isCustomOptions(colIndex) { + return this.hasCustomOptions && this.customOptions.cols.indexOf(colIndex) != -1; + } + + /** + * Returns an array [[value0, value1 ...],[text0, text1 ...]] with the + * custom options values and texts + * @param {Number} colIndex Column's index + * @return {Array} + */ + + }, { + key: 'getCustomOptions', + value: function getCustomOptions(colIndex) { + if (_types2.default.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) { + return; + } + + var customOptions = this.customOptions; + var cols = customOptions.cols; + var optTxt = [], + optArray = []; + var index = cols.indexOf(colIndex); + var slcValues = customOptions.values[index]; + var slcTexts = customOptions.texts[index]; + var slcSort = customOptions.sorts[index]; + + for (var r = 0, len = slcValues.length; r < len; r++) { + optArray.push(slcValues[r]); + if (slcTexts[r]) { + optTxt.push(slcTexts[r]); + } else { + optTxt.push(slcValues[r]); + } + } + if (slcSort) { + optArray.sort(); + optTxt.sort(); + } + return [optArray, optTxt]; + } + + /** + * Reset persisted filter values + */ + + }, { + key: 'resetValues', + value: function resetValues() { + var _this6 = this; + + if (this.rememberGridValues) { + // if(this.loadFltOnDemand){ + // this._resetGridValues(this.fltsValuesCookie); + // } else { + var fltValues = this.Mod.store.getFilterValues(this.fltsValuesCookie); + fltValues.forEach(function (val, idx) { + if (val !== ' ') { + _this6.setFilterValue(idx, val); + } + }); + // } + } + this.filter(); + } + + /** + * Reset persisted filter values when load filters on demand feature is + * enabled + * @param {String} name cookie name storing filter values + */ + // _resetGridValues(name){ + // if(!this.loadFltOnDemand){ + // return; + // } + // let fltsValues = this.Mod.store.getFilterValues(name), + // slcFltsIndex = this.getFiltersByType(this.fltTypeSlc, true), + // multiFltsIndex = this.getFiltersByType(this.fltTypeMulti, true); + // console.log(fltsValues, Number(fltsValues[(fltsValues.length-1)]), + // this.fltIds.length); + // if the number of columns is the same as before page reload + // if(Number(fltsValues[(fltsValues.length-1)]) === this.fltIds.length){ + // for(let i=0; i<(fltsValues.length - 1); i++){ + // if(fltsValues[i]===' '){ + // continue; + // } + // let s, opt; + // let fltType = this.getFilterType(i); + // // if loadFltOnDemand, drop-down needs to contain stored + // // value(s) for filtering + // if(fltType===this.fltTypeSlc || fltType===this.fltTypeMulti){ + // let slc = Dom.id( this.fltIds[i] ); + // slc.options[0].selected = false; + + // //selects + // if(slcFltsIndex.indexOf(i) != -1){ + // opt = Dom.createOpt(fltsValues[i], fltsValues[i], true); + // slc.appendChild(opt); + // this.hasStoredValues = true; + // } + // //multiple select + // if(multiFltsIndex.indexOf(i) != -1){ + // s = fltsValues[i].split(' '+this.orOperator+' '); + // for(let j=0, len=s.length; j