diff --git a/dist/starter.html b/dist/starter.html
new file mode 100644
index 00000000..a33c2ba4
--- /dev/null
+++ b/dist/starter.html
@@ -0,0 +1,514 @@
+
+
+
+ tablefilter v0.2.37 - Starter
+
+
+tablefilter v0.2.37
+
+
+
+
+
+
+ country |
+ iso |
+ year |
+ POP |
+ XRAT |
+ PPP |
+ cgdp |
+ cc |
+ ci |
+
+
+
+
+ Benin |
+ BEN |
+ 1998 |
+ 5950.33 |
+ 589.9517822 |
+ 190.95 |
+ 1178.46 |
+ 90.98 |
+ 7.55 |
+
+
+ Benin |
+ BEN |
+ 1999 |
+ 6109.53 |
+ 615.6990967 |
+ 200.19 |
+ 1174.90 |
+ 92.61 |
+ 7.86 |
+
+
+ Benin |
+ BEN |
+ 2000 |
+ 6272.00 |
+ 711.9763184 |
+ 200.61 |
+ 1224.74 |
+ 92.27 |
+ 8.25 |
+
+
+ Burkina Faso |
+ BFA |
+ 1994 |
+ 9755.03 |
+ 555.2047119 |
+ 125.76 |
+ 838.76 |
+ 79.81 |
+ 6.57 |
+
+
+ Burkina Faso |
+ BFA |
+ 1995 |
+ 9988.00 |
+ 499.148407 |
+ 136.65 |
+ 860.89 |
+ 80.41 |
+ 9.29 |
+
+
+ Burkina Faso |
+ BFA |
+ 1996 |
+ 10225.00 |
+ 511.5523987 |
+ 144.18 |
+ 881.11 |
+ 80.40 |
+ 12.12 |
+
+
+ Burkina Faso |
+ BFA |
+ 1997 |
+ 10473.53 |
+ 583.6693726 |
+ 141.78 |
+ 899.01 |
+ 76.94 |
+ 14.94 |
+
+
+ Russia |
+ RUS |
+ 1998 |
+ 146899.01 |
+ 9.705082893 |
+ 2.64 |
+ 7086.39 |
+ 67.73 |
+ 9.20 |
+
+
+ Russia |
+ RUS |
+ 1999 |
+ 146308.99 |
+ 24.6199398 |
+ 4.03 |
+ 8074.70 |
+ 57.35 |
+ 8.81 |
+
+
+ Russia |
+ RUS |
+ 2000 |
+ 145555.01 |
+ 28.12916946 |
+ 4.85 |
+ 9995.91 |
+ 54.74 |
+ 8.79 |
+
+
+ Rwanda |
+ RWA |
+ 1994 |
+ 6230.00 |
+ 194.517 |
+ 50.39 |
+ 529.48 |
+ 132.16 |
+ 4.48 |
+
+
+ Rwanda |
+ RWA |
+ 1995 |
+ 6400.00 |
+ 262.1975098 |
+ 70.67 |
+ 746.34 |
+ 92.77 |
+ 3.08 |
+
+
+ Rwanda |
+ RWA |
+ 1996 |
+ 6727.00 |
+ 306.8200073 |
+ 77.90 |
+ 823.25 |
+ 89.71 |
+ 3.21 |
+
+
+ Rwanda |
+ RWA |
+ 1997 |
+ 7895.18 |
+ 301.5297852 |
+ 84.13 |
+ 847.79 |
+ 91.44 |
+ 3.72 |
+
+
+ Rwanda |
+ RWA |
+ 1998 |
+ 8105.00 |
+ 312.3140869 |
+ 85.32 |
+ 914.22 |
+ 89.34 |
+ 4.22 |
+
+
+ El Salvador |
+ SLV |
+ 1995 |
+ 5669.00 |
+ 8.754583359 |
+ 3.54 |
+ 4143.59 |
+ 89.31 |
+ 10.35 |
+
+
+ El Salvador |
+ SLV |
+ 1996 |
+ 5798.00 |
+ 8.755000114 |
+ 3.69 |
+ 4235.79 |
+ 88.77 |
+ 7.79 |
+
+
+ El Salvador |
+ SLV |
+ 1997 |
+ 5911.00 |
+ 8.756250381 |
+ 3.74 |
+ 4408.41 |
+ 87.05 |
+ 7.90 |
+
+
+ Slovak Republic |
+ SVK |
+ 2000 |
+ 5401.00 |
+ 46.0352 |
+ 13.02 |
+ 12618.53 |
+ 52.22 |
+ 24.78 |
+
+
+ Slovenia |
+ SVN |
+ 1994 |
+ 1988.90 |
+ 128.8085938 |
+ 79.97 |
+ 11662.12 |
+ 53.21 |
+ 19.87 |
+
+
+ Slovenia |
+ SVN |
+ 1995 |
+ 1990.00 |
+ 118.5185013 |
+ 89.03 |
+ 12574.96 |
+ 54.46 |
+ 23.11 |
+
+
+ Slovenia |
+ SVN |
+ 1996 |
+ 1991.00 |
+ 135.3643036 |
+ 97.27 |
+ 13151.51 |
+ 54.32 |
+ 23.23 |
+
+
+ Slovenia |
+ SVN |
+ 1997 |
+ 1985.96 |
+ 159.6882935 |
+ 103.96 |
+ 14143.02 |
+ 53.24 |
+ 24.14 |
+
+
+ Slovenia |
+ SVN |
+ 1998 |
+ 1982.60 |
+ 166.134201 |
+ 108.93 |
+ 15067.34 |
+ 52.82 |
+ 25.35 |
+
+
+ Zambia |
+ ZMB |
+ 1994 |
+ 8740.72 |
+ 669.3706055 |
+ 307.48 |
+ 834.19 |
+ 75.43 |
+ 9.86 |
+
+
+ Zambia |
+ ZMB |
+ 1995 |
+ 8980.00 |
+ 864.1192017 |
+ 402.40 |
+ 829.37 |
+ 76.55 |
+ 10.31 |
+
+
+ Zambia |
+ ZMB |
+ 1996 |
+ 9214.40 |
+ 1207.900024 |
+ 515.01 |
+ 838.05 |
+ 78.74 |
+ 10.99 |
+
+
+ Zambia |
+ ZMB |
+ 1997 |
+ 9443.21 |
+ 1314.498047 |
+ 596.97 |
+ 851.47 |
+ 77.59 |
+ 12.15 |
+
+
+ Zambia |
+ ZMB |
+ 1998 |
+ 9665.71 |
+ 1862.06897 |
+ 744.91 |
+ 800.69 |
+ 85.12 |
+ 13.75 |
+
+
+ Zambia |
+ ZMB |
+ 1999 |
+ 9881.21 |
+ 2388.019043 |
+ 941.87 |
+ 765.24 |
+ 91.82 |
+ 15.30 |
+
+
+ Zambia |
+ ZMB |
+ 2000 |
+ 10089.00 |
+ 3110.843994 |
+ 1157.63 |
+ 840.97 |
+ 86.33 |
+ 15.38 |
+
+
+ Zimbabwe |
+ ZWE |
+ 1994 |
+ 10775.35 |
+ 8.151538849 |
+ 2.01 |
+ 2586.84 |
+ 60.10 |
+ 18.53 |
+
+
+ Zimbabwe |
+ ZWE |
+ 1995 |
+ 11011.00 |
+ 8.66537571 |
+ 2.15 |
+ 2603.37 |
+ 66.89 |
+ 15.03 |
+
+
+ Zimbabwe |
+ ZWE |
+ 1996 |
+ 11242.16 |
+ 10.00234985 |
+ 2.64 |
+ 2860.23 |
+ 72.06 |
+ 11.32 |
+
+
+ Zimbabwe |
+ ZWE |
+ 1997 |
+ 11923.52 |
+ 12.11128998 |
+ 3.17 |
+ 2727.06 |
+ 82.82 |
+ 11.01 |
+
+
+ Zimbabwe |
+ ZWE |
+ 1998 |
+ 12153.85 |
+ 23.67910957 |
+ 4.06 |
+ 2799.85 |
+ 77.66 |
+ 10.75 |
+
+
+ Zimbabwe |
+ ZWE |
+ 1999 |
+ 12388.32 |
+ 38.30120087 |
+ 6.12 |
+ 2770.48 |
+ 76.89 |
+ 10.73 |
+
+
+ Zimbabwe |
+ ZWE |
+ 2000 |
+ 12627.00 |
+ 44.41791916 |
+ 9.48 |
+ 2607.03 |
+ 69.23 |
+ 8.62 |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css
index c01b61a0..ae6daae7 100644
--- a/dist/tablefilter/style/colsVisibility.css
+++ b/dist/tablefilter/style/colsVisibility.css
@@ -1,6 +1,6 @@
/**
* tablefilter v0.2.37 by Max Guglielmi
- * build date: 2016-06-13T02:15:15.247Z
+ * build date: 2016-06-13T09:12:36.292Z
* 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 d5916eb6..d36fe946 100644
--- a/dist/tablefilter/style/filtersVisibility.css
+++ b/dist/tablefilter/style/filtersVisibility.css
@@ -1,6 +1,6 @@
/**
* tablefilter v0.2.37 by Max Guglielmi
- * build date: 2016-06-13T02:15:15.247Z
+ * build date: 2016-06-13T09:12:36.292Z
* 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 0493e86a..5ac467b3 100644
--- a/dist/tablefilter/style/tablefilter.css
+++ b/dist/tablefilter/style/tablefilter.css
@@ -1,6 +1,6 @@
/**
* tablefilter v0.2.37 by Max Guglielmi
- * build date: 2016-06-13T02:15:15.247Z
+ * build date: 2016-06-13T09:12:36.292Z
* 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 45e93dae..321e9947 100644
--- a/dist/tablefilter/style/themes/default/default.css
+++ b/dist/tablefilter/style/themes/default/default.css
@@ -1,6 +1,6 @@
/**
* tablefilter v0.2.37 by Max Guglielmi
- * build date: 2016-06-13T02:15:15.247Z
+ * build date: 2016-06-13T09:12:36.292Z
* MIT License
*/
table.TF{border-left:1px solid #ccc;border-top:none;border-right:none;border-bottom:none;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x;border-bottom:1px solid #d0d0d0;border-right:1px solid #d0d0d0;border-left:1px solid #fff;border-top:1px solid #fff;color:#333}table.TF td{border-bottom:1px dotted #999;padding:5px}.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}.activeHeader{background:#999 !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 7756cd97..b9d9f7ab 100644
--- a/dist/tablefilter/style/themes/mytheme/mytheme.css
+++ b/dist/tablefilter/style/themes/mytheme/mytheme.css
@@ -1,6 +1,6 @@
/**
* tablefilter v0.2.37 by Max Guglielmi
- * build date: 2016-06-13T02:15:15.247Z
+ * build date: 2016-06-13T09:12:36.292Z
* MIT License
*/
table.TF{border-left:1px dotted #81963b;border-top:none;border-right:0;border-bottom:none;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x;border-bottom:0;border-right:1px dotted #d0d0d0;border-left:0;border-top:0;color:#fff}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px}.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}.activeHeader{background:#81963b !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 eb954287..7d49cc66 100644
--- a/dist/tablefilter/style/themes/skyblue/skyblue.css
+++ b/dist/tablefilter/style/themes/skyblue/skyblue.css
@@ -1,6 +1,6 @@
/**
* tablefilter v0.2.37 by Max Guglielmi
- * build date: 2016-06-13T02:15:15.247Z
+ * build date: 2016-06-13T09:12:36.292Z
* 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 329bdfa5..8142ec9b 100644
--- a/dist/tablefilter/tablefilter.js
+++ b/dist/tablefilter/tablefilter.js
@@ -1,8412 +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.2.37 by Max Guglielmi
+ * build date: 2016-06-13T09:12:36.277Z
+ * MIT License
+ */
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.TableFilter = undefined;
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
- var _event = __webpack_require__(1);
-
- var _dom = __webpack_require__(3);
-
- var _string = __webpack_require__(5);
-
- var _types = __webpack_require__(4);
-
- var _date = __webpack_require__(6);
-
- var _helpers = __webpack_require__(7);
-
- var _root = __webpack_require__(2);
-
- var _emitter = __webpack_require__(8);
-
- var _gridLayout = __webpack_require__(9);
-
- var _loader = __webpack_require__(12);
-
- var _highlightKeywords = __webpack_require__(13);
-
- var _popupFilter = __webpack_require__(14);
-
- var _dropdown = __webpack_require__(15);
-
- 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);
-
- var _state = __webpack_require__(26);
-
- var _const = __webpack_require__(11);
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- var doc = _root.root.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);
-
- this.id = null;
- this.version = '0.2.37';
- this.year = new Date().getFullYear();
- this.tbl = null;
- this.startRow = null;
- this.refRow = null;
- this.headersRow = null;
- this.cfg = {};
- this.nbFilterableRows = 0;
- this.nbCells = null;
-
- // TODO: use for-of
-
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- args.forEach(function (arg) {
- if ((typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object' && arg.nodeName === 'TABLE') {
- _this.tbl = arg;
- _this.id = arg.id || 'tf_' + new Date().getTime() + '_';
- } else if ((0, _types.isString)(arg)) {
- _this.id = arg;
- _this.tbl = (0, _dom.elm)(arg);
- } else if ((0, _types.isNumber)(arg)) {
- _this.startRow = arg;
- } else if ((0, _types.isObj)(arg)) {
- _this.cfg = arg;
- }
- });
-
- if (!this.tbl || this.tbl.nodeName !== 'TABLE' || this.getRowsNb() === 0) {
- throw new Error('Could not instantiate TableFilter: HTML table\n DOM element not found.');
- }
-
- // configuration object
- var f = this.cfg;
-
- /**
- * Event emitter instance
- * @type {Emitter}
- */
- 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/';
-
- /*** 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 = (0, _types.isString)(f.filters_cell_tag) ? f.filters_cell_tag : _const.CELL_TAG;
-
- //stores filters ids
- this.fltIds = [];
- //stores valid rows indexes (rows visible upon filtering)
- this.validRowsIndex = [];
- //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 = (0, _types.isArray)(f.col_widths);
- this.colWidths = this.hasColWidths ? f.col_widths : [];
- //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 = (0, _types.isFn)(f.on_before_filter) ? f.on_before_filter : null;
- //calls function after filtering
- this.onAfterFilter = (0, _types.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 = (0, _types.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);
- //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 = [];
- //calls function when filters grid loaded
- this.onFiltersLoaded = (0, _types.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 = (0, _types.isFn)(f.on_row_validated) ? f.on_row_validated : null;
- //array defining columns for customCellData event
- this.customCellDataCols = f.custom_cell_data_cols ? f.custom_cell_data_cols : [];
- //calls custom function for retrieving cell data
- this.customCellData = (0, _types.isFn)(f.custom_cell_data) ? f.custom_cell_data : null;
- //input watermark text array
- this.watermark = f.watermark || '';
- this.isWatermarkArray = (0, _types.isArray)(this.watermark);
- //id of toolbar container element
- this.toolBarTgtId = f.toolbar_target_id || null;
- //enables/disables help div
- this.help = (0, _types.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 = (0, _types.isFn)(f.on_before_active_column) ? f.on_before_active_column : null;
- //calls function after active column header is marked
- this.onAfterActiveColumn = (0, _types.isFn)(f.on_after_active_column) ? f.on_after_active_column : null;
-
- /*** select filter's customisation and behaviours ***/
- //defines 1st option text
- this.displayAllText = f.display_all_text || '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 : [];
- //enables/disables descending numeric options sorting
- this.isSortNumDesc = Boolean(f.sort_num_desc);
- this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : [];
- //Select filters are populated on demand
- this.loadFltOnDemand = Boolean(f.load_filters_on_demand);
- this.hasCustomOptions = (0, _types.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 || ',';
-
- //show/hides rows counter
- this.rowsCounter = Boolean(f.rows_counter);
-
- //show/hides status bar
- this.statusBar = Boolean(f.status_bar);
-
- //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 = (0, _types.isFn)(f.on_before_reset) ? f.on_before_reset : null;
- //callback function after filters are cleared
- this.onAfterReset = (0, _types.isFn)(f.on_after_reset) ? f.on_after_reset : null;
-
- /*** paging ***/
- //enables/disables table paging
- this.paging = Boolean(f.paging);
- this.nbHiddenRows = 0; //nb hidden rows
-
- /*** autofilter on typing ***/
- //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 : _const.AUTO_FILTER_DELAY;
- //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 = (0, _types.isObj)(f.no_results_message) || Boolean(f.no_results_message);
-
- // state persisstence
- this.state = (0, _types.isObj)(f.state) || Boolean(f.state);
-
- /*** 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 = (0, _types.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 = (0, _types.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_';
- //responsive table css class
- this.prfxResponsive = 'resp';
-
- /*** extensions ***/
- //imports external script
- this.extensions = f.extensions;
- this.hasExtensions = (0, _types.isArray)(this.extensions);
-
- /*** themes ***/
- this.enableDefaultTheme = Boolean(f.enable_default_theme);
- //imports themes
- this.hasThemes = this.enableDefaultTheme || (0, _types.isArray)(f.themes);
- this.themes = f.themes || [];
- //themes path
- this.themesPath = f.themes_path || this.stylePath + 'themes/';
-
- //responsive table
- this.responsive = Boolean(f.responsive);
-
- // Features registry
- this.Mod = {};
-
- // Extensions registry
- this.ExtRegistry = {};
- }
-
- /**
- * Initialise features and layout
- */
-
-
- TableFilter.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
-
- var Mod = this.Mod;
- var n = this.singleSearchFlt ? 1 : this.nbCells;
- var inpclass = void 0;
-
- //loads stylesheet if not imported
- this.import(this.stylesheetId, this.stylesheet, null, 'link');
-
- //loads theme
- if (this.hasThemes) {
- this.loadThemes();
- }
-
- // Instantiate help feature and initialise only if set true
- if (!Mod.help) {
- Mod.help = new _help.Help(this);
- }
- if (this.help) {
- Mod.help.init();
- }
-
- if (this.state) {
- if (!Mod.state) {
- Mod.state = new _state.State(this);
- }
- Mod.state.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();
-
- // Generate filters
- for (var i = 0; i < n; i++) {
- this.emitter.emit('before-filter-init', this, i);
-
- var fltcell = (0, _dom.createElm)(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 = _const.INPUT;
- inpclass = this.singleFltCssClass;
- }
-
- //drop-down filters
- if (col === _const.SELECT || col === _const.MULTIPLE) {
- if (!Mod.dropdown) {
- Mod.dropdown = new _dropdown.Dropdown(this);
- }
- Mod.dropdown.init(i, this.isExternalFlt, fltcell);
- }
- // checklist
- else if (col === _const.CHECKLIST) {
- 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);
- }
-
- this.emitter.on(['filter-focus'], function (tf, filter) {
- return _this2.setActiveFilterId(filter.id);
- });
- } //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.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();
- }
-
- //TF css class is added to table
- if (!this.gridLayout) {
- (0, _dom.addClass)(this.tbl, this.prfxTf);
- if (this.responsive) {
- (0, _dom.addClass)(this.tbl, this.prfxResponsive);
- }
- }
-
- /* 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);
- };
-
- /**
- * Detect key
- * @param {Event} evt
- */
-
-
- TableFilter.prototype.detectKey = function detectKey(evt) {
- if (!this.enterKey) {
- return;
- }
- if (evt) {
- var key = (0, _event.keyCode)(evt);
- if (key === _const.ENTER_KEY) {
- this.filter();
- (0, _event.cancelEvt)(evt);
- (0, _event.stopEvt)(evt);
- } else {
- this.isUserTyping = true;
- _root.root.clearInterval(this.autoFilterTimer);
- this.autoFilterTimer = null;
- }
- }
- };
-
- /**
- * Filter's keyup event: if auto-filter on, detect user is typing and filter
- * columns
- * @param {Event} evt
- */
-
-
- TableFilter.prototype.onKeyUp = function onKeyUp(evt) {
- if (!this.autoFilter) {
- return;
- }
- var key = (0, _event.keyCode)(evt);
- this.isUserTyping = false;
-
- function filter() {
- _root.root.clearInterval(this.autoFilterTimer);
- this.autoFilterTimer = null;
- if (!this.isUserTyping) {
- this.filter();
- this.isUserTyping = null;
- }
- }
-
- if (key !== _const.ENTER_KEY && key !== _const.TAB_KEY && key !== _const.ESC_KEY && key !== _const.UP_ARROW_KEY && key !== _const.DOWN_ARROW_KEY) {
- if (this.autoFilterTimer === null) {
- this.autoFilterTimer = _root.root.setInterval(filter.bind(this), this.autoFilterDelay);
- }
- } else {
- _root.root.clearInterval(this.autoFilterTimer);
- this.autoFilterTimer = null;
- }
- };
-
- /**
- * Filter's keydown event: if auto-filter on, detect user is typing
- */
-
-
- TableFilter.prototype.onKeyDown = function onKeyDown() {
- if (this.autoFilter) {
- this.isUserTyping = true;
- }
- };
-
- /**
- * Filter's focus event
- * @param {Event} evt
- */
-
-
- TableFilter.prototype.onInpFocus = function onInpFocus(evt) {
- var elm = (0, _event.targetEvt)(evt);
- this.emitter.emit('filter-focus', this, elm);
- };
-
- /**
- * Filter's blur event: if auto-filter on, clear interval on filter blur
- */
-
-
- TableFilter.prototype.onInpBlur = function onInpBlur() {
- if (this.autoFilter) {
- this.isUserTyping = false;
- _root.root.clearInterval(this.autoFilterTimer);
- }
- this.emitter.emit('filter-blur', this);
- };
-
- /**
- * Insert filters row at initialization
- */
-
-
- TableFilter.prototype._insertFiltersRow = function _insertFiltersRow() {
- if (this.gridLayout) {
- return;
- }
- var fltrow = void 0;
-
- var thead = (0, _dom.tag)(this.tbl, 'thead');
- if (thead.length > 0) {
- fltrow = thead[0].insertRow(this.filtersRowIndex);
- } else {
- fltrow = this.tbl.insertRow(this.filtersRowIndex);
- }
-
- fltrow.className = this.fltsRowCssClass;
-
- if (this.isExternalFlt) {
- fltrow.style.display = _const.NONE;
- }
-
- this.emitter.emit('filters-row-inserted', this, fltrow);
- return fltrow;
- };
-
- /**
- * Initialize filtersless table
- */
-
-
- TableFilter.prototype._initNoFilters = function _initNoFilters() {
- if (this.fltGrid) {
- return;
- }
- this.refRow = this.refRow > 0 ? this.refRow - 1 : 0;
- this.nbFilterableRows = this.getRowsNb();
- };
-
- /**
- * Build input filter type
- * @param {Number} colIndex Column index
- * @param {String} cssClass Css class applied to filter
- * @param {DOMElement} container Container DOM element
- */
-
-
- TableFilter.prototype._buildInputFilter = function _buildInputFilter(colIndex, cssClass, container) {
- var _this3 = this;
-
- var col = this.getFilterType(colIndex);
- var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null;
- var inptype = col === _const.INPUT ? 'text' : 'hidden';
- var inp = (0, _dom.createElm)(_const.INPUT, ['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;
- (0, _event.addEvt)(inp, 'focus', function (evt) {
- return _this3.onInpFocus(evt);
- });
-
- //filter is appended in custom element
- if (externalFltTgtId) {
- (0, _dom.elm)(externalFltTgtId).appendChild(inp);
- this.externalFltEls.push(inp);
- } else {
- container.appendChild(inp);
- }
-
- this.fltIds.push(inp.id);
-
- (0, _event.addEvt)(inp, 'keypress', function (evt) {
- return _this3.detectKey(evt);
- });
- (0, _event.addEvt)(inp, 'keydown', function () {
- return _this3.onKeyDown();
- });
- (0, _event.addEvt)(inp, 'keyup', function (evt) {
- return _this3.onKeyUp(evt);
- });
- (0, _event.addEvt)(inp, 'blur', function () {
- return _this3.onInpBlur();
- });
- };
-
- /**
- * Build submit button
- * @param {Number} colIndex Column index
- * @param {DOMElement} container Container DOM element
- */
-
-
- TableFilter.prototype._buildSubmitButton = function _buildSubmitButton(colIndex, container) {
- var _this4 = this;
-
- var externalFltTgtId = this.isExternalFlt ? this.externalFltTgtIds[colIndex] : null;
- var btn = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxValButton + colIndex + '_' + this.id], ['type', 'button'], ['value', this.btnText]);
- btn.className = this.btnCssClass;
-
- //filter is appended in custom element
- if (externalFltTgtId) {
- (0, _dom.elm)(externalFltTgtId).appendChild(btn);
- } else {
- container.appendChild(btn);
- }
-
- (0, _event.addEvt)(btn, 'click', function () {
- return _this4.filter();
- });
- };
-
- /**
- * Return a feature instance for a given name
- * @param {String} name Name of the feature
- * @return {Object}
- */
-
-
- TableFilter.prototype.feature = function feature(name) {
- return this.Mod[name];
- };
-
- /**
- * Initialise all the extensions defined in the configuration object
- */
-
-
- TableFilter.prototype.initExtensions = 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
- */
-
-
- TableFilter.prototype.loadExtension = function loadExtension(ext) {
- var _this5 = this;
-
- if (!ext || !ext.name) {
- return;
- }
-
- var name = ext.name;
- var path = ext.path;
- var modulePath = void 0;
-
- 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__(30)("./" + modulePath)]; (function (mod) {
- /* eslint-disable */
- var inst = new mod.default(_this5, ext);
- /* eslint-enable */
- inst.init();
- _this5.ExtRegistry[name] = inst;
- }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});
- };
-
- /**
- * Get an extension instance
- * @param {String} name Name of the extension
- * @return {Object} Extension instance
- */
-
-
- TableFilter.prototype.extension = function extension(name) {
- return this.ExtRegistry[name];
- };
-
- /**
- * Check passed extension name exists
- * @param {String} name Name of the extension
- * @return {Boolean}
- */
-
-
- TableFilter.prototype.hasExtension = function hasExtension(name) {
- return !(0, _types.isEmpty)(this.ExtRegistry[name]);
- };
-
- /**
- * Destroy all the extensions defined in the configuration object
- */
-
-
- TableFilter.prototype.destroyExtensions = 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] = undefined;
- }
- }
- };
-
- /**
- * Load themes defined in the configuration object
- */
-
-
- TableFilter.prototype.loadThemes = 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 ((0, _types.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
- */
-
-
- TableFilter.prototype.getStylesheet = function getStylesheet() {
- var name = arguments.length <= 0 || arguments[0] === undefined ? 'default' : arguments[0];
-
- return (0, _dom.elm)(this.prfxTf + name);
- };
-
- /**
- * Destroy filter grid
- */
-
-
- TableFilter.prototype.destroy = function destroy() {
- var _this6 = this;
-
- if (!this.initialized) {
- return;
- }
-
- var Mod = this.Mod;
- var emitter = this.emitter;
-
- if (this.isExternalFlt && !this.popupFilters) {
- this.removeExternalFlts();
- }
- if (this.infDiv) {
- this.removeToolbar();
- }
- if (this.markActiveColumns) {
- this.clearActiveColumns();
- emitter.off(['before-filtering'], function () {
- return _this6.clearActiveColumns();
- });
- emitter.off(['cell-processed'], function (tf, colIndex) {
- return _this6.markActiveColumn(colIndex);
- });
- }
- if (this.hasExtensions) {
- this.destroyExtensions();
- }
-
- this.validateAllRows();
-
- if (this.fltGrid && !this.gridLayout) {
- this.tbl.deleteRow(this.filtersRowIndex);
- }
-
- // broadcast destroy event
- emitter.emit('destroy', this);
-
- // Destroy modules
- // TODO: subcribe modules to destroy event instead
- Object.keys(Mod).forEach(function (key) {
- var feature = Mod[key];
- if (feature && (0, _types.isFn)(feature.destroy)) {
- feature.destroy();
- }
- });
-
- // unsubscribe to events
- if (this.hasVisibleRows) {
- emitter.off(['after-filtering'], function () {
- return _this6.enforceVisibility();
- });
- }
- if (this.linkedFilters) {
- emitter.off(['after-filtering'], function () {
- return _this6.linkFilters();
- });
- }
- this.emitter.off(['filter-focus'], function (tf, filter) {
- return _this6.setActiveFilterId(filter.id);
- });
-
- (0, _dom.removeClass)(this.tbl, this.prfxTf);
- (0, _dom.removeClass)(this.tbl, this.prfxResponsive);
-
- this.nbHiddenRows = 0;
- this.validRowsIndex = [];
- this.fltIds = [];
- this.initialized = false;
- };
-
- /**
- * Generate container element for paging, reset button, rows counter etc.
- */
-
-
- TableFilter.prototype.setToolbar = function setToolbar() {
- if (this.infDiv) {
- return;
- }
-
- /*** container div ***/
- var infdiv = (0, _dom.createElm)('div', ['id', this.prfxInfDiv + this.id]);
- infdiv.className = this.infDivCssClass;
-
- //custom container
- if (this.toolBarTgtId) {
- (0, _dom.elm)(this.toolBarTgtId).appendChild(infdiv);
- }
- //grid-layout
- else if (this.gridLayout) {
- var gridLayout = this.Mod.gridLayout;
- gridLayout.tblMainCont.appendChild(infdiv);
- infdiv.className = gridLayout.infDivCssClass;
- }
- //default location: just above the table
- else {
- var cont = (0, _dom.createElm)('caption');
- cont.appendChild(infdiv);
- this.tbl.insertBefore(cont, this.tbl.firstChild);
- }
- this.infDiv = (0, _dom.elm)(this.prfxInfDiv + this.id);
-
- /*** left div containing rows # displayer ***/
- var ldiv = (0, _dom.createElm)('div', ['id', this.prfxLDiv + this.id]);
- ldiv.className = this.lDivCssClass;
- infdiv.appendChild(ldiv);
- this.lDiv = (0, _dom.elm)(this.prfxLDiv + this.id);
-
- /*** right div containing reset button
- + nb results per page select ***/
- var rdiv = (0, _dom.createElm)('div', ['id', this.prfxRDiv + this.id]);
- rdiv.className = this.rDivCssClass;
- infdiv.appendChild(rdiv);
- this.rDiv = (0, _dom.elm)(this.prfxRDiv + this.id);
-
- /*** mid div containing paging elements ***/
- var mdiv = (0, _dom.createElm)('div', ['id', this.prfxMDiv + this.id]);
- mdiv.className = this.mDivCssClass;
- infdiv.appendChild(mdiv);
- this.mDiv = (0, _dom.elm)(this.prfxMDiv + this.id);
-
- // emit help initialisation only if undefined
- if ((0, _types.isUndef)(this.help)) {
- // explicitily set enabled field to true to initialise help by
- // default, only if setting is undefined
- this.Mod.help.enabled = true;
- this.emitter.emit('init-help', this);
- }
- };
-
- /**
- * Remove toolbar container element
- */
-
-
- TableFilter.prototype.removeToolbar = function removeToolbar() {
- if (!this.infDiv) {
- return;
- }
- (0, _dom.removeElm)(this.infDiv);
- this.infDiv = null;
-
- var tbl = this.tbl;
- var captions = (0, _dom.tag)(tbl, 'caption');
- if (captions.length > 0) {
- [].forEach.call(captions, function (elm) {
- return tbl.removeChild(elm);
- });
- }
- };
-
- /**
- * Remove all the external column filters
- */
-
-
- TableFilter.prototype.removeExternalFlts = 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 = (0, _dom.elm)(externalFltTgtId);
- if (externalFlt) {
- externalFlt.innerHTML = '';
- }
- }
- };
-
- /**
- * Check if given column implements a filter with custom options
- * @param {Number} colIndex Column's index
- * @return {Boolean}
- */
-
-
- TableFilter.prototype.isCustomOptions = 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}
- */
-
-
- TableFilter.prototype.getCustomOptions = function getCustomOptions(colIndex) {
- if ((0, _types.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];
- };
-
- /**
- * 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.
- */
-
-
- TableFilter.prototype.filter = function filter() {
- if (!this.fltGrid || !this.initialized) {
- return;
- }
- //invoke onbefore callback
- if (this.onBeforeFilter) {
- this.onBeforeFilter.call(null, this);
- }
- this.emitter.emit('before-filtering', this);
-
- var row = this.tbl.rows,
- nbRows = this.getRowsNb(true),
- hiddenRows = 0;
-
- this.validRowsIndex = [];
- // search args re-init
- var searchArgs = this.getFiltersValue();
-
- var numCellData = void 0;
- var nbFormat = void 0;
- 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((0, _string.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((0, _string.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 = (0, _dom.getText)(cell);
- }
- if (w !== '') {
- this.emitter.emit('highlight-keyword', this, cell, w);
- }
- }
- }
-
- //looks for search argument in current row
- function hasArg(sA, cellData, j) {
- sA = (0, _string.matchCase)(sA, this.caseSensitive);
-
- var occurence = void 0;
- var dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType;
-
- //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 && (0, _date.isValidDate)(sA.replace(re_l, ''), dtType);
- var isLEDate = hasLE && (0, _date.isValidDate)(sA.replace(re_le, ''), dtType);
- var isGDate = hasGR && (0, _date.isValidDate)(sA.replace(re_g, ''), dtType);
- var isGEDate = hasGE && (0, _date.isValidDate)(sA.replace(re_ge, ''), dtType);
- var isDFDate = hasDF && (0, _date.isValidDate)(sA.replace(re_d, ''), dtType);
- var isEQDate = hasEQ && (0, _date.isValidDate)(sA.replace(re_eq, ''), dtType);
-
- var dte1 = void 0,
- dte2 = void 0;
- //dates
- if ((0, _date.isValidDate)(cellData, dtType)) {
- dte1 = (0, _date.formatDate)(cellData, dtType);
- // lower date
- if (isLDate) {
- dte2 = (0, _date.formatDate)(sA.replace(re_l, ''), dtType);
- occurence = dte1 < dte2;
- }
- // lower equal date
- else if (isLEDate) {
- dte2 = (0, _date.formatDate)(sA.replace(re_le, ''), dtType);
- occurence = dte1 <= dte2;
- }
- // greater equal date
- else if (isGEDate) {
- dte2 = (0, _date.formatDate)(sA.replace(re_ge, ''), dtType);
- occurence = dte1 >= dte2;
- }
- // greater date
- else if (isGDate) {
- dte2 = (0, _date.formatDate)(sA.replace(re_g, ''), dtType);
- occurence = dte1 > dte2;
- }
- // different date
- else if (isDFDate) {
- dte2 = (0, _date.formatDate)(sA.replace(re_d, ''), dtType);
- occurence = dte1.toString() !== dte2.toString();
- }
- // equal date
- else if (isEQDate) {
- dte2 = (0, _date.formatDate)(sA.replace(re_eq, ''), dtType);
- occurence = dte1.toString() === dte2.toString();
- }
- // searched keyword with * operator doesn't have to be a date
- else if (re_lk.test(sA)) {
- // like date
- occurence = (0, _string.contains)(sA.replace(re_lk, ''), cellData, false, this.caseSensitive);
- } else if ((0, _date.isValidDate)(sA, dtType)) {
- dte2 = (0, _date.formatDate)(sA, dtType);
- occurence = dte1.toString() === dte2.toString();
- }
- //empty
- else if (hasEM) {
- occurence = (0, _string.isEmpty)(cellData);
- }
- //non-empty
- else if (hasNM) {
- occurence = !(0, _string.isEmpty)(cellData);
- } else {
- occurence = (0, _string.contains)(sA, cellData, this.isExactMatch(j), this.caseSensitive);
- }
- } else {
- //first numbers need to be formated
- if (this.hasColNbFormat && this.colNbFormat[j]) {
- numCellData = (0, _helpers.removeNbFormat)(cellData, this.colNbFormat[j]);
- nbFormat = this.colNbFormat[j];
- } else {
- if (this.thousandsSeparator === ',' && this.decimalSeparator === '.') {
- numCellData = (0, _helpers.removeNbFormat)(cellData, 'us');
- nbFormat = 'us';
- } else {
- numCellData = (0, _helpers.removeNbFormat)(cellData, 'eu');
- nbFormat = 'eu';
- }
- }
-
- // first checks if there is any operator (<,>,<=,>=,!,*,=,{,},
- // rgx:)
- // lower equal
- if (hasLE) {
- occurence = numCellData <= (0, _helpers.removeNbFormat)(sA.replace(re_le, ''), nbFormat);
- }
- //greater equal
- else if (hasGE) {
- occurence = numCellData >= (0, _helpers.removeNbFormat)(sA.replace(re_ge, ''), nbFormat);
- }
- //lower
- else if (hasLO) {
- occurence = numCellData < (0, _helpers.removeNbFormat)(sA.replace(re_l, ''), nbFormat);
- }
- //greater
- else if (hasGR) {
- occurence = numCellData > (0, _helpers.removeNbFormat)(sA.replace(re_g, ''), nbFormat);
- }
- //different
- else if (hasDF) {
- occurence = (0, _string.contains)(sA.replace(re_d, ''), cellData, false, this.caseSensitive) ? false : true;
- }
- //like
- else if (hasLK) {
- occurence = (0, _string.contains)(sA.replace(re_lk, ''), cellData, false, this.caseSensitive);
- }
- //equal
- else if (hasEQ) {
- occurence = (0, _string.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 = (0, _string.isEmpty)(cellData);
- }
- //non-empty
- else if (hasNM) {
- occurence = !(0, _string.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 (ex) {
- occurence = false;
- }
- } else {
- // If numeric type data, perform a strict equality test and
- // fallback to unformatted number string comparison
- if (numCellData && this.hasColNbFormat && this.colNbFormat[j] && !this.singleSearchFlt) {
- sA = (0, _helpers.removeNbFormat)(sA, nbFormat);
- occurence = numCellData === sA || (0, _string.contains)(sA.toString(), numCellData.toString(), this.isExactMatch(j), this.caseSensitive);
- } else {
- // Finally test search term is contained in cell data
- occurence = (0, _string.contains)(sA, cellData, this.isExactMatch(j), this.caseSensitive);
- }
- }
- } //else
- return occurence;
- } //fn
-
- for (var k = this.refRow; k < nbRows; k++) {
- // already filtered rows display re-init
- row[k].style.display = '';
-
- var cells = row[k].cells,
- nchilds = cells.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 = searchArgs[this.singleSearchFlt ? 0 : j];
-
- if (sA === '') {
- continue;
- }
-
- var cellData = (0, _string.matchCase)(this.getCellData(cells[j]), this.caseSensitive);
-
- //multiple search parameter operator ||
- var sAOrSplit = sA.toString().split(this.orOperator),
-
- //multiple search || parameter boolean
- hasMultiOrSA = sAOrSplit.length > 1,
-
- //multiple search parameter operator &&
- sAAndSplit = sA.toString().split(this.anOperator),
-
- //multiple search && parameter boolean
- hasMultiAndSA = sAAndSplit.length > 1;
-
- //detect operators or array query
- if ((0, _types.isArray)(sA) || hasMultiOrSA || hasMultiAndSA) {
- var cS = void 0,
- s = void 0,
- occur = false;
- if ((0, _types.isArray)(sA)) {
- s = sA;
- } else {
- s = hasMultiOrSA ? sAOrSplit : sAAndSplit;
- }
- // TODO: improve clarity/readability of this block
- for (var w = 0, len = s.length; w < len; w++) {
- cS = (0, _string.trim)(s[w]);
- occur = hasArg.call(this, cS, cellData, j);
- highlight.call(this, cS, occur, cells[j]);
- if (hasMultiOrSA && occur || hasMultiAndSA && !occur) {
- break;
- }
- if ((0, _types.isArray)(sA) && occur) {
- break;
- }
- }
- occurence[j] = occur;
- }
- //single search parameter
- else {
- occurence[j] = hasArg.call(this, (0, _string.trim)(sA), cellData, j);
- highlight.call(this, sA, occurence[j], cells[j]);
- } //else single param
-
- if (!occurence[j]) {
- isRowValid = false;
- }
- if (this.singleSearchFlt && occurence[j]) {
- singleFltRowValid = true;
- }
-
- this.emitter.emit('cell-processed', this, j, cells[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.nbHiddenRows = hiddenRows;
-
- //invokes onafterfilter callback
- if (this.onAfterFilter) {
- this.onAfterFilter.call(null, this);
- }
-
- this.emitter.emit('after-filtering', this, searchArgs);
- };
-
- /**
- * Return the data of a specified column
- * @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
- */
-
-
- TableFilter.prototype.getColValues = 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;
- var nbRows = this.getRowsNb(true);
- var colValues = [];
-
- if (includeHeaders) {
- colValues.push(this.getHeadersText()[colIndex]);
- }
-
- for (var i = this.refRow; i < 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] : undefined,
- data = num ? (0, _helpers.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
- */
-
-
- TableFilter.prototype.getFilterValue = function getFilterValue(index) {
- if (!this.fltGrid) {
- return;
- }
- var fltValue = '';
- var flt = this.getFilterElement(index);
- if (!flt) {
- return fltValue;
- }
-
- var fltColType = this.getFilterType(index);
- if (fltColType !== _const.MULTIPLE && fltColType !== _const.CHECKLIST) {
- fltValue = flt.value;
- }
- //mutiple select
- else if (fltColType === _const.MULTIPLE) {
- fltValue = this.feature('dropdown').getValues(index);
- }
- //checklist
- else if (fltColType === _const.CHECKLIST) {
- fltValue = this.feature('checkList').getValues(index);
- }
- //return an empty string if collection is empty or contains a single
- //empty string
- if ((0, _types.isArray)(fltValue) && fltValue.length === 0 || fltValue.length === 1 && fltValue[0] === '') {
- fltValue = '';
- }
-
- return fltValue;
- };
-
- /**
- * Return the filters' values
- * @return {Array} List of filters' values
- */
-
-
- TableFilter.prototype.getFiltersValue = function getFiltersValue() {
- if (!this.fltGrid) {
- return;
- }
- var searchArgs = [];
- for (var i = 0, len = this.fltIds.length; i < len; i++) {
- var fltValue = this.getFilterValue(i);
- if ((0, _types.isArray)(fltValue)) {
- searchArgs.push(fltValue);
- } else {
- searchArgs.push((0, _string.trim)(fltValue));
- }
- }
- return searchArgs;
- };
-
- /**
- * Return the ID of a specified column's filter
- * @param {Number} index Column's index
- * @return {String} ID of the filter element
- */
-
-
- TableFilter.prototype.getFilterId = 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
- */
-
-
- TableFilter.prototype.getFiltersByType = 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 === type.toLowerCase()) {
- 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}
- */
-
-
- TableFilter.prototype.getFilterElement = function getFilterElement(index) {
- var fltId = this.fltIds[index];
- return (0, _dom.elm)(fltId);
- };
-
- /**
- * Return the number of cells for a given row index
- * @param {Number} rowIndex Index of the row
- * @return {Number} Number of cells
- */
-
-
- TableFilter.prototype.getCellsNb = 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
- */
-
-
- TableFilter.prototype.getRowsNb = function getRowsNb(includeHeaders) {
- var s = (0, _types.isUndef)(this.refRow) ? 0 : this.refRow;
- var 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}
- */
-
-
- TableFilter.prototype.getCellData = 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 (0, _dom.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
- */
-
-
- TableFilter.prototype.getTableData = 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 nbRows = this.getRowsNb(true);
- var tblData = [];
- if (includeHeaders) {
- var headers = this.getHeadersText(excludeHiddenCols);
- tblData.push([this.getHeadersRowIndex(), headers]);
- }
- for (var k = this.refRow; k < 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
- */
-
-
- TableFilter.prototype.getFilteredData = 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
- */
-
-
- TableFilter.prototype.getFilteredDataCol = function getFilteredDataCol(colIndex) {
- var includeHeaders = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
-
- if ((0, _types.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 {HTMLTableRowElement} row DOM element of the row
- * @return {String} Usually 'none' or ''
- */
-
-
- TableFilter.prototype.getRowDisplay = function getRowDisplay(row) {
- 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
- */
-
-
- TableFilter.prototype.validateRow = 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 ? '' : _const.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
- */
-
-
- TableFilter.prototype.validateAllRows = function validateAllRows() {
- if (!this.initialized) {
- 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 or Array} query searcharg Search term
- */
-
-
- TableFilter.prototype.setFilterValue = function setFilterValue(index) {
- var query = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];
-
- if (!this.fltGrid) {
- return;
- }
- var slc = this.getFilterElement(index),
- fltColType = this.getFilterType(index);
-
- if (fltColType !== _const.MULTIPLE && fltColType !== _const.CHECKLIST) {
- if (this.loadFltOnDemand && !this.initialized) {
- this.emitter.emit('build-select-filter', this, index, this.linkedFilters, this.isExternalFlt);
- }
- slc.value = query;
- }
- //multiple selects
- else if (fltColType === _const.MULTIPLE) {
- var values = (0, _types.isArray)(query) ? query : query.split(' ' + this.orOperator + ' ');
-
- if (this.loadFltOnDemand && !this.initialized) {
- this.emitter.emit('build-select-filter', this, index, this.linkedFilters, this.isExternalFlt);
- }
-
- this.emitter.emit('select-options', this, index, values);
- }
- //checklist
- else if (fltColType === _const.CHECKLIST) {
- var _values = [];
- if (this.loadFltOnDemand && !this.initialized) {
- this.emitter.emit('build-checklist-filter', this, index, this.isExternalFlt);
- }
- if ((0, _types.isArray)(query)) {
- _values = query;
- } else {
- query = (0, _string.matchCase)(query, this.caseSensitive);
- _values = query.split(' ' + this.orOperator + ' ');
- }
-
- this.emitter.emit('select-checklist-options', this, index, _values);
- }
- };
-
- /**
- * Set them columns' widths as per configuration
- * @param {Element} tbl DOM element
- */
-
-
- TableFilter.prototype.setColWidths = function setColWidths(tbl) {
- if (!this.hasColWidths) {
- return;
- }
- tbl = tbl || this.tbl;
-
- var nbCols = this.nbCells;
- var colWidths = this.colWidths;
- var colTags = (0, _dom.tag)(tbl, 'col');
- var tblHasColTag = colTags.length > 0;
- var frag = !tblHasColTag ? doc.createDocumentFragment() : null;
- for (var k = 0; k < nbCols; k++) {
- var col = void 0;
- if (tblHasColTag) {
- col = colTags[k];
- } else {
- col = (0, _dom.createElm)('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
- */
-
-
- TableFilter.prototype.enforceVisibility = function enforceVisibility() {
- if (!this.hasVisibleRows) {
- return;
- }
- var nbRows = this.getRowsNb(true);
- for (var i = 0, len = this.visibleRows.length; i < len; i++) {
- var row = this.visibleRows[i];
- //row index cannot be > nrows
- if (row <= nbRows) {
- this.validateRow(row, true);
- }
- }
- };
-
- /**
- * Clear all the filters' values
- */
-
-
- TableFilter.prototype.clearFilters = 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, '');
- }
-
- this.filter();
-
- if (this.onAfterReset) {
- this.onAfterReset.call(null, this);
- }
- this.emitter.emit('after-clearing-filters', this);
- };
-
- /**
- * Clears filtered columns visual indicator (background color)
- */
-
-
- TableFilter.prototype.clearActiveColumns = function clearActiveColumns() {
- for (var i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) {
- (0, _dom.removeClass)(this.getHeaderElement(i), this.activeColumnsCssClass);
- }
- };
-
- /**
- * Mark currently filtered column
- * @param {Number} colIndex Column index
- */
-
-
- TableFilter.prototype.markActiveColumn = function markActiveColumn(colIndex) {
- var header = this.getHeaderElement(colIndex);
- if ((0, _dom.hasClass)(header, this.activeColumnsCssClass)) {
- return;
- }
- if (this.onBeforeActiveColumn) {
- this.onBeforeActiveColumn.call(null, this, colIndex);
- }
- (0, _dom.addClass)(header, this.activeColumnsCssClass);
- if (this.onAfterActiveColumn) {
- this.onAfterActiveColumn.call(null, this, colIndex);
- }
- };
-
- /**
- * Return the ID of the current active filter
- * @returns {String}
- */
-
-
- TableFilter.prototype.getActiveFilterId = function getActiveFilterId() {
- return this.activeFilterId;
- };
-
- /**
- * Set the ID of the current active filter
- * @param {String} filterId Element ID
- */
-
-
- TableFilter.prototype.setActiveFilterId = function setActiveFilterId(filterId) {
- this.activeFilterId = filterId;
- };
-
- /**
- * Return the column index for a given filter ID
- * @param {string} [filterId=''] Filter ID
- * @returns {Number} Column index
- */
-
-
- TableFilter.prototype.getColumnIndexFromFilterId = function getColumnIndexFromFilterId() {
- var filterId = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
-
- var idx = filterId.split('_')[0];
- idx = idx.split(this.prfxFlt)[1];
- return parseInt(idx, 10);
- };
-
- /**
- * Make specified column's filter active
- * @param colIndex Index of a column
- */
-
-
- TableFilter.prototype.activateFilter = function activateFilter(colIndex) {
- if ((0, _types.isUndef)(colIndex)) {
- return;
- }
- this.setActiveFilterId(this.getFilterId(colIndex));
- };
-
- /**
- * Refresh the filters subject to linking ('select', 'multiple',
- * 'checklist' type)
- */
-
-
- TableFilter.prototype.linkFilters = function linkFilters() {
- if (!this.linkedFilters || !this.activeFilterId) {
- return;
- }
- var slcA1 = this.getFiltersByType(_const.SELECT, true),
- slcA2 = this.getFiltersByType(_const.MULTIPLE, true),
- slcA3 = this.getFiltersByType(_const.CHECKLIST, true),
- slcIndex = slcA1.concat(slcA2);
- slcIndex = slcIndex.concat(slcA3);
-
- var activeIdx = this.getColumnIndexFromFilterId(this.activeFilterId);
-
- for (var i = 0, len = slcIndex.length; i < len; i++) {
- var curSlc = (0, _dom.elm)(this.fltIds[slcIndex[i]]);
- var slcSelectedValue = this.getFilterValue(slcIndex[i]);
-
- // Welcome to cyclomatic complexity hell :)
- // TODO: simplify/refactor if statement
- if (activeIdx !== slcIndex[i] || this.paging && slcA1.indexOf(slcIndex[i]) !== -1 && activeIdx === slcIndex[i] || !this.paging && (slcA3.indexOf(slcIndex[i]) !== -1 || slcA2.indexOf(slcIndex[i]) !== -1) || slcSelectedValue === this.displayAllText) {
-
- //1st option needs to be inserted
- if (this.loadFltOnDemand) {
- var opt0 = (0, _dom.createOpt)(this.displayAllText, '');
- curSlc.innerHTML = '';
- curSlc.appendChild(opt0);
- }
-
- if (slcA3.indexOf(slcIndex[i]) !== -1) {
- this.emitter.emit('build-checklist-filter', this, slcIndex[i]);
- } else {
- this.emitter.emit('build-select-filter', this, slcIndex[i], true);
- }
-
- this.setFilterValue(slcIndex[i], slcSelectedValue);
- }
- }
- };
-
- /**
- * Determines if passed filter column implements exact query match
- * @param {Number} colIndex [description]
- * @return {Boolean} [description]
- */
-
-
- TableFilter.prototype.isExactMatch = function isExactMatch(colIndex) {
- var fltType = this.getFilterType(colIndex);
- return this.exactMatchByCol[colIndex] || this.exactMatch || fltType !== _const.INPUT;
- };
-
- /**
- * Check if passed script or stylesheet is already imported
- * @param {String} filePath Ressource path
- * @param {String} type Possible values: 'script' or 'link'
- * @return {Boolean}
- */
-
-
- TableFilter.prototype.isImported = function isImported(filePath) {
- var type = arguments.length <= 1 || arguments[1] === undefined ? 'script' : arguments[1];
-
- var imported = false,
- attr = type === 'script' ? 'src' : 'href',
- files = (0, _dom.tag)(doc, type);
- for (var i = 0, len = files.length; i < len; i++) {
- if ((0, _types.isUndef)(files[i][attr])) {
- 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'
- */
-
-
- TableFilter.prototype.import = function _import(fileId, filePath, callback) {
- var _this7 = this;
-
- var type = arguments.length <= 3 || arguments[3] === undefined ? 'script' : arguments[3];
-
- if (this.isImported(filePath, type)) {
- return;
- }
- var o = this,
- isLoaded = false,
- file = void 0,
- head = (0, _dom.tag)(doc, 'head')[0];
-
- if (type.toLowerCase() === 'link') {
- file = (0, _dom.createElm)('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]);
- } else {
- file = (0, _dom.createElm)('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 && (!_this7.readyState || _this7.readyState === 'loaded' || _this7.readyState === 'complete')) {
- isLoaded = true;
- if (typeof callback === 'function') {
- callback.call(null, o);
- }
- }
- };
- file.onerror = function () {
- throw new Error('TableFilter could not load: ' + filePath);
- };
- head.appendChild(file);
- };
-
- /**
- * Check if table has filters grid
- * @return {Boolean}
- */
-
-
- TableFilter.prototype.isInitialized = function isInitialized() {
- return this.initialized;
- };
-
- /**
- * Get list of filter IDs
- * @return {[type]} [description]
- */
-
-
- TableFilter.prototype.getFiltersId = 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
- */
-
-
- TableFilter.prototype.getValidRows = function getValidRows(reCalc) {
- if (!reCalc) {
- return this.validRowsIndex;
- }
-
- var nbRows = this.getRowsNb(true);
- this.validRowsIndex = [];
- for (var k = this.refRow; k < nbRows; k++) {
- var r = this.tbl.rows[k];
- if (!this.paging) {
- if (this.getRowDisplay(r) !== _const.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}
- */
-
-
- TableFilter.prototype.getFiltersRowIndex = function getFiltersRowIndex() {
- return this.filtersRowIndex;
- };
-
- /**
- * Get the index of the headers row
- * @return {Number}
- */
-
-
- TableFilter.prototype.getHeadersRowIndex = function getHeadersRowIndex() {
- return this.headersRow;
- };
-
- /**
- * Get the row index from where the filtering process start (1st filterable
- * row)
- * @return {Number}
- */
-
-
- TableFilter.prototype.getStartRowIndex = function getStartRowIndex() {
- return this.refRow;
- };
-
- /**
- * Get the index of the last row
- * @return {Number}
- */
-
-
- TableFilter.prototype.getLastRowIndex = function getLastRowIndex() {
- var nbRows = this.getRowsNb(true);
- return nbRows - 1;
- };
-
- /**
- * Get the header DOM element for a given column index
- * @param {Number} colIndex Column index
- * @return {Element}
- */
-
-
- TableFilter.prototype.getHeaderElement = function getHeaderElement(colIndex) {
- var table = this.gridLayout ? this.Mod.gridLayout.headTbl : this.tbl;
- var tHead = (0, _dom.tag)(table, 'thead');
- var headersRow = this.headersRow;
- var header = void 0;
- 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
- */
-
-
- TableFilter.prototype.getHeadersText = 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 = (0, _dom.getFirstTextNode)(header);
- headers.push(headerText);
- }
- return headers;
- };
-
- /**
- * Return the filter type for a specified column
- * @param {Number} colIndex Column's index
- * @return {String}
- */
-
-
- TableFilter.prototype.getFilterType = function getFilterType(colIndex) {
- var colType = this.cfg['col_' + colIndex];
- return !colType ? _const.INPUT : colType.toLowerCase();
- };
-
- /**
- * Get the total number of filterable rows
- * @return {Number}
- */
-
-
- TableFilter.prototype.getFilterableRowsNb = function getFilterableRowsNb() {
- return this.getRowsNb(false);
- };
-
- /**
- * Return the total number of valid rows
- * @param {Boolean} [reCalc=false] Forces calculation of filtered rows
- * @returns {Number}
- */
-
-
- TableFilter.prototype.getValidRowsNb = function getValidRowsNb() {
- var reCalc = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
-
- return this.getValidRows(reCalc).length;
- };
-
- /**
- * Get the configuration object (literal object)
- * @return {Object}
- */
-
-
- TableFilter.prototype.config = function config() {
- return this.cfg;
- };
-
- return TableFilter;
- }();
-
-/***/ },
-/* 1 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.keyCode = exports.targetEvt = exports.cancelEvt = exports.stopEvt = exports.removeEvt = exports.addEvt = undefined;
-
- var _root = __webpack_require__(2);
-
- /**
- * DOM event utilities
- */
-
- /**
- * Add event handler for specified event on passed element
- *
- * @param {DOMElement} obj Element
- * @param {String} type Event type
- * @param {Function} Handler
- * @param {Boolean} capture Specifiy whether the event should be executed in
- * the capturing or in the bubbling phase
- */
- var addEvt = exports.addEvt = function addEvt(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 event handler for specified event on passed element
- *
- * @param {DOMElement} obj Element
- * @param {String} type Event type
- * @param {Function} Handler
- * @param {Boolean} capture Specifiy whether the event should be executed in
- * the capturing or in the bubbling phase
- */
- var removeEvt = exports.removeEvt = function removeEvt(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;
- }
- };
-
- /**
- * Prevents further propagation of the current event in the bubbling phase
- *
- * @param {Event} evt Event on the DOM
- */
- var stopEvt = exports.stopEvt = function stopEvt(evt) {
- if (!evt) {
- evt = _root.root.event;
- }
- if (evt.stopPropagation) {
- evt.stopPropagation();
- } else {
- evt.cancelBubble = true;
- }
- };
-
- /**
- * Cancels the event if it is cancelable, without stopping further
- * propagation of the event.
- *
- * @param {Event} evt Event on the DOM
- */
- var cancelEvt = exports.cancelEvt = function cancelEvt(evt) {
- if (!evt) {
- evt = _root.root.event;
- }
- if (evt.preventDefault) {
- evt.preventDefault();
- } else {
- evt.returnValue = false;
- }
- };
-
- /**
- * Reference to the object that dispatched the event
- *
- * @param {Event} evt Event on the DOM
- * @returns {DOMElement}
- */
- var targetEvt = exports.targetEvt = function targetEvt(evt) {
- if (!evt) {
- evt = _root.root.event;
- }
- return evt.target || evt.srcElement;
- };
-
- /**
- * Returns the Unicode value of pressed key
- *
- * @param {Event} evt Event on the DOM
- * @returns {Number}
- */
- var keyCode = exports.keyCode = function keyCode(evt) {
- return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0;
- };
-
-/***/ },
-/* 2 */
-/***/ function(module, exports) {
-
- /* WEBPACK VAR INJECTION */(function(global) {'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
- /**
- * Export window or global object depending on the environment
- */
- var root = exports.root = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) === 'object' && self.self === self && self || (typeof global === 'undefined' ? 'undefined' : _typeof(global)) === 'object' && global.global === global && global || undefined;
- /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
-
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.tag = exports.elm = exports.createCheckItem = exports.createOpt = exports.removeClass = exports.addClass = exports.hasClass = exports.createText = exports.removeElm = exports.createElm = exports.getFirstTextNode = exports.getText = undefined;
-
- var _root = __webpack_require__(2);
-
- var _types = __webpack_require__(4);
-
- var _string = __webpack_require__(5);
-
- /**
- * DOM utilities
- */
-
- var doc = _root.root.document;
-
- /**
- * Returns text + text of children of given node
- * @param {NodeElement} node
- * @return {String}
- */
- var getText = exports.getText = function getText(node) {
- if ((0, _types.isUndef)(node.textContent)) {
- return (0, _string.trim)(node.innerText);
- }
- return (0, _string.trim)(node.textContent);
- };
-
- /**
- * Returns the first text node contained in the supplied node
- * @param {NodeElement} node node
- * @return {String}
- */
- var getFirstTextNode = exports.getFirstTextNode = function getFirstTextNode(node) {
- for (var i = 0; i < node.childNodes.length; i++) {
- var n = node.childNodes[i];
- if (n.nodeType === 3) {
- return n.data;
- }
- }
- };
-
- /**
- * 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
- */
- var createElm = exports.createElm = function createElm() {
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- var tag = args[0];
- if (!(0, _types.isString)(tag)) {
- return null;
- }
-
- var el = doc.createElement(tag);
- for (var i = 0; i < args.length; i++) {
- var arg = args[i];
-
- if ((0, _types.isArray)(arg) && arg.length === 2) {
- el.setAttribute(arg[0], arg[1]);
- }
- }
-
- return el;
- };
-
- /**
- * Removes passed node from DOM
- * @param {DOMElement} node
- * @return {DOMElement} old node reference
- */
- var removeElm = exports.removeElm = function removeElm(node) {
- return node.parentNode.removeChild(node);
- };
-
- /**
- * Returns a text node with given text
- * @param {String} txt
- * @return {Object}
- */
- var createText = exports.createText = function createText(txt) {
- return doc.createTextNode(txt);
- };
-
- /**
- * Determine whether the passed elements is assigned the given class
- * @param {DOMElement} ele DOM element
- * @param {String} cls CSS class name
- * @returns {Boolean}
- */
- var hasClass = exports.hasClass = function hasClass(ele, cls) {
- if ((0, _types.isUndef)(ele)) {
- return false;
- }
-
- if (supportsClassList()) {
- return ele.classList.contains(cls);
- }
- return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
- };
-
- /**
- * Adds the specified class to the passed element
- * @param {DOMElement} ele DOM element
- * @param {String} cls CSS class name
- */
- var addClass = exports.addClass = function addClass(ele, cls) {
- if ((0, _types.isUndef)(ele)) {
- return;
- }
-
- if (supportsClassList()) {
- ele.classList.add(cls);
- return;
- }
-
- if (ele.className === '') {
- ele.className = cls;
- } else if (!hasClass(ele, cls)) {
- ele.className += ' ' + cls;
- }
- };
-
- /**
- * Removes the specified class to the passed element
- * @param {DOMElement} ele DOM element
- * @param {String} cls CSS class name
- */
- var removeClass = exports.removeClass = function removeClass(ele, cls) {
- if ((0, _types.isUndef)(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
- */
- var createOpt = exports.createOpt = function createOpt(text, value, isSel) {
- var isSelected = isSel ? true : false;
- var opt = isSelected ? createElm('option', ['value', value], ['selected', 'true']) : createElm('option', ['value', value]);
- opt.appendChild(createText(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
- */
- var createCheckItem = exports.createCheckItem = function createCheckItem(chkIndex, chkValue, labelText) {
- var li = createElm('li');
- var label = createElm('label', ['for', chkIndex]);
- var check = createElm('input', ['id', chkIndex], ['name', chkIndex], ['type', 'checkbox'], ['value', chkValue]);
- label.appendChild(check);
- label.appendChild(createText(labelText));
- li.appendChild(label);
- li.label = label;
- li.check = check;
- return li;
- };
-
- /**
- * Returns the element matching the supplied Id
- * @param {String} id Element identifier
- * @return {DOMElement}
- */
- var elm = exports.elm = function elm(id) {
- return doc.getElementById(id);
- };
-
- /**
- * Returns list of element matching the supplied tag name
- * @param {String} tagname Tag name
- * @return {NodeList}
- */
- var tag = exports.tag = function tag(o, tagname) {
- return o.getElementsByTagName(tagname);
- };
-
- // HTML5 classList API
- function supportsClassList() {
- return doc.documentElement.classList;
- }
-
-/***/ },
-/* 4 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- /**
- * Types utilities
- */
-
- var UNDEFINED = void 0;
-
- /**
- * Check passed argument is an object
- * @param {Object} obj
- * @return {Boolean}
- */
- var isObj = exports.isObj = function isObj(obj) {
- return Object.prototype.toString.call(obj) === '[object Object]';
- };
-
- /**
- * Check passed argument is a function
- * @param {Function} obj
- * @return {Boolean}
- */
- var isFn = exports.isFn = function isFn(obj) {
- return Object.prototype.toString.call(obj) === '[object Function]';
- };
-
- /**
- * Check passed argument is an array
- * @param {Array} obj
- * @return {Boolean}
- */
- var isArray = exports.isArray = function isArray(obj) {
- return Object.prototype.toString.call(obj) === '[object Array]';
- };
-
- /**
- * Check passed argument is a string
- * @param {String} obj objue
- * @returns {Boolean}
- */
- var isString = exports.isString = function isString(obj) {
- return Object.prototype.toString.call(obj) === '[object String]';
- };
-
- /**
- * Check passed argument is a number
- * @param {Number} obj
- * @returns {Boolean}
- */
- var isNumber = exports.isNumber = function isNumber(obj) {
- return Object.prototype.toString.call(obj) === '[object Number]';
- };
-
- /**
- * Check passed argument is undefined
- * @param {Any} obj
- * @return {Boolean}
- */
- var isUndef = exports.isUndef = function isUndef(obj) {
- return obj === UNDEFINED;
- };
-
- /**
- * Check passed argument is null
- * @param {Any} obj
- * @return {Boolean}
- */
- var isNull = exports.isNull = function isNull(obj) {
- return obj === null;
- };
-
- /**
- * Check passed argument is empty (undefined, null or empty string)
- * @param {Any} obj
- * @return {Boolean}
- */
- var isEmpty = exports.isEmpty = function isEmpty(obj) {
- return isUndef(obj) || isNull(obj) || obj.length === 0;
- };
-
-/***/ },
-/* 5 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- /**
- * String utilities
- */
-
- /**
- * Removes whitespace from both sides of passed string
- * @param {String} text
- * @return {String}
- */
- var trim = exports.trim = function trim(text) {
- if (text.trim) {
- return text.trim();
- }
- return text.replace(/^\s*|\s*$/g, '');
- };
-
- /**
- * Checks if passed string is empty
- * @param {String} text
- * @return {Boolean}
- */
- var isEmpty = exports.isEmpty = function isEmpty(text) {
- return trim(text) === '';
- };
-
- /**
- * Makes regex safe string by escaping special characters from passed string
- * @param {String} text
- * @return {String} escaped string
- */
- var rgxEsc = exports.rgxEsc = function rgxEsc(text) {
- var chars = /[-\/\\^$*+?.()|[\]{}]/g;
- var escMatch = '\\$&';
- return String(text).replace(chars, escMatch);
- };
-
- /**
- * Returns passed string as lowercase if caseSensitive flag set false. By
- * default it returns the string with no casing changes.
- * @param {String} text
- * @return {String} string
- */
- var matchCase = exports.matchCase = function matchCase(text) {
- var caseSensitive = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
-
- if (!caseSensitive) {
- return text.toLowerCase();
- }
- 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}
- */
- var contains = exports.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 = void 0;
- var modifier = caseSensitive ? 'g' : 'gi';
- if (exactMatch) {
- regexp = new RegExp('(^\\s*)' + rgxEsc(term) + '(\\s*$)', modifier);
- } else {
- regexp = new RegExp(rgxEsc(term), modifier);
- }
- return regexp.test(data);
- };
-
-/***/ },
-/* 6 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- /**
- * Date utilities
- */
-
- /**
- * Verifies passed formatted date string is valid
- * @param {String} dateStr Formatted date string
- * @param {String} format accepted formats: 'DMY', 'MDY', 'YMD', 'DDMMMYYYY'
- * @return {Boolean}
- */
- var isValidDate = exports.isValidDate = function isValidDate(dateStr, format) {
- if (!format) {
- format = 'DMY';
- }
- format = format.toUpperCase();
- if (format.length !== 3) {
- if (format === 'DDMMMYYYY') {
- var d = formatDate(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 = void 0,
- reg2 = void 0;
- // 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 = void 0,
- dd = void 0,
- yy = void 0;
- // 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;
- };
-
- /**
- * Converts formatted date into a Date object
- * @param {String} dateStr Formatted date string
- * @param {String} format accepted formats: 'DMY', 'MDY', 'YMD', 'DDMMMYYYY'
- * @return {Object} date object
- */
- var formatDate = exports.formatDate = function formatDate(dateStr, formatStr) {
- if (!formatStr) {
- formatStr = 'DMY';
- }
- if (!dateStr || dateStr === '') {
- return new Date(1001, 0, 1);
- }
- var oDate = void 0;
- var parts = void 0;
-
- 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':
- /* eslint-disable */
- 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]);
- /* eslint-enable */
- break;
- case 'MDY':
- /* eslint-disable */
- 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]);
- /* eslint-enable */
- break;
- case 'YMD':
- /* eslint-disable */
- 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]);
- /* eslint-enable */
- break;
- default:
- //in case format is not correct
- /* eslint-disable */
- 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]);
- /* eslint-enable */
- break;
- }
- return oDate;
- };
-
- function y2kDate(yr) {
- if (yr === undefined) {
- return 0;
- }
- if (yr.length > 2) {
- return yr;
- }
- var y = void 0;
- //>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 = void 0;
- 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;
- }
-
-/***/ },
-/* 7 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- /**
- * Misc helpers
- */
-
- /**
- * Returns a unformatted number
- * @param {String} Formatted number
- * @param {String} Format type, currently 'us' or 'eu'
- * @return {String} Unformatted number
- */
- var removeNbFormat = exports.removeNbFormat = function removeNbFormat(data) {
- var format = arguments.length <= 1 || arguments[1] === undefined ? 'us' : arguments[1];
-
- if (!data) {
- return;
- }
-
- var n = data;
- if (format.toLowerCase() === 'us') {
- n = +n.replace(/[^\d\.-]/g, '');
- } else {
- n = +n.replace(/[^\d\,-]/g, '').replace(',', '.');
- }
- return n;
- };
-
-/***/ },
-/* 8 */
-/***/ function(module, exports) {
-
- "use strict";
-
- 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 () {
- /**
- * Creates an instance of Emitter.
- */
-
- 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
- */
-
-
- Emitter.prototype.on = 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
- */
-
-
- Emitter.prototype.off = 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
- */
-
-
- Emitter.prototype.emit = 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;
- }();
-
-/***/ },
-/* 9 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.GridLayout = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- var _event = __webpack_require__(1);
-
- var _string = __webpack_require__(5);
-
- var _const = __webpack_require__(11);
-
- 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; }
-
- /**
- * Grid layout, table with fixed headers
- */
-
- var GridLayout = exports.GridLayout = function (_Feature) {
- _inherits(GridLayout, _Feature);
-
- /**
- * Creates an instance of GridLayout
- * @param {Object} tf TableFilter instance
- */
-
- function GridLayout(tf) {
- _classCallCheck(this, GridLayout);
-
- var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'gridLayout'));
-
- var f = _this.config;
-
- //defines grid width
- _this.width = f.grid_width || null;
- //defines grid height
- _this.height = f.grid_height || null;
- //defines css class for main container
- _this.mainContCssClass = f.grid_cont_css_class || 'grd_Cont';
- //defines css class for div containing table
- _this.contCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont';
- //defines css class for div containing headers' table
- _this.headContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont';
- //defines css class for div containing rows counter, paging etc.
- _this.infDivCssClass = f.grid_inf_grid_css_class || 'grd_inf';
- //defines which row contains column headers
- _this.headRowIndex = f.grid_headers_row_index || 0;
- //array of headers row indexes to be placed in header table
- _this.headRows = f.grid_headers_rows || [0];
- //generate filters in table headers
- _this.enableFilters = f.grid_enable_default_filters === false ? false : true;
- _this.noHeaders = Boolean(f.grid_no_headers);
- //default col width
- _this.defaultColWidth = f.grid_default_col_width || '100px';
-
- _this.colElms = [];
-
- //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;
-
- // filters flag at TF level
- tf.fltGrid = _this.enableFilters;
- return _this;
- }
-
- /**
- * Generates a grid with fixed headers
- *
- * TODO: reduce size of init by extracting single purposed methods
- */
-
-
- GridLayout.prototype.init = 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 = (0, _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
- this.setDefaultColWidths();
- // if (!tf.hasColWidths) {
- // tf.colWidths = [];
- // for (let k = 0; k < tf.nbCells; k++) {
- // let colW,
- // cell = tbl.rows[this.headRowIndex].cells[k];
- // if (cell.width !== '') {
- // colW = cell.width;
- // } else if (cell.style.width !== '') {
- // colW = parseInt(cell.style.width, 10);
- // } else {
- // colW = this.defaultColWidth;
- // }
- // tf.colWidths[k] = colW;
- // }
- // tf.hasColWidths = true;
- // }
- // tf.setColWidths();
-
- var tblW = void 0; //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 = (0, _dom.createElm)('div', ['id', this.prfxMainTblCont + tf.id]);
- this.tblMainCont.className = this.mainContCssClass;
- if (this.width) {
- this.tblMainCont.style.width = this.width;
- }
- tbl.parentNode.insertBefore(this.tblMainCont, tbl);
-
- //Table container: div wrapping content table
- this.tblCont = (0, _dom.createElm)('div', ['id', this.prfxTblCont + tf.id]);
- this.tblCont.className = this.contCssClass;
- if (this.width) {
- if (this.width.indexOf('%') !== -1) {
- this.tblCont.style.width = '100%';
- } else {
- this.tblCont.style.width = this.width;
- }
- }
- if (this.height) {
- this.tblCont.style.height = this.height;
- }
- tbl.parentNode.insertBefore(this.tblCont, tbl);
- var t = (0, _dom.removeElm)(tbl);
- this.tblCont.appendChild(t);
-
- //In case table width is expressed in %
- if (tbl.style.width === '') {
- tbl.style.width = ((0, _string.contains)('%', tblW) ? tbl.clientWidth : tblW) + 'px';
- }
-
- var d = (0, _dom.removeElm)(this.tblCont);
- this.tblMainCont.appendChild(d);
-
- //Headers table container: div wrapping headers table
- this.headTblCont = (0, _dom.createElm)('div', ['id', this.prfxHeadTblCont + tf.id]);
- this.headTblCont.className = this.headContCssClass;
- if (this.width) {
- if (this.width.indexOf('%') !== -1) {
- this.headTblCont.style.width = '100%';
- } else {
- this.headTblCont.style.width = this.width;
- }
- }
-
- //Headers table
- this.headTbl = (0, _dom.createElm)('table', ['id', this.prfxHeadTbl + tf.id]);
- var tH = (0, _dom.createElm)('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.headRowIndex];
- 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 = (0, _dom.createElm)('tr');
- if (this.enableFilters && tf.fltGrid) {
- tf.externalFltTgtIds = [];
- for (var j = 0; j < tf.nbCells; j++) {
- var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id;
- var cl = (0, _dom.createElm)(tf.fltCellTag, ['id', fltTdId]);
- filtersRow.appendChild(cl);
- tf.externalFltTgtIds[j] = fltTdId;
- }
- }
-
- //Headers row are moved from content table to headers table
- if (!this.noHeaders) {
- for (var i = 0; i < this.headRows.length; i++) {
- var headRow = tbl.rows[this.headRows[0]];
- tH.appendChild(headRow);
- }
- } else {
- // Handle table with no headers, assuming here headers do not
- // exist
- tH.appendChild((0, _dom.createElm)('tr'));
- }
-
- 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 = (0, _dom.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(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
- (0, _event.addEvt)(this.tblCont, 'scroll', function (evt) {
- var elm = (0, _event.targetEvt)(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 = (0, _dom.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 = (0, _dom.createElm)('col', ['id', tf.id + '_col_' + k]);
- tbl.insertBefore(col, tbl.firstChild);
- col.style.width = tf.colWidths[k];
- this.colElms[k] = col;
- }
- this.tblHasColTag = true;
- };
-
- if (!this.tblHasColTag) {
- createColTags.call(this);
- } else {
- var cols = (0, _dom.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.colElms.push(cols[ii]);
- }
- }
-
- if (tf.popupFilters) {
- filtersRow.style.display = _const.NONE;
- }
-
- if (tbl.clientWidth !== this.headTbl.clientWidth) {
- tbl.style.width = this.headTbl.clientWidth + 'px';
- }
-
- this.initialized = true;
- };
-
- GridLayout.prototype.setDefaultColWidths = function setDefaultColWidths() {
- var tf = this.tf;
- if (tf.hasColWidths) {
- return;
- }
- // tf.colWidths = [];
- for (var k = 0, len = tf.getCellsNb(); k < len; k++) {
- var colW = void 0;
- var cell = tf.tbl.rows[tf.getHeadersRowIndex()].cells[k];
- if (cell.width !== '') {
- colW = cell.width;
- } else if (cell.style.width !== '') {
- colW = parseInt(cell.style.width, 10);
- } else {
- colW = this.defaultColWidth;
- }
- tf.colWidths[k] = colW;
- }
- tf.hasColWidths = true;
- tf.setColWidths();
- };
-
- /**
- * Removes the grid layout
- */
-
-
- GridLayout.prototype.destroy = function destroy() {
- var tf = this.tf;
- var tbl = tf.tbl;
-
- if (!this.initialized) {
- return;
- }
- var t = (0, _dom.removeElm)(tbl);
- this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont);
- (0, _dom.removeElm)(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 = (0, _dom.elm)(tf.id);
-
- this.initialized = false;
- };
-
- return GridLayout;
- }(_feature.Feature);
-
-/***/ },
-/* 10 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- 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;
- }
-
- Feature.prototype.init = function init() {
- throw new Error(NOTIMPLEMENTED);
- };
-
- Feature.prototype.reset = function reset() {
- this.enable();
- this.init();
- };
-
- Feature.prototype.destroy = function destroy() {
- throw new Error(NOTIMPLEMENTED);
- };
-
- Feature.prototype.enable = function enable() {
- this.enabled = true;
- };
-
- Feature.prototype.disable = function disable() {
- this.enabled = false;
- };
-
- Feature.prototype.isEnabled = function isEnabled() {
- return this.enabled;
- };
-
- return Feature;
- }();
-
-/***/ },
-/* 11 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- /**
- * Filter types
- */
-
- /**
- * Input filter type
- * @type {String}
- */
- var INPUT = exports.INPUT = 'input';
- /**
- * Select filter type
- * @type {String}
- */
- var SELECT = exports.SELECT = 'select';
- /**
- * Multiple select filter type
- * @type {String}
- */
- var MULTIPLE = exports.MULTIPLE = 'multiple';
- /**
- * Checklist filter type
- * @type {String}
- */
- var CHECKLIST = exports.CHECKLIST = 'checklist';
- /**
- * None filter type
- * @type {String}
- */
- var NONE = exports.NONE = 'none';
-
- /**
- * Key codes
- */
-
- /**
- * Enter key code
- * @type {Number}
- */
- var ENTER_KEY = exports.ENTER_KEY = 13;
- /**
- * Tab key code
- * @type {Number}
- */
- var TAB_KEY = exports.TAB_KEY = 9;
- /**
- * Escape key code
- * @type {Number}
- */
- var ESC_KEY = exports.ESC_KEY = 27;
- /**
- * Up arrow key code
- * @type {Number}
- */
- var UP_ARROW_KEY = exports.UP_ARROW_KEY = 38;
- /**
- * Down arrow key code
- * @type {Number}
- */
- var DOWN_ARROW_KEY = exports.DOWN_ARROW_KEY = 40;
-
- /**
- * HTML tags
- */
-
- /**
- * Header cell tag
- * @type {String}
- */
- var HEADER_TAG = exports.HEADER_TAG = 'TH';
- /**
- * Cell tag
- * @type {String}
- */
- var CELL_TAG = exports.CELL_TAG = 'TD';
-
- /**
- * Default values
- */
-
- /**
- * Auto filter delay in milliseconds
- * @type {Number}
- */
- var AUTO_FILTER_DELAY = exports.AUTO_FILTER_DELAY = 750;
-
-/***/ },
-/* 12 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Loader = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- var _root = __webpack_require__(2);
-
- var _const = __webpack_require__(11);
-
- 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 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, _Feature.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 = (0, _types.isFn)(f.on_show_loader) ? f.on_show_loader : null;
- //callback function after loader is closed
- _this.onHideLoader = (0, _types.isFn)(f.on_hide_loader) ? f.on_hide_loader : null;
- //loader div
- _this.prfxLoader = 'load_';
- return _this;
- }
-
- Loader.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
-
- var tf = this.tf;
- var emitter = this.emitter;
-
- var containerDiv = (0, _dom.createElm)('div', ['id', this.prfxLoader + tf.id]);
- containerDiv.className = this.loaderCssClass;
-
- var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : (0, _dom.elm)(this.loaderTgtId);
- if (!this.loaderTgtId) {
- targetEl.insertBefore(containerDiv, tf.tbl);
- } else {
- targetEl.appendChild(containerDiv);
- }
- this.loaderDiv = containerDiv;
- if (!this.loaderHtml) {
- this.loaderDiv.appendChild((0, _dom.createText)(this.loaderText));
- } else {
- this.loaderDiv.innerHTML = this.loaderHtml;
- }
-
- this.show(_const.NONE);
-
- // Subscribe to events
- emitter.on(['before-filtering', 'before-populating-filter', 'before-page-change', 'before-clearing-filters', 'before-page-length-change', '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-page-change', 'after-clearing-filters', 'after-page-length-change', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () {
- return _this2.show(_const.NONE);
- });
-
- this.initialized = true;
- };
-
- Loader.prototype.show = function show(p) {
- var _this3 = this;
-
- if (!this.isEnabled()) {
- return;
- }
-
- var displayLoader = function displayLoader() {
- if (!_this3.loaderDiv) {
- return;
- }
- if (_this3.onShowLoader && p !== _const.NONE) {
- _this3.onShowLoader.call(null, _this3);
- }
- _this3.loaderDiv.style.display = p;
- if (_this3.onHideLoader && p === _const.NONE) {
- _this3.onHideLoader.call(null, _this3);
- }
- };
-
- var t = p === _const.NONE ? this.loaderCloseDelay : 1;
- _root.root.setTimeout(displayLoader, t);
- };
-
- Loader.prototype.destroy = function destroy() {
- var _this4 = this;
-
- if (!this.initialized) {
- return;
- }
-
- var emitter = this.emitter;
-
- (0, _dom.removeElm)(this.loaderDiv);
- this.loaderDiv = null;
-
- // Unsubscribe to events
- emitter.off(['before-filtering', 'before-populating-filter', 'before-page-change', 'before-clearing-filters', 'before-page-length-change', '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-page-change', 'after-clearing-filters', 'after-page-length-change', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () {
- return _this4.show(_const.NONE);
- });
-
- this.initialized = false;
- };
-
- return Loader;
- }(_feature.Feature);
-
-/***/ },
-/* 13 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.HighlightKeyword = undefined;
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- 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.tf = tf;
- this.emitter = tf.emitter;
- }
-
- HighlightKeyword.prototype.init = function init() {
- var _this = this;
-
- this.emitter.on(['before-filtering', 'destroy'], function () {
- return _this.unhighlightAll();
- });
- this.emitter.on(['highlight-keyword'], function (tf, cell, word) {
- return _this.highlight(cell, word, _this.highlightCssClass);
- });
- };
-
- /**
- * highlight occurences of searched term in passed node
- * @param {Node} node
- * @param {String} word Searched term
- * @param {String} cssClass Css class name
- *
- * TODO: refactor this method
- */
-
-
- HighlightKeyword.prototype.highlight = 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 = node.nodeValue.toLowerCase();
- var tempWordVal = word.toLowerCase();
- 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 = (0, _dom.createText)(nv.substr(0, ni)),
- docWordVal = nv.substr(ni, word.length),
- after = (0, _dom.createText)(nv.substr(ni + word.length)),
- hiwordtext = (0, _dom.createText)(docWordVal),
- hiword = (0, _dom.createElm)('span');
- hiword.className = cssClass;
- hiword.appendChild(hiwordtext);
- pn.insertBefore(before, node);
- pn.insertBefore(hiword, node);
- pn.insertBefore(after, node);
- pn.removeChild(node);
- }
- }
- }
- };
-
- /**
- * Removes highlight to nodes matching passed string
- * @param {String} word
- * @param {String} cssClass Css class to remove
- */
-
-
- HighlightKeyword.prototype.unhighlight = function unhighlight(word, cssClass) {
- var highlightedNodes = this.tf.tbl.querySelectorAll('.' + cssClass);
- for (var i = 0; i < highlightedNodes.length; i++) {
- var n = highlightedNodes[i];
- var nodeVal = (0, _dom.getText)(n),
- tempNodeVal = nodeVal.toLowerCase(),
- tempWordVal = word.toLowerCase();
-
- if (tempNodeVal.indexOf(tempWordVal) !== -1) {
- n.parentNode.replaceChild((0, _dom.createText)(nodeVal), n);
- }
- }
- };
-
- /**
- * Clear all occurrences of highlighted nodes
- */
-
-
- HighlightKeyword.prototype.unhighlightAll = function unhighlightAll() {
- var _this2 = this;
-
- if (!this.tf.highlightKeywords) {
- return;
- }
- // iterate filters values to unhighlight all values
- this.tf.getFiltersValue().forEach(function (val) {
- if ((0, _types.isArray)(val)) {
- val.forEach(function (item) {
- return _this2.unhighlight(item, _this2.highlightCssClass);
- });
- } else {
- _this2.unhighlight(val, _this2.highlightCssClass);
- }
- });
- };
-
- HighlightKeyword.prototype.destroy = function destroy() {
- var _this3 = this;
-
- this.emitter.off(['before-filtering', 'destroy'], function () {
- return _this3.unhighlightAll();
- });
- this.emitter.off(['highlight-keyword'], function (tf, cell, word) {
- return _this3.highlight(cell, word, _this3.highlightCssClass);
- });
- };
-
- return HighlightKeyword;
- }();
-
-/***/ },
-/* 14 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.PopupFilter = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _types = __webpack_require__(4);
-
- var _dom = __webpack_require__(3);
-
- var _event = __webpack_require__(1);
-
- var _const = __webpack_require__(11);
-
- 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, _Feature.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 || '';
- //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 = (0, _types.isFn)(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null;
- //callback function after popup filtes is opened
- _this.onAfterPopUpOpen = (0, _types.isFn)(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null;
- //callback function before popup filtes is closed
- _this.onBeforePopUpClose = (0, _types.isFn)(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null;
- //callback function after popup filtes is closed
- _this.onAfterPopUpClose = (0, _types.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;
- }
-
- PopupFilter.prototype.onClick = function onClick(evt) {
- var elm = (0, _event.targetEvt)(evt).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';
- }
- (0, _event.cancelEvt)(evt);
- (0, _event.stopEvt)(evt);
- };
-
- /**
- * Initialize DOM elements
- */
-
-
- PopupFilter.prototype.init = 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) === _const.NONE) {
- continue;
- }
- var popUpSpan = (0, _dom.createElm)('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]);
- popUpSpan.innerHTML = this.popUpImgFltHtml;
- var header = tf.getHeaderElement(i);
- header.appendChild(popUpSpan);
- (0, _event.addEvt)(popUpSpan, 'click', function (evt) {
- return _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
- */
-
-
- PopupFilter.prototype.reset = function reset() {
- this.enable();
- this.init();
- this.buildAll();
- };
-
- /**
- * Build all pop-up filters elements
- */
-
-
- PopupFilter.prototype.buildAll = 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
- */
-
-
- PopupFilter.prototype.build = function build(colIndex, div) {
- var tf = this.tf;
- var popUpDiv = !div ? (0, _dom.createElm)('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);
- (0, _event.addEvt)(popUpDiv, 'click', function (evt) {
- return (0, _event.stopEvt)(evt);
- });
- this.popUpFltElms[colIndex] = popUpDiv;
- };
-
- /**
- * Toogle visibility of specified filter
- * @param {Number} colIndex Column index
- */
-
-
- PopupFilter.prototype.toggle = function toggle(colIndex) {
- var tf = this.tf,
- popUpFltElm = this.popUpFltElms[colIndex];
-
- if (popUpFltElm.style.display === _const.NONE || popUpFltElm.style.display === '') {
- if (this.onBeforePopUpOpen) {
- this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex);
- }
- popUpFltElm.style.display = 'block';
- if (tf.getFilterType(colIndex) === _const.INPUT) {
- 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 = _const.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
- */
-
-
- PopupFilter.prototype.closeAll = 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 = _const.NONE;
- }
- }
- };
-
- /**
- * Build all the icons representing the pop-up filters
- */
-
-
- PopupFilter.prototype.buildIcons = 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
- */
-
-
- PopupFilter.prototype.buildIcon = function buildIcon(colIndex, active) {
- if (this.popUpFltImgs[colIndex]) {
- this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt;
- }
- };
-
- /**
- * Remove pop-up filters
- */
-
-
- PopupFilter.prototype.destroy = 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) {
- (0, _dom.removeElm)(popUpFltElm);
- this.popUpFltElmCache[i] = popUpFltElm;
- }
- popUpFltElm = null;
- if (popUpFltSpan) {
- (0, _dom.removeElm)(popUpFltSpan);
- }
- popUpFltSpan = null;
- if (popUpFltImg) {
- (0, _dom.removeElm)(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);
-
-/***/ },
-/* 15 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Dropdown = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _array = __webpack_require__(16);
-
- var _string = __webpack_require__(5);
-
- var _sort = __webpack_require__(17);
-
- var _event = __webpack_require__(1);
-
- var _const = __webpack_require__(11);
-
- 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 SORT_ERROR = 'Filter options for column {0} cannot be sorted in ' + '{1} manner.';
-
- 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, _Feature.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)';
- //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;
- }
-
- Dropdown.prototype.onSlcFocus = function onSlcFocus(e) {
- var elm = (0, _event.targetEvt)(e);
- var tf = this.tf;
- // select is populated when element has focus
- if (tf.loadFltOnDemand && elm.getAttribute('filled') === '0') {
- var ct = elm.getAttribute('ct');
- this.build(ct);
- }
- this.emitter.emit('filter-focus', tf, elm);
- };
-
- Dropdown.prototype.onSlcChange = function onSlcChange() {
- 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
- */
-
-
- Dropdown.prototype.init = 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 = (0, _dom.createElm)(_const.SELECT, ['id', tf.prfxFlt + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']);
-
- if (col === _const.MULTIPLE) {
- slc.multiple = _const.MULTIPLE;
- slc.title = this.multipleSlcTooltip;
- }
- slc.className = col.toLowerCase() === _const.SELECT ? tf.fltCssClass : tf.fltMultiCssClass;
-
- //filter is appended in container element
- if (externalFltTgtId) {
- (0, _dom.elm)(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 = (0, _dom.createOpt)(tf.displayAllText, '');
- slc.appendChild(opt0);
- }
-
- (0, _event.addEvt)(slc, 'change', function () {
- return _this2.onSlcChange();
- });
- (0, _event.addEvt)(slc, 'focus', function (e) {
- return _this2.onSlcFocus(e);
- });
-
- this.emitter.on(['build-select-filter'], function (tf, colIndex, isLinked, isExternal) {
- return _this2.build(colIndex, isLinked, isExternal);
- });
- this.emitter.on(['select-options'], function (tf, colIndex, values) {
- return _this2.selectOptions(colIndex, values);
- });
-
- this.initialized = true;
- };
-
- /**
- * Build drop-down filter UI
- * @param {Number} colIndex Column index
- * @param {Boolean} isLinked Enable linked refresh behaviour
- */
-
-
- Dropdown.prototype.build = function build(colIndex) {
- var isLinked = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
-
- 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];
- var slc = (0, _dom.elm)(slcId);
- var rows = tf.tbl.rows;
- var nbRows = tf.getRowsNb(true);
-
- //custom select test
- this.isCustom = tf.isCustomOptions(colIndex);
-
- //custom selects text
- var activeIdx = void 0;
- var activeFilterId = tf.getActiveFilterId();
- if (isLinked && activeFilterId) {
- activeIdx = tf.getColumnIndexFromFilterId(activeFilterId);
- }
-
- var excludedOpts = null,
- filteredDataCol = null;
- if (isLinked && tf.disableExcludedOptions) {
- excludedOpts = [];
- filteredDataCol = [];
- }
-
- for (var k = tf.refRow; k < 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
- // TODO: simplify hell below
- 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) && (activeIdx === undefined || activeIdx === colIndex || activeIdx !== colIndex && tf.validRowsIndex.indexOf(k) !== -1))) {
- var cellData = tf.getCellData(cell[j]),
-
- //Vary Peter's patch
- cellString = (0, _string.matchCase)(cellData, tf.caseSensitive);
-
- // checks if celldata is already in array
- if (!(0, _array.has)(this.opts, cellString, tf.caseSensitive)) {
- this.opts.push(cellData);
- }
-
- if (isLinked && tf.disableExcludedOptions) {
- var filteredCol = filteredDataCol[j];
- if (!filteredCol) {
- filteredCol = tf.getFilteredDataCol(j);
- }
- if (!(0, _array.has)(filteredCol, cellString, tf.caseSensitive) && !(0, _array.has)(excludedOpts, cellString, tf.caseSensitive)) {
- excludedOpts.push(cellData);
- }
- }
- } //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 (!tf.caseSensitive) {
- this.opts.sort(_sort.ignoreCase);
- if (excludedOpts) {
- excludedOpts.sort(_sort.ignoreCase);
- }
- } else {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- }
- }
-
- //asc sort
- if (tf.sortNumAsc.indexOf(colIndex) !== -1) {
- try {
- this.opts.sort(_sort.numSortAsc);
- if (excludedOpts) {
- excludedOpts.sort(_sort.numSortAsc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(_sort.numSortAsc);
- }
- } catch (e) {
- throw new Error(SORT_ERROR.replace('{0}', colIndex).replace('{1}', 'ascending'));
- } //in case there are alphanumeric values
- }
- //desc sort
- if (tf.sortNumDesc.indexOf(colIndex) !== -1) {
- try {
- this.opts.sort(_sort.numSortDesc);
- if (excludedOpts) {
- excludedOpts.sort(_sort.numSortDesc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(_sort.numSortDesc);
- }
- } catch (e) {
- throw new Error(SORT_ERROR.replace('{0}', colIndex).replace('{1}', 'ascending'));
- } //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
- */
-
-
- Dropdown.prototype.addOptions = function addOptions(colIndex, slc, isLinked, excludedOpts) {
- var tf = this.tf,
- 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 && (0, _array.has)(excludedOpts, (0, _string.matchCase)(val, tf.caseSensitive), tf.caseSensitive)) {
- isDisabled = true;
- }
-
- var opt = void 0;
- //fill select on demand
- if (tf.loadFltOnDemand && slcValue === this.opts[y] && tf.getFilterType(colIndex) === _const.SELECT) {
- opt = (0, _dom.createOpt)(lbl, val, true);
- } else {
- opt = (0, _dom.createOpt)(lbl, val, false);
- }
- if (isDisabled) {
- opt.disabled = true;
- }
- slc.appendChild(opt);
- } // for y
-
- slc.setAttribute('filled', '1');
- };
-
- /**
- * Add drop-down header option
- * @param {Object} slc Select DOM element
- */
-
-
- Dropdown.prototype.addFirstOption = function addFirstOption(slc) {
- var tf = this.tf;
-
- var opt0 = (0, _dom.createOpt)(!this.enableSlcResetFilter ? '' : tf.displayAllText, '');
- if (!this.enableSlcResetFilter) {
- opt0.style.display = _const.NONE;
- }
- slc.appendChild(opt0);
- if (tf.enableEmptyOption) {
- var opt1 = (0, _dom.createOpt)(tf.emptyText, tf.emOperator);
- slc.appendChild(opt1);
- }
- if (tf.enableNonEmptyOption) {
- var opt2 = (0, _dom.createOpt)(tf.nonEmptyText, tf.nmOperator);
- slc.appendChild(opt2);
- }
- return slc;
- };
-
- /**
- * Select filter options programmatically
- * @param {Number} colIndex Column index
- * @param {Array} values Array of option values to select
- */
-
-
- Dropdown.prototype.selectOptions = function selectOptions(colIndex) {
- var values = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
-
- var tf = this.tf;
- if (tf.getFilterType(colIndex) !== _const.MULTIPLE || values.length === 0) {
- return;
- }
- var slc = tf.getFilterElement(colIndex);
- [].forEach.call(slc.options, function (option) {
- // Empty value means clear all selections and first option is the
- // clear all option
- if (values[0] === '' || option.value === '') {
- option.selected = false;
- }
-
- if (option.value !== '' && (0, _array.has)(values, option.value, true)) {
- option.selected = true;
- } //if
- });
- };
-
- /**
- * Get filter values for a given column index
- * @param {Number} colIndex Column index
- * @returns {Array} values Array of selected values
- */
-
-
- Dropdown.prototype.getValues = function getValues(colIndex) {
- var tf = this.tf;
- var slc = tf.getFilterElement(colIndex);
- var values = [];
-
- // IE >= 9 does not support the selectedOptions property :(
- if (slc.selectedOptions) {
- [].forEach.call(slc.selectedOptions, function (option) {
- return values.push(option.value);
- });
- } else {
- [].forEach.call(slc.options, function (option) {
- if (option.selected) {
- values.push(option.value);
- }
- });
- }
-
- return values;
- };
-
- Dropdown.prototype.destroy = function destroy() {
- var _this3 = this;
-
- this.emitter.off(['build-select-filter'], function (colIndex, isLinked, isExternal) {
- return _this3.build(colIndex, isLinked, isExternal);
- });
- this.emitter.off(['select-options'], function (tf, colIndex, values) {
- return _this3.selectOptions(colIndex, values);
- });
- };
-
- return Dropdown;
- }(_feature.Feature);
-
-/***/ },
-/* 16 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.has = undefined;
-
- var _string = __webpack_require__(5);
-
- /**
- * Checks if given item can be found in the passed collection
- * @param {Array} arr collection
- * @param {Any} val item to search
- * @param {Boolean} caseSensitive respects case if true
- * @return {Boolean}
- */
- var has = exports.has = function has(arr, val, caseSensitive) {
- var sCase = Boolean(caseSensitive);
- for (var i = 0, l = arr.length; i < l; i++) {
- if ((0, _string.matchCase)(arr[i].toString(), sCase) === val) {
- return true;
- }
- }
- return false;
- }; /**
- * Array utilities
- */
-
-/***/ },
-/* 17 */
-/***/ function(module, exports) {
-
- "use strict";
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- /**
- * Sorting utilities
- */
-
- /**
- * Case insensitive compare function for passed strings
- * @param {String} First string
- * @param {String} Second string
- * @return {Number} -1 if first string lower than second one
- * 0 if first string same order as second one
- * 1 if first string greater than second one
- */
- var ignoreCase = exports.ignoreCase = function ignoreCase(a, b) {
- var x = a.toLowerCase();
- var y = b.toLowerCase();
- return x < y ? -1 : x > y ? 1 : 0;
- };
-
- /**
- * Sorts passed numbers in a ascending manner
- * @param {Number} First number
- * @param {Number} Second number
- * @param {Number} Negative, zero or positive number
- */
- var numSortAsc = exports.numSortAsc = function numSortAsc(a, b) {
- return a - b;
- };
-
- /**
- * Sorts passed numbers in a descending manner
- * @param {Number} First number
- * @param {Number} Second number
- * @param {Number} Negative, zero or positive number
- */
- var numSortDesc = exports.numSortDesc = function numSortDesc(a, b) {
- return b - a;
- };
-
-/***/ },
-/* 18 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.CheckList = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _array = __webpack_require__(16);
-
- var _string = __webpack_require__(5);
-
- var _sort = __webpack_require__(17);
-
- var _event = __webpack_require__(1);
-
- var _types = __webpack_require__(4);
-
- var _const = __webpack_require__(11);
-
- 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 SORT_ERROR = 'Filter options for column {0} cannot be sorted in ' + '{1} manner.';
-
- /**
- * Checklist filter UI component
- */
-
- var CheckList = exports.CheckList = function (_Feature) {
- _inherits(CheckList, _Feature);
-
- /**
- * Creates an instance of CheckList
- * @param {TableFilter} tf TableFilter instance
- */
-
- function CheckList(tf) {
- _classCallCheck(this, CheckList);
-
- var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'checkList'));
-
- var f = _this.config;
-
- /**
- * List of container DOM elements
- * @type {Array}
- */
- _this.containers = [];
-
- /**
- * Css class for the container of the checklist filter (div)
- * @type {String}
- */
- _this.containerCssClass = f.div_checklist_css_class || 'div_checklist';
-
- /**
- * Css class for the checklist filter element (ul)
- * @type {String}
- */
- _this.filterCssClass = f.checklist_css_class || 'flt_checklist';
-
- /**
- * Css class for the item of a checklist (li)
- * @type {String}
- */
- _this.itemCssClass = f.checklist_item_css_class || 'flt_checklist_item';
-
- /**
- * Css class for a selected item of a checklist (li)
- * @type {String}
- */
- _this.selectedItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item';
-
- /**
- * Text placed in the filter's container when load filter on demand
- * feature is enabled
- * @type {String}
- */
- _this.activateText = f.activate_checklist_text || 'Click to load filter data';
-
- /**
- * Css class for a disabled item of a checklist (li)
- * @type {String}
- */
- _this.disabledItemCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled';
-
- /**
- * Enable the reset filter option as first item
- * @type {Boolean}
- */
- _this.enableResetOption = f.enable_checklist_reset_filter === false ? false : true;
-
- /**
- * Prefix for container element ID
- * @type {String}
- * @private
- */
- _this.prfx = 'chkdiv_';
-
- /**
- * Has custom options
- * @type {Boolean}
- * @private
- */
- _this.isCustom = false;
-
- /**
- * List of options values
- * @type {Array}
- * @private
- */
- _this.opts = [];
-
- /**
- * List of options texts for custom values
- * @type {Array}
- * @private
- */
- _this.optsTxt = [];
-
- /**
- * List of options to be excluded from the checklist filter
- * @type {Array}
- * @private
- */
- _this.excludedOpts = [];
- return _this;
- }
-
- /**
- * Checklist change event handler
- * @param {Event} evt
- */
-
-
- CheckList.prototype.onChange = function onChange(evt) {
- var elm = (0, _event.targetEvt)(evt);
- var tf = this.tf;
- this.emitter.emit('filter-focus', tf, elm);
- tf.filter();
- };
-
- /**
- * Checklist option click event handler
- * @param {Event} evt
- */
-
-
- CheckList.prototype.optionClick = function optionClick(evt) {
- this.setCheckListValues(evt.target);
- this.onChange(evt);
- };
-
- /**
- * Checklist container click event handler for load on demand feature
- * @param {Event} evt
- */
-
-
- CheckList.prototype.onCheckListClick = function onCheckListClick(evt) {
- var _this2 = this;
-
- var elm = (0, _event.targetEvt)(evt);
- if (this.tf.loadFltOnDemand && elm.getAttribute('filled') === '0') {
- var ct = elm.getAttribute('ct');
- var div = this.containers[ct];
- this.build(ct);
- (0, _event.removeEvt)(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
- */
-
-
- CheckList.prototype.init = function init(colIndex, isExternal, container) {
- var _this3 = this;
-
- var tf = this.tf;
- var externalFltTgtId = isExternal ? tf.externalFltTgtIds[colIndex] : null;
-
- var divCont = (0, _dom.createElm)('div', ['id', this.prfx + colIndex + '_' + tf.id], ['ct', colIndex], ['filled', '0']);
- divCont.className = this.containerCssClass;
-
- //filter is appended in desired element
- if (externalFltTgtId) {
- (0, _dom.elm)(externalFltTgtId).appendChild(divCont);
- tf.externalFltEls.push(divCont);
- } else {
- container.appendChild(divCont);
- }
-
- this.containers[colIndex] = divCont;
- tf.fltIds.push(tf.prfxFlt + colIndex + '_' + tf.id);
-
- if (!tf.loadFltOnDemand) {
- this.build(colIndex);
- } else {
- (0, _event.addEvt)(divCont, 'click', function (evt) {
- return _this3.onCheckListClick(evt);
- });
- divCont.appendChild((0, _dom.createText)(this.activateText));
- }
-
- this.emitter.on(['build-checklist-filter'], function (tf, colIndex, isExternal) {
- return _this3.build(colIndex, isExternal);
- });
-
- this.emitter.on(['select-checklist-options'], function (tf, colIndex, values) {
- return _this3.selectOptions(colIndex, values);
- });
-
- this.initialized = true;
- };
-
- /**
- * Build checklist UI
- * @param {Number} colIndex Column index
- */
-
-
- CheckList.prototype.build = function build(colIndex) {
- var _this4 = this;
-
- var tf = this.tf;
- colIndex = parseInt(colIndex, 10);
-
- this.emitter.emit('before-populating-filter', tf, colIndex);
-
- this.opts = [];
- this.optsTxt = [];
-
- var flt = this.containers[colIndex];
- var ul = (0, _dom.createElm)('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]);
- ul.className = this.filterCssClass;
- (0, _event.addEvt)(ul, 'change', function (evt) {
- return _this4.onChange(evt);
- });
-
- var rows = tf.tbl.rows;
- var nbRows = tf.getRowsNb(true);
- var caseSensitive = tf.caseSensitive;
- this.isCustom = tf.isCustomOptions(colIndex);
-
- var activeIdx = void 0;
- var activeFilterId = tf.getActiveFilterId();
- if (tf.linkedFilters && activeFilterId) {
- activeIdx = tf.getColumnIndexFromFilterId(activeFilterId);
- }
-
- var filteredDataCol = [];
- if (tf.linkedFilters && tf.disableExcludedOptions) {
- this.excludedOpts = [];
- }
-
- flt.innerHTML = '';
-
- for (var k = tf.refRow; k < 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 && (!activeIdx || activeIdx === colIndex || activeIdx !== colIndex && tf.validRowsIndex.indexOf(k) !== -1))) {
-
- var cellData = tf.getCellData(cells[j]);
- //Vary Peter's patch
- var cellString = (0, _string.matchCase)(cellData, caseSensitive);
- // checks if celldata is already in array
- if (!(0, _array.has)(this.opts, cellString, caseSensitive)) {
- this.opts.push(cellData);
- }
- var filteredCol = filteredDataCol[j];
- if (tf.linkedFilters && tf.disableExcludedOptions) {
- if (!filteredCol) {
- filteredCol = tf.getFilteredDataCol(j);
- }
- if (!(0, _array.has)(filteredCol, cellString, caseSensitive) && !(0, _array.has)(this.excludedOpts, cellString, caseSensitive)) {
- this.excludedOpts.push(cellData);
- }
- }
- }
- }
- }
-
- //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 (!caseSensitive) {
- this.opts.sort(_sort.ignoreCase);
- if (this.excludedOpts) {
- this.excludedOpts.sort(_sort.ignoreCase);
- }
- } else {
- this.opts.sort();
- if (this.excludedOpts) {
- this.excludedOpts.sort();
- }
- }
- }
- //asc sort
- if (tf.sortNumAsc.indexOf(colIndex) !== -1) {
- try {
- this.opts.sort(_sort.numSortAsc);
- if (this.excludedOpts) {
- this.excludedOpts.sort(_sort.numSortAsc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(_sort.numSortAsc);
- }
- } catch (e) {
- throw new Error(SORT_ERROR.replace('{0}', colIndex).replace('{1}', 'ascending'));
- } //in case there are alphanumeric values
- }
- //desc sort
- if (tf.sortNumDesc.indexOf(colIndex) !== -1) {
- try {
- this.opts.sort(_sort.numSortDesc);
- if (this.excludedOpts) {
- this.excludedOpts.sort(_sort.numSortDesc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(_sort.numSortDesc);
- }
- } catch (e) {
- throw new Error(SORT_ERROR.replace('{0}', colIndex).replace('{1}', 'descending'));
- } //in case there are alphanumeric values
- }
-
- this.addChecks(colIndex, ul);
-
- 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
- */
-
-
- CheckList.prototype.addChecks = 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 = (0, _dom.createCheckItem)(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl);
- li.className = this.itemCssClass;
-
- if (tf.linkedFilters && tf.disableExcludedOptions && (0, _array.has)(this.excludedOpts, (0, _string.matchCase)(val, tf.caseSensitive), tf.caseSensitive)) {
- (0, _dom.addClass)(li, this.disabledItemCssClass);
- li.check.disabled = true;
- li.disabled = true;
- } else {
- (0, _event.addEvt)(li.check, 'click', function (evt) {
- return _this5.optionClick(evt);
- });
- }
- ul.appendChild(li);
-
- if (val === '') {
- //item is hidden
- li.style.display = _const.NONE;
- }
- }
- };
-
- /**
- * Add checklist header option
- * @param {Number} colIndex Column index
- * @param {Object} ul Ul element
- */
-
-
- CheckList.prototype.addTChecks = function addTChecks(colIndex, ul) {
- var _this6 = this;
-
- var tf = this.tf;
- var chkCt = 1;
- var li0 = (0, _dom.createCheckItem)(tf.fltIds[colIndex] + '_0', '', tf.displayAllText);
- li0.className = this.itemCssClass;
- ul.appendChild(li0);
-
- (0, _event.addEvt)(li0.check, 'click', function (evt) {
- return _this6.optionClick(evt);
- });
-
- if (!this.enableResetOption) {
- li0.style.display = _const.NONE;
- }
-
- if (tf.enableEmptyOption) {
- var li1 = (0, _dom.createCheckItem)(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText);
- li1.className = this.itemCssClass;
- ul.appendChild(li1);
- (0, _event.addEvt)(li1.check, 'click', function (evt) {
- return _this6.optionClick(evt);
- });
- chkCt++;
- }
-
- if (tf.enableNonEmptyOption) {
- var li2 = (0, _dom.createCheckItem)(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText);
- li2.className = this.itemCssClass;
- ul.appendChild(li2);
- (0, _event.addEvt)(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
- */
-
-
- CheckList.prototype.setCheckListValues = function setCheckListValues(o) {
- if (!o) {
- return;
- }
-
- var tf = this.tf;
- var chkValue = o.value; //checked item value
- // TODO: provide helper to extract column index, ugly!
- var chkIndex = parseInt(o.id.split('_')[2], 10);
- var colIdx = tf.getColumnIndexFromFilterId(o.id);
- var itemTag = 'LI';
-
- var n = tf.getFilterElement(parseInt(colIdx, 10));
- 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 = (0, _dom.elm)(tf.fltIds[colIndex] + '_' + indSplit[u]);
- if (cChk) {
- cChk.checked = false;
- (0, _dom.removeClass)(n.childNodes[indSplit[u]], this.selectedItemCssClass);
- }
- }
- }
- n.setAttribute('value', '');
- n.setAttribute('indexes', '');
- } else {
- fltValue = fltValue ? fltValue : '';
- chkValue = (0, _string.trim)(fltValue + ' ' + chkValue + ' ' + tf.orOperator);
- chkIndex = fltIndexes + chkIndex + tf.separator;
- n.setAttribute('value', chkValue);
- n.setAttribute('indexes', chkIndex);
- //1st option unchecked
- if ((0, _dom.elm)(tf.fltIds[colIndex] + '_0')) {
- (0, _dom.elm)(tf.fltIds[colIndex] + '_0').checked = false;
- }
- }
-
- if (li.nodeName === itemTag) {
- (0, _dom.removeClass)(n.childNodes[0], this.selectedItemCssClass);
- (0, _dom.addClass)(li, this.selectedItemCssClass);
- }
- } else {
- //removes values and indexes
- if (chkValue !== '') {
- var replaceValue = new RegExp((0, _string.rgxEsc)(chkValue + ' ' + tf.orOperator));
- fltValue = fltValue.replace(replaceValue, '');
- n.setAttribute('value', (0, _string.trim)(fltValue));
-
- var replaceIndex = new RegExp((0, _string.rgxEsc)(chkIndex + tf.separator));
- fltIndexes = fltIndexes.replace(replaceIndex, '');
- n.setAttribute('indexes', fltIndexes);
- }
- if (li.nodeName === itemTag) {
- (0, _dom.removeClass)(li, this.selectedItemCssClass);
- }
- }
- };
-
- /**
- * Select filter options programmatically
- * @param {Number} colIndex Column index
- * @param {Array} values Array of option values to select
- */
-
-
- CheckList.prototype.selectOptions = function selectOptions(colIndex) {
- var values = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
-
- var tf = this.tf;
- var flt = tf.getFilterElement(colIndex);
- if (tf.getFilterType(colIndex) !== _const.CHECKLIST || !flt) {
- return;
- }
-
- var lisNb = (0, _dom.tag)(flt, 'li').length;
-
- flt.setAttribute('value', '');
- flt.setAttribute('indexes', '');
-
- for (var k = 0; k < lisNb; k++) {
- var li = (0, _dom.tag)(flt, 'li')[k];
- var lbl = (0, _dom.tag)(li, 'label')[0];
- var chk = (0, _dom.tag)(li, 'input')[0];
- var lblTxt = (0, _string.matchCase)((0, _dom.getText)(lbl), tf.caseSensitive);
-
- if (lblTxt !== '' && (0, _array.has)(values, lblTxt, tf.caseSensitive)) {
- chk.checked = true;
- } else {
- // Check non-empty-text or empty-text option
- if (values.indexOf(tf.nmOperator) !== -1 && lblTxt === (0, _string.matchCase)(tf.nonEmptyText, tf.caseSensitive)) {
- chk.checked = true;
- } else if (values.indexOf(tf.emOperator) !== -1 && lblTxt === (0, _string.matchCase)(tf.emptyText, tf.caseSensitive)) {
- chk.checked = true;
- } else {
- chk.checked = false;
- }
- }
- this.setCheckListValues(chk);
- }
- };
-
- /**
- * Get filter values for a given column index
- * @param {Number} colIndex Column index
- * @returns {Array} values Collection of selected values
- */
-
-
- CheckList.prototype.getValues = function getValues(colIndex) {
- var tf = this.tf;
- var flt = tf.getFilterElement(colIndex);
- var fltAttr = flt.getAttribute('value');
- var values = (0, _types.isEmpty)(fltAttr) ? '' : fltAttr;
-
- //removes last operator ||
- values = values.substr(0, values.length - 3);
- //turn || separated values into array
- values = values.split(' ' + tf.orOperator + ' ');
-
- return values;
- };
-
- /**
- * Destroy CheckList instance
- */
-
-
- CheckList.prototype.destroy = function destroy() {
- var _this7 = this;
-
- this.emitter.off(['build-checklist-filter'], function (tf, colIndex, isExternal) {
- return _this7.build(colIndex, isExternal);
- });
- this.emitter.off(['select-checklist-options'], function (tf, colIndex, values) {
- return _this7.selectOptions(colIndex, values);
- });
- };
-
- return CheckList;
- }(_feature.Feature);
-
-/***/ },
-/* 19 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.RowsCounter = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- 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, _Feature.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 = (0, _types.isFn)(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null;
- //callback raised after counter is refreshed
- _this.onAfterRefreshCounter = (0, _types.isFn)(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null;
- return _this;
- }
-
- RowsCounter.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
-
- var tf = this.tf;
-
- //rows counter container
- var countDiv = (0, _dom.createElm)('div', ['id', this.prfxCounter + tf.id]);
- countDiv.className = this.totRowsCssClass;
- //rows counter label
- var countSpan = (0, _dom.createElm)('span', ['id', this.prfxTotRows + tf.id]);
- var countText = (0, _dom.createElm)('span', ['id', this.prfxTotRowsTxt + tf.id]);
- countText.appendChild((0, _dom.createText)(this.rowsCounterText));
-
- // counter is added to defined element
- if (!this.rowsCounterTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.rowsCounterTgtId ? tf.lDiv : (0, _dom.elm)(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.getValidRowsNb());
- });
- this.emitter.on(['rows-changed'], function () {
- return _this2.refresh();
- });
-
- this.initialized = true;
- this.refresh();
- };
-
- RowsCounter.prototype.refresh = 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.getFilterableRowsNb() - tf.nbHiddenRows;
- }
- } else {
- var paging = tf.feature('paging');
- if (paging) {
- //paging start row
- var pagingStartRow = parseInt(paging.startPagingRow, 10) + (tf.getValidRowsNb() > 0 ? 1 : 0);
- var pagingEndRow = pagingStartRow + paging.pagingLength - 1 <= tf.getValidRowsNb() ? pagingStartRow + paging.pagingLength - 1 : tf.getValidRowsNb();
- totTxt = pagingStartRow + this.fromToTextSeparator + pagingEndRow + this.overText + tf.getValidRowsNb();
- }
- }
-
- this.rowsCounterSpan.innerHTML = totTxt;
- if (this.onAfterRefreshCounter) {
- this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt);
- }
- };
-
- RowsCounter.prototype.destroy = function destroy() {
- var _this3 = this;
-
- if (!this.initialized) {
- return;
- }
-
- if (!this.rowsCounterTgtId && this.rowsCounterDiv) {
- (0, _dom.removeElm)(this.rowsCounterDiv);
- } else {
- (0, _dom.elm)(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.getValidRowsNb());
- });
- this.emitter.off(['rows-changed'], function () {
- return _this3.refresh();
- });
-
- this.initialized = false;
- };
-
- return RowsCounter;
- }(_feature.Feature);
-
-/***/ },
-/* 20 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.StatusBar = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _root = __webpack_require__(2);
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- 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 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, _Feature.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 = (0, _types.isFn)(f.on_before_show_msg) ? f.on_before_show_msg : null;
- //calls function after message is displayed
- _this.onAfterShowMsg = (0, _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 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;
- }
-
- StatusBar.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
-
- var tf = this.tf;
- var emitter = this.emitter;
-
- //status bar container
- var statusDiv = (0, _dom.createElm)('div', ['id', this.prfxStatus + tf.id]);
- statusDiv.className = this.statusBarCssClass;
-
- //status bar label
- var statusSpan = (0, _dom.createElm)('span', ['id', this.prfxStatusSpan + tf.id]);
- //preceding text
- var statusSpanText = (0, _dom.createElm)('span', ['id', this.prfxStatusTxt + tf.id]);
- statusSpanText.appendChild((0, _dom.createText)(this.statusBarText));
-
- // target element container
- if (!this.statusBarTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.statusBarTgtId ? tf.lDiv : (0, _dom.elm)(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-page-change'], function () {
- return _this2.message(_this2.msgChangePage);
- });
- emitter.on(['before-clearing-filters'], function () {
- return _this2.message(_this2.msgClear);
- });
- emitter.on(['before-page-length-change'], 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-page-change', 'after-clearing-filters', 'after-page-length-change', 'after-reset-page', 'after-reset-page-length', 'after-loading-extensions', 'after-loading-themes'], function () {
- return _this2.message('');
- });
-
- this.initialized = true;
- };
-
- StatusBar.prototype.message = 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;
- _root.root.setTimeout(function () {
- if (!_this3.initialized) {
- return;
- }
- _this3.statusBarSpan.innerHTML = t;
- if (_this3.onAfterShowMsg) {
- _this3.onAfterShowMsg.call(null, _this3.tf, t);
- }
- }, d);
- };
-
- StatusBar.prototype.destroy = function destroy() {
- var _this4 = this;
-
- if (!this.initialized) {
- return;
- }
-
- var emitter = this.emitter;
-
- this.statusBarDiv.innerHTML = '';
- if (!this.statusBarTgtId) {
- (0, _dom.removeElm)(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-page-change'], function () {
- return _this4.message(_this4.msgChangePage);
- });
- emitter.off(['before-clearing-filters'], function () {
- return _this4.message(_this4.msgClear);
- });
- emitter.off(['before-page-length-change'], 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-page-change', 'after-clearing-filters', 'after-page-length-change', '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';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Paging = undefined;
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- var _event = __webpack_require__(1);
-
- var _const = __webpack_require__(11);
-
- 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, _Feature.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 = (0, _types.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 || _const.SELECT;
- //calls function before page is changed
- _this.onBeforeChangePage = (0, _types.isFn)(f.on_before_change_page) ? f.on_before_change_page : null;
- //calls function before page is changed
- _this.onAfterChangePage = (0, _types.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.getRowsNb(true);
- //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 === _const.SELECT ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1;
- },
- nbOpts: function nbOpts() {
- return o.pageSelectorType === _const.SELECT ? 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 = (0, _event.keyCode)(e);
- if (key === _const.ENTER_KEY) {
- 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
- */
-
-
- Paging.prototype.init = 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 === _const.SELECT) {
- slcPages = (0, _dom.createElm)(_const.SELECT, ['id', this.prfxSlcPages + tf.id]);
- slcPages.className = this.pgSlcCssClass;
- (0, _event.addEvt)(slcPages, 'change', evt.slcPagesChange);
- }
-
- // Paging input selector
- if (this.pageSelectorType === _const.INPUT) {
- slcPages = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]);
- slcPages.className = this.pgInpCssClass;
- (0, _event.addEvt)(slcPages, 'keypress', evt._detectKey);
- }
-
- // btns containers
- var btnNextSpan = (0, _dom.createElm)('span', ['id', this.prfxBtnNextSpan + tf.id]);
- var btnPrevSpan = (0, _dom.createElm)('span', ['id', this.prfxBtnPrevSpan + tf.id]);
- var btnLastSpan = (0, _dom.createElm)('span', ['id', this.prfxBtnLastSpan + tf.id]);
- var btnFirstSpan = (0, _dom.createElm)('span', ['id', this.prfxBtnFirstSpan + tf.id]);
-
- if (this.hasPagingBtns) {
- // Next button
- if (!this.btnNextPageHtml) {
- var btn_next = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']);
- btn_next.className = this.btnPageCssClass;
- (0, _event.addEvt)(btn_next, 'click', evt.next);
- btnNextSpan.appendChild(btn_next);
- } else {
- btnNextSpan.innerHTML = this.btnNextPageHtml;
- (0, _event.addEvt)(btnNextSpan, 'click', evt.next);
- }
- // Previous button
- if (!this.btnPrevPageHtml) {
- var btn_prev = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']);
- btn_prev.className = this.btnPageCssClass;
- (0, _event.addEvt)(btn_prev, 'click', evt.prev);
- btnPrevSpan.appendChild(btn_prev);
- } else {
- btnPrevSpan.innerHTML = this.btnPrevPageHtml;
- (0, _event.addEvt)(btnPrevSpan, 'click', evt.prev);
- }
- // Last button
- if (!this.btnLastPageHtml) {
- var btn_last = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']);
- btn_last.className = this.btnPageCssClass;
- (0, _event.addEvt)(btn_last, 'click', evt.last);
- btnLastSpan.appendChild(btn_last);
- } else {
- btnLastSpan.innerHTML = this.btnLastPageHtml;
- (0, _event.addEvt)(btnLastSpan, 'click', evt.last);
- }
- // First button
- if (!this.btnFirstPageHtml) {
- var btn_first = (0, _dom.createElm)(_const.INPUT, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']);
- btn_first.className = this.btnPageCssClass;
- (0, _event.addEvt)(btn_first, 'click', evt.first);
- btnFirstSpan.appendChild(btn_first);
- } else {
- btnFirstSpan.innerHTML = this.btnFirstPageHtml;
- (0, _event.addEvt)(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 : (0, _dom.elm)(this.pagingTgtId);
- targetEl.appendChild(btnFirstSpan);
- targetEl.appendChild(btnPrevSpan);
-
- var pgBeforeSpan = (0, _dom.createElm)('span', ['id', this.prfxPgBeforeSpan + tf.id]);
- pgBeforeSpan.appendChild((0, _dom.createText)(this.pageText));
- pgBeforeSpan.className = this.nbPgSpanCssClass;
- targetEl.appendChild(pgBeforeSpan);
- targetEl.appendChild(slcPages);
- var pgAfterSpan = (0, _dom.createElm)('span', ['id', this.prfxPgAfterSpan + tf.id]);
- pgAfterSpan.appendChild((0, _dom.createText)(this.ofText));
- pgAfterSpan.className = this.nbPgSpanCssClass;
- targetEl.appendChild(pgAfterSpan);
- var pgspan = (0, _dom.createElm)('span', ['id', this.prfxPgSpan + tf.id]);
- pgspan.className = this.nbPgSpanCssClass;
- pgspan.appendChild((0, _dom.createText)(' ' + this.nbPages + ' '));
- targetEl.appendChild(pgspan);
- targetEl.appendChild(btnNextSpan);
- targetEl.appendChild(btnLastSpan);
- this.pagingSlc = (0, _dom.elm)(this.prfxSlcPages + tf.id);
-
- this.setPagingInfo();
-
- if (!tf.fltGrid) {
- tf.validateAllRows();
- this.setPagingInfo(tf.validRowsIndex);
- }
-
- this.emitter.on(['after-filtering'], function () {
- return _this2.resetPagingInfo();
- });
- this.emitter.on(['change-page'], function (tf, pageNumber) {
- return _this2.setPage(pageNumber);
- });
- this.emitter.on(['change-page-results'], function (tf, pageLength) {
- return _this2.changeResultsPerPage(pageLength);
- });
-
- this.initialized = true;
- };
-
- /**
- * Reset paging when filters are already instantiated
- * @param {Boolean} filterTable Execute filtering once paging instanciated
- */
-
-
- Paging.prototype.reset = function reset() {
- var filterTable = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
-
- var tf = this.tf;
- if (this.isEnabled()) {
- return;
- }
- this.enable();
- this.init();
-
- if (filterTable) {
- tf.filter();
- }
- };
-
- /**
- * Reset paging info from scratch after a filtering process
- */
-
-
- Paging.prototype.resetPagingInfo = 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
- */
-
-
- Paging.prototype.setPagingInfo = function setPagingInfo(validRows) {
- var tf = this.tf;
- var mdiv = !this.pagingTgtId ? tf.mDiv : (0, _dom.elm)(this.pagingTgtId);
- var pgspan = (0, _dom.elm)(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 === _const.SELECT) {
- this.pagingSlc.innerHTML = '';
- }
-
- if (this.nbPages > 0) {
- mdiv.style.visibility = 'visible';
- if (this.pageSelectorType === _const.SELECT) {
- for (var z = 0; z < this.nbPages; z++) {
- var opt = (0, _dom.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
- */
-
-
- Paging.prototype.groupByPage = 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.getValidRowsNb(true); 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 ((0, _types.isNull)(isRowValid) || Boolean(isRowValid === 'true')) {
- r.style.display = '';
- rowDisplayed = true;
- }
- } else {
- r.style.display = _const.NONE;
- }
- this.emitter.emit('row-paged', tf, validRowIdx, h, rowDisplayed);
- }
-
- // broadcast grouping by page
- this.emitter.emit('grouped-by-page', tf, this);
- };
-
- /**
- * Return the current page number
- * @return {Number} Page number
- */
-
-
- Paging.prototype.getPage = function getPage() {
- return this.currentPageNb;
- };
-
- /**
- * Show page defined by passed argument (string or number):
- * @param {String}/{Number} cmd possible string values: 'next',
- * 'previous', 'last', 'first' or page number as per param
- */
-
-
- Paging.prototype.setPage = function setPage(cmd) {
- var tf = this.tf;
- if (!tf.isInitialized() || !this.isEnabled()) {
- return;
- }
- var btnEvt = this.evt,
- cmdtype = typeof cmd === 'undefined' ? 'undefined' : _typeof(cmd);
- if (cmdtype === 'string') {
- switch (cmd.toLowerCase()) {
- 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
- */
-
-
- Paging.prototype.setResultsPerPage = function setResultsPerPage() {
- var _this3 = this;
-
- var tf = this.tf;
- var evt = this.evt;
-
- if (this.resultsPerPageSlc || !this.resultsPerPage) {
- return;
- }
-
- evt.slcResultsChange = function (ev) {
- _this3.onChangeResultsPerPage();
- ev.target.blur();
- };
-
- var slcR = (0, _dom.createElm)(_const.SELECT, ['id', this.prfxSlcResults + tf.id]);
- slcR.className = this.resultsSlcCssClass;
- var slcRText = this.resultsPerPage[0],
- slcROpts = this.resultsPerPage[1];
- var slcRSpan = (0, _dom.createElm)('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 : (0, _dom.elm)(this.resultsPerPageTgtId);
- slcRSpan.appendChild((0, _dom.createText)(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;
- }
- (0, _event.addEvt)(slcR, 'change', evt.slcResultsChange);
- this.resultsPerPageSlc = slcR;
- };
-
- /**
- * Remove number of results per page UI elements
- */
-
-
- Paging.prototype.removeResultsPerPage = function removeResultsPerPage() {
- var tf = this.tf;
- if (!tf.isInitialized() || !this.resultsPerPageSlc || !this.resultsPerPage) {
- return;
- }
- var slcR = this.resultsPerPageSlc,
- slcRSpan = (0, _dom.elm)(this.prfxSlcResultsTxt + tf.id);
- if (slcR) {
- (0, _dom.removeElm)(slcR);
- }
- if (slcRSpan) {
- (0, _dom.removeElm)(slcRSpan);
- }
- this.resultsPerPageSlc = null;
- };
-
- /**
- * Change the page according to passed index
- * @param {Number} index Index of the page (0-n)
- */
-
-
- Paging.prototype.changePage = function changePage(index) {
- var tf = this.tf;
-
- if (!this.isEnabled()) {
- return;
- }
-
- this.emitter.emit('before-page-change', tf, index + 1);
-
- if (index === null) {
- index = this.pageSelectorType === _const.SELECT ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1;
- }
- if (index >= 0 && index <= this.nbPages - 1) {
- if (this.onBeforeChangePage) {
- this.onBeforeChangePage.call(null, this, index + 1);
- }
- this.currentPageNb = parseInt(index, 10) + 1;
- if (this.pageSelectorType === _const.SELECT) {
- this.pagingSlc.options[index].selected = true;
- } else {
- this.pagingSlc.value = this.currentPageNb;
- }
-
- this.startPagingRow = this.pageSelectorType === _const.SELECT ? this.pagingSlc.value : index * this.pagingLength;
-
- this.groupByPage();
-
- if (this.onAfterChangePage) {
- this.onAfterChangePage.call(null, this, index + 1);
- }
- }
-
- this.emitter.emit('after-page-change', tf, index + 1);
- };
-
- Paging.prototype.changeResultsPerPage = function changeResultsPerPage(val) {
- if (!this.isEnabled() || isNaN(val)) {
- return;
- }
-
- this.resultsPerPageSlc.value = val;
- this.onChangeResultsPerPage();
- };
-
- /**
- * Change rows according to page results drop-down
- */
-
-
- Paging.prototype.onChangeResultsPerPage = function onChangeResultsPerPage() {
- var tf = this.tf;
-
- if (!this.isEnabled()) {
- return;
- }
-
- this.emitter.emit('before-page-length-change', tf);
-
- var slcR = this.resultsPerPageSlc;
- var slcIndex = slcR.selectedIndex;
- var slcPagesSelIndex = this.pageSelectorType === _const.SELECT ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10);
- this.pagingLength = parseInt(slcR.options[slcIndex].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 === _const.SELECT) {
- var slcIdx = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex;
- this.pagingSlc.options[slcIdx].selected = true;
- }
- }
-
- this.emitter.emit('after-page-length-change', tf, this.pagingLength);
- };
-
- /**
- * Re-set page nb at page re-load
- */
-
-
- Paging.prototype.resetPage = function resetPage() {
- var tf = this.tf;
- if (!this.isEnabled()) {
- return;
- }
- this.emitter.emit('before-reset-page', tf);
- var pgNb = tf.feature('store').getPageNb();
- if (pgNb !== '') {
- this.changePage(pgNb - 1);
- }
- this.emitter.emit('after-reset-page', tf, pgNb);
- };
-
- /**
- * Re-set page length value at page re-load
- */
-
-
- Paging.prototype.resetPageLength = function resetPageLength() {
- var tf = this.tf;
- if (!this.isEnabled()) {
- return;
- }
- this.emitter.emit('before-reset-page-length', tf);
- var pglenIndex = tf.feature('store').getPageLength();
-
- if (pglenIndex !== '') {
- this.resultsPerPageSlc.options[pglenIndex].selected = true;
- this.changeResultsPerPage();
- }
- this.emitter.emit('after-reset-page-length', tf, pglenIndex);
- };
-
- /**
- * Remove paging feature
- */
-
-
- Paging.prototype.destroy = function destroy() {
- var _this4 = this;
-
- var tf = this.tf;
-
- if (!this.initialized) {
- return;
- }
- // btns containers
- var btnNextSpan = (0, _dom.elm)(this.prfxBtnNextSpan + tf.id);
- var btnPrevSpan = (0, _dom.elm)(this.prfxBtnPrevSpan + tf.id);
- var btnLastSpan = (0, _dom.elm)(this.prfxBtnLastSpan + tf.id);
- var btnFirstSpan = (0, _dom.elm)(this.prfxBtnFirstSpan + tf.id);
- //span containing 'Page' text
- var pgBeforeSpan = (0, _dom.elm)(this.prfxPgBeforeSpan + tf.id);
- //span containing 'of' text
- var pgAfterSpan = (0, _dom.elm)(this.prfxPgAfterSpan + tf.id);
- //span containing nb of pages
- var pgspan = (0, _dom.elm)(this.prfxPgSpan + tf.id);
-
- var evt = this.evt;
-
- if (this.pagingSlc) {
- if (this.pageSelectorType === _const.SELECT) {
- (0, _event.removeEvt)(this.pagingSlc, 'change', evt.slcPagesChange);
- } else if (this.pageSelectorType === _const.INPUT) {
- (0, _event.removeEvt)(this.pagingSlc, 'keypress', evt._detectKey);
- }
- (0, _dom.removeElm)(this.pagingSlc);
- }
-
- if (btnNextSpan) {
- (0, _event.removeEvt)(btnNextSpan, 'click', evt.next);
- (0, _dom.removeElm)(btnNextSpan);
- }
-
- if (btnPrevSpan) {
- (0, _event.removeEvt)(btnPrevSpan, 'click', evt.prev);
- (0, _dom.removeElm)(btnPrevSpan);
- }
-
- if (btnLastSpan) {
- (0, _event.removeEvt)(btnLastSpan, 'click', evt.last);
- (0, _dom.removeElm)(btnLastSpan);
- }
-
- if (btnFirstSpan) {
- (0, _event.removeEvt)(btnFirstSpan, 'click', evt.first);
- (0, _dom.removeElm)(btnFirstSpan);
- }
-
- if (pgBeforeSpan) {
- (0, _dom.removeElm)(pgBeforeSpan);
- }
-
- if (pgAfterSpan) {
- (0, _dom.removeElm)(pgAfterSpan);
- }
-
- if (pgspan) {
- (0, _dom.removeElm)(pgspan);
- }
-
- if (this.hasResultsPerPage) {
- this.removeResultsPerPage();
- }
-
- this.emitter.off(['after-filtering'], function () {
- return _this4.resetPagingInfo();
- });
- this.emitter.off(['change-page'], function (tf, pageNumber) {
- return _this4.setPage(pageNumber);
- });
- this.emitter.off(['change-page-results'], function (tf, pageLength) {
- return _this4.changeResultsPerPage(pageLength);
- });
-
- this.pagingSlc = null;
- this.nbPages = 0;
- this.disable();
- this.initialized = false;
- };
-
- return Paging;
- }(_feature.Feature);
-
-/***/ },
-/* 22 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ClearButton = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _event = __webpack_require__(1);
-
- 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, _Feature.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;
- }
-
- ClearButton.prototype.onClick = function onClick() {
- if (!this.isEnabled()) {
- return;
- }
- this.tf.clearFilters();
- };
-
- /**
- * Build DOM elements
- */
-
-
- ClearButton.prototype.init = function init() {
- var _this2 = this;
-
- var tf = this.tf;
-
- if (this.initialized) {
- return;
- }
-
- var resetspan = (0, _dom.createElm)('span', ['id', this.prfxResetSpan + tf.id]);
-
- // reset button is added to defined element
- if (!this.btnResetTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.btnResetTgtId ? tf.rDiv : (0, _dom.elm)(this.btnResetTgtId);
- targetEl.appendChild(resetspan);
-
- if (!this.btnResetHtml) {
- var fltreset = (0, _dom.createElm)('a', ['href', 'javascript:voelm(0);']);
- fltreset.className = tf.btnResetCssClass;
- fltreset.appendChild((0, _dom.createText)(this.btnResetText));
- resetspan.appendChild(fltreset);
- (0, _event.addEvt)(fltreset, 'click', function () {
- return _this2.onClick();
- });
- } else {
- resetspan.innerHTML = this.btnResetHtml;
- var resetEl = resetspan.firstChild;
- (0, _event.addEvt)(resetEl, 'click', function () {
- return _this2.onClick();
- });
- }
- this.btnResetEl = resetspan.firstChild;
-
- this.initialized = true;
- };
-
- /**
- * Remove clear button UI
- */
-
-
- ClearButton.prototype.destroy = function destroy() {
- var tf = this.tf;
-
- if (!this.initialized) {
- return;
- }
-
- var resetspan = (0, _dom.elm)(this.prfxResetSpan + tf.id);
- if (resetspan) {
- (0, _dom.removeElm)(resetspan);
- }
- this.btnResetEl = null;
- this.initialized = false;
- };
-
- return ClearButton;
- }(_feature.Feature);
-
-/***/ },
-/* 23 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Help = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _event = __webpack_require__(1);
-
- var _const = __webpack_require__(11);
-
- 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, _Feature.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 = '';
-
- //id prefix for help elements
- _this.prfxHelpSpan = 'helpSpan_';
- //id prefix for help elements
- _this.prfxHelpDiv = 'helpDiv_';
-
- _this.emitter.on(['init-help'], function () {
- return _this.init();
- });
- return _this;
- }
-
- /**
- * Initialise Help instance
- *
- * @returns (description)
- */
-
-
- Help.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
-
- var tf = this.tf;
-
- var helpspan = (0, _dom.createElm)('span', ['id', this.prfxHelpSpan + tf.id]);
- var helpdiv = (0, _dom.createElm)('div', ['id', this.prfxHelpDiv + tf.id]);
-
- //help button is added to defined element
- if (!this.tgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.tgtId ? tf.rDiv : (0, _dom.elm)(this.tgtId);
- targetEl.appendChild(helpspan);
-
- var divContainer = !this.contTgtId ? helpspan : (0, _dom.elm)(this.contTgtId);
-
- if (!this.btnHtml) {
- divContainer.appendChild(helpdiv);
- var helplink = (0, _dom.createElm)('a', ['href', 'javascript:void(0);']);
- helplink.className = this.btnCssClass;
- helplink.appendChild((0, _dom.createText)(this.btnText));
- helpspan.appendChild(helplink);
- (0, _event.addEvt)(helplink, 'click', function () {
- return _this2.toggle();
- });
- } else {
- helpspan.innerHTML = this.btnHtml;
- var helpEl = helpspan.firstChild;
- (0, _event.addEvt)(helpEl, 'click', function () {
- return _this2.toggle();
- });
- divContainer.appendChild(helpdiv);
- }
-
- if (!this.instrHtml) {
- helpdiv.innerHTML = this.instrText;
- helpdiv.className = this.contCssClass;
- (0, _event.addEvt)(helpdiv, 'dblclick', function () {
- return _this2.toggle();
- });
- } else {
- if (this.contTgtId) {
- divContainer.appendChild(helpdiv);
- }
- helpdiv.innerHTML = this.instrHtml;
- if (!this.contTgtId) {
- helpdiv.className = this.contCssClass;
- (0, _event.addEvt)(helpdiv, 'dblclick', function () {
- return _this2.toggle();
- });
- }
- }
- helpdiv.innerHTML += this.defaultHtml;
- (0, _event.addEvt)(helpdiv, 'click', function () {
- return _this2.toggle();
- });
-
- this.cont = helpdiv;
- this.btn = helpspan;
- this.initialized = true;
- };
-
- /**
- * Toggle help pop-up
- */
-
-
- Help.prototype.toggle = 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 === _const.NONE) {
- this.cont.style.display = 'inline';
- } else {
- this.cont.style.display = _const.NONE;
- }
- };
-
- /**
- * Remove help UI
- */
-
-
- Help.prototype.destroy = function destroy() {
- if (!this.initialized) {
- return;
- }
- (0, _dom.removeElm)(this.btn);
- this.btn = null;
- if (!this.cont) {
- return;
- }
- (0, _dom.removeElm)(this.cont);
- this.cont = null;
- this.initialized = false;
- };
-
- return Help;
- }(_feature.Feature);
-
-/***/ },
-/* 24 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.AlternateRows = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- 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; }
-
- /**
- * Rows with alternating background color for improved readability
- */
-
- var AlternateRows = exports.AlternateRows = function (_Feature) {
- _inherits(AlternateRows, _Feature);
-
- /**
- * Creates an instance of AlternateRows.
- *
- * @param {Object} tf TableFilter instance
- */
-
- function AlternateRows(tf) {
- _classCallCheck(this, AlternateRows);
-
- var _this = _possibleConstructorReturn(this, _Feature.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
- */
-
-
- AlternateRows.prototype.init = 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;
- };
-
- /**
- * Apply background to all valid rows
- */
-
-
- AlternateRows.prototype.processAll = function processAll() {
- if (!this.isEnabled()) {
- return;
- }
- var tf = this.tf;
- var validRowsIndex = tf.getValidRows(true);
- var indexLen = validRowsIndex.length;
- var idx = 0;
-
- //alternates bg color
- for (var j = 0; j < indexLen; j++) {
- var rowIdx = validRowsIndex[j];
- this.setRowBg(rowIdx, idx);
- idx++;
- }
- };
-
- /**
- * Set/remove row background based on row validation
- * @param {Number} rowIdx Row index
- * @param {Number} arrIdx Array index
- * @param {Boolean} isValid Valid row flag
- */
-
-
- AlternateRows.prototype.processRow = 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
- */
-
-
- AlternateRows.prototype.setRowBg = 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);
-
- (0, _dom.addClass)(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss);
- };
-
- /**
- * Removes row background color
- * @param {Number} idx Row index
- */
-
-
- AlternateRows.prototype.removeRowBg = function removeRowBg(idx) {
- if (isNaN(idx)) {
- return;
- }
- var rows = this.tf.tbl.rows;
- (0, _dom.removeClass)(rows[idx], this.oddCss);
- (0, _dom.removeClass)(rows[idx], this.evenCss);
- };
-
- /**
- * Removes all alternating backgrounds
- */
-
-
- AlternateRows.prototype.destroy = function destroy() {
- var _this3 = this;
-
- if (!this.initialized) {
- return;
- }
- var nbRows = this.tf.getRowsNb(true);
- for (var i = 0; i < 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';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.NoResults = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- var _const = __webpack_require__(11);
-
- 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, _Feature.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 = !(0, _types.isEmpty)(_this.customContainer) || !(0, _types.isEmpty)(_this.customContainerId);
- _this.cssClass = f.css_class || 'no-results';
-
- _this.cont = null;
-
- //callback before message is displayed
- _this.onBeforeShowMsg = (0, _types.isFn)(f.on_before_show_msg) ? f.on_before_show_msg : null;
- //callback after message is displayed
- _this.onAfterShowMsg = (0, _types.isFn)(f.on_after_show_msg) ? f.on_after_show_msg : null;
- //callback before message is hidden
- _this.onBeforeHideMsg = (0, _types.isFn)(f.on_before_hide_msg) ? f.on_before_hide_msg : null;
- //callback after message is hidden
- _this.onAfterHideMsg = (0, _types.isFn)(f.on_after_hide_msg) ? f.on_after_hide_msg : null;
-
- _this.prfxNoResults = 'nores_';
- return _this;
- }
-
- NoResults.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
- var tf = this.tf;
- var target = this.customContainer || (0, _dom.elm)(this.customContainerId) || tf.tbl;
-
- //container
- var cont = (0, _dom.createElm)('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();
- };
-
- NoResults.prototype.toggle = function toggle() {
- if (this.tf.getValidRowsNb() > 0) {
- this.hide();
- } else {
- this.show();
- }
- };
-
- NoResults.prototype.show = 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);
- }
- };
-
- NoResults.prototype.hide = function hide() {
- if (!this.initialized || !this.isEnabled()) {
- return;
- }
-
- if (this.onBeforeHideMsg) {
- this.onBeforeHideMsg.call(null, this.tf, this);
- }
-
- this.cont.style.display = _const.NONE;
-
- if (this.onBeforeHideMsg) {
- this.onBeforeHideMsg.call(null, this.tf, this);
- }
- };
-
- NoResults.prototype.setWidth = 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';
- }
- };
-
- NoResults.prototype.destroy = function destroy() {
- var _this3 = this;
-
- if (!this.initialized) {
- return;
- }
- (0, _dom.removeElm)(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);
-
-/***/ },
-/* 26 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.State = undefined;
-
- var _feature = __webpack_require__(10);
-
- var _hash = __webpack_require__(27);
-
- var _storage = __webpack_require__(28);
-
- var _string = __webpack_require__(5);
-
- var _types = __webpack_require__(4);
-
- 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; }
-
- /**
- * Reflects the state of features to be persisted via hash, localStorage or
- * cookie
- *
- * @export
- * @class State
- * @extends {Feature}
- */
-
- var State = exports.State = function (_Feature) {
- _inherits(State, _Feature);
-
- /**
- * Creates an instance of State
- *
- * @param {TableFilter} tf TableFilter instance
- */
-
- function State(tf) {
- _classCallCheck(this, State);
-
- var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, 'state'));
-
- var cfg = _this.config.state;
-
- _this.enableHash = cfg === true || (0, _types.isArray)(cfg.types) && cfg.types.indexOf('hash') !== -1;
- _this.enableLocalStorage = (0, _types.isArray)(cfg.types) && cfg.types.indexOf('local_storage') !== -1;
- _this.enableCookie = (0, _types.isArray)(cfg.types) && cfg.types.indexOf('cookie') !== -1;
- _this.persistFilters = cfg.filters === false ? false : true;
- _this.persistPageNumber = Boolean(cfg.page_number);
- _this.persistPageLength = Boolean(cfg.page_length);
- _this.persistSort = Boolean(cfg.sort);
- _this.persistColsVisibility = Boolean(cfg.columns_visibility);
- _this.persistFiltersVisibility = Boolean(cfg.filters_visibility);
- _this.cookieDuration = !isNaN(cfg.cookie_duration) ? parseInt(cfg.cookie_duration, 10) : 87600;
-
- _this.enableStorage = _this.enableLocalStorage || _this.enableCookie;
- _this.hash = null;
- _this.pageNb = null;
- _this.pageLength = null;
- _this.sort = null;
- _this.hiddenCols = null;
- _this.filtersVisibility = null;
-
- _this.state = {};
- _this.prfxCol = 'col_';
- _this.pageNbKey = 'page';
- _this.pageLengthKey = 'page_length';
- _this.filtersVisKey = 'filters_visibility';
- return _this;
- }
-
- /**
- * Initializes the State object
- */
-
-
- State.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
-
- this.emitter.on(['after-filtering'], function () {
- return _this2.update();
- });
- this.emitter.on(['after-page-change', 'after-clearing-filters'], function (tf, pageNb) {
- return _this2.updatePage(pageNb);
- });
- this.emitter.on(['after-page-length-change'], function (tf, pageLength) {
- return _this2.updatePageLength(pageLength);
- });
- this.emitter.on(['column-sorted'], function (tf, index, descending) {
- return _this2.updateSort(index, descending);
- });
- this.emitter.on(['sort-initialized'], function () {
- return _this2._syncSort();
- });
- this.emitter.on(['columns-visibility-initialized'], function () {
- return _this2._syncColsVisibility();
- });
- this.emitter.on(['column-shown', 'column-hidden'], function (tf, feature, colIndex, hiddenCols) {
- return _this2.updateColsVisibility(hiddenCols);
- });
- this.emitter.on(['filters-visibility-initialized'], function () {
- return _this2._syncFiltersVisibility();
- });
- this.emitter.on(['filters-toggled'], function (tf, extension, visible) {
- return _this2.updateFiltersVisibility(visible);
- });
-
- if (this.enableHash) {
- this.hash = new _hash.Hash(this);
- this.hash.init();
- }
- if (this.enableStorage) {
- this.storage = new _storage.Storage(this);
- this.storage.init();
- }
- this.initialized = true;
- };
-
- /**
- * Update state object based on current features state
- */
-
-
- State.prototype.update = function update() {
- var _this3 = this;
-
- if (!this.isEnabled()) {
- return;
- }
- var state = this.state;
- var tf = this.tf;
-
- if (this.persistFilters) {
- var filterValues = tf.getFiltersValue();
-
- filterValues.forEach(function (val, idx) {
- var key = '' + _this3.prfxCol + idx;
-
- if ((0, _types.isString)(val) && (0, _string.isEmpty)(val)) {
- if (state.hasOwnProperty(key)) {
- state[key].flt = undefined;
- }
- } else {
- state[key] = state[key] || {};
- state[key].flt = val;
- }
- });
- }
-
- if (this.persistPageNumber) {
- if ((0, _types.isNull)(this.pageNb)) {
- state[this.pageNbKey] = undefined;
- } else {
- state[this.pageNbKey] = this.pageNb;
- }
- }
-
- if (this.persistPageLength) {
- if ((0, _types.isNull)(this.pageLength)) {
- state[this.pageLengthKey] = undefined;
- } else {
- state[this.pageLengthKey] = this.pageLength;
- }
- }
-
- if (this.persistSort) {
- if (!(0, _types.isNull)(this.sort)) {
- // Remove previuosly sorted column
- Object.keys(state).forEach(function (key) {
- if (key.indexOf(_this3.prfxCol) !== -1 && state[key]) {
- state[key].sort = undefined;
- }
- });
-
- var key = '' + this.prfxCol + this.sort.column;
- state[key] = state[key] || {};
- state[key].sort = { descending: this.sort.descending };
- }
- }
-
- if (this.persistColsVisibility) {
- if (!(0, _types.isNull)(this.hiddenCols)) {
- // Clear previuosly hidden columns
- Object.keys(state).forEach(function (key) {
- if (key.indexOf(_this3.prfxCol) !== -1 && state[key]) {
- state[key].hidden = undefined;
- }
- });
-
- this.hiddenCols.forEach(function (colIdx) {
- var key = '' + _this3.prfxCol + colIdx;
- state[key] = state[key] || {};
- state[key].hidden = true;
- });
- }
- }
-
- if (this.persistFiltersVisibility) {
- if ((0, _types.isNull)(this.filtersVisibility)) {
- state[this.filtersVisKey] = undefined;
- } else {
- state[this.filtersVisKey] = this.filtersVisibility;
- }
- }
-
- this.emitter.emit('state-changed', tf, state);
- };
-
- /**
- * Refresh page number field on page number changes
- *
- * @param {Number} pageNb Current page number
- */
-
-
- State.prototype.updatePage = function updatePage(pageNb) {
- this.pageNb = pageNb;
- this.update();
- };
-
- /**
- * Refresh page length field on page length changes
- *
- * @param {Number} pageLength Current page length value
- */
-
-
- State.prototype.updatePageLength = function updatePageLength(pageLength) {
- this.pageLength = pageLength;
- this.update();
- };
-
- /**
- * Refresh column sorting information on sort changes
- *
- * @param index {Number} Column index
- * @param {Boolean} descending Descending manner
- */
-
-
- State.prototype.updateSort = function updateSort(index, descending) {
- this.sort = {
- column: index,
- descending: descending
- };
- this.update();
- };
-
- /**
- * Refresh hidden columns information on columns visibility changes
- *
- * @param {Array} hiddenCols Columns indexes
- */
-
-
- State.prototype.updateColsVisibility = function updateColsVisibility(hiddenCols) {
- this.hiddenCols = hiddenCols;
- this.update();
- };
-
- /**
- * Refresh filters visibility on filters visibility change
- *
- * @param {Boolean} visible Visibility flad
- */
-
-
- State.prototype.updateFiltersVisibility = function updateFiltersVisibility(visible) {
- this.filtersVisibility = visible;
- this.update();
- };
-
- /**
- * Override state field
- *
- * @param state State object
- */
-
-
- State.prototype.override = function override(state) {
- this.state = state;
- };
-
- /**
- * Sync stored features state
- */
-
-
- State.prototype.sync = function sync() {
- var state = this.state;
- var tf = this.tf;
-
- this._syncFilters();
-
- if (this.persistPageNumber) {
- var pageNumber = state[this.pageNbKey];
- this.emitter.emit('change-page', tf, pageNumber);
- }
-
- if (this.persistPageLength) {
- var pageLength = state[this.pageLengthKey];
- this.emitter.emit('change-page-results', tf, pageLength);
- }
-
- this._syncSort();
- this._syncColsVisibility();
- this._syncFiltersVisibility();
- };
-
- /**
- * Override current state with passed one and sync features
- *
- * @param {Object} state State object
- */
-
-
- State.prototype.overrideAndSync = function overrideAndSync(state) {
- // To prevent state to react to features changes, state is temporarily
- // disabled
- this.disable();
- // State is overriden with passed state object
- this.override(state);
- // New hash state is applied to features
- this.sync();
- // State is re-enabled
- this.enable();
- };
-
- /**
- * Sync filters with stored values and filter table
- *
- * @private
- */
-
-
- State.prototype._syncFilters = function _syncFilters() {
- var _this4 = this;
-
- if (!this.persistFilters) {
- return;
- }
- var state = this.state;
- var tf = this.tf;
-
- Object.keys(state).forEach(function (key) {
- if (key.indexOf(_this4.prfxCol) !== -1) {
- var colIdx = parseInt(key.replace(_this4.prfxCol, ''), 10);
- var val = state[key].flt;
- tf.setFilterValue(colIdx, val);
- }
- });
-
- tf.filter();
- };
-
- /**
- * Sync sorted column with stored sorting information and sort table
- *
- * @private
- */
-
-
- State.prototype._syncSort = function _syncSort() {
- var _this5 = this;
-
- if (!this.persistSort) {
- return;
- }
- var state = this.state;
- var tf = this.tf;
-
- Object.keys(state).forEach(function (key) {
- if (key.indexOf(_this5.prfxCol) !== -1) {
- var colIdx = parseInt(key.replace(_this5.prfxCol, ''), 10);
- if (!(0, _types.isUndef)(state[key].sort)) {
- var sort = state[key].sort;
- _this5.emitter.emit('sort', tf, colIdx, sort.descending);
- }
- }
- });
- };
-
- /**
- * Sync hidden columns with stored information
- *
- * @private
- */
-
-
- State.prototype._syncColsVisibility = function _syncColsVisibility() {
- var _this6 = this;
-
- if (!this.persistColsVisibility) {
- return;
- }
- var state = this.state;
- var tf = this.tf;
- var hiddenCols = [];
-
- Object.keys(state).forEach(function (key) {
- if (key.indexOf(_this6.prfxCol) !== -1) {
- var colIdx = parseInt(key.replace(_this6.prfxCol, ''), 10);
- if (!(0, _types.isUndef)(state[key].hidden)) {
- hiddenCols.push(colIdx);
- }
- }
- });
-
- hiddenCols.forEach(function (colIdx) {
- _this6.emitter.emit('hide-column', tf, colIdx);
- });
- };
-
- /**
- * Sync filters visibility with stored information
- *
- * @private
- */
-
-
- State.prototype._syncFiltersVisibility = function _syncFiltersVisibility() {
- if (!this.persistFiltersVisibility) {
- return;
- }
- var state = this.state;
- var tf = this.tf;
- var filtersVisibility = state[this.filtersVisKey];
-
- this.filtersVisibility = filtersVisibility;
- this.emitter.emit('show-filters', tf, filtersVisibility);
- };
-
- /**
- * Destroy State instance
- */
-
-
- State.prototype.destroy = function destroy() {
- var _this7 = this;
-
- if (!this.initialized) {
- return;
- }
-
- this.state = {};
-
- this.emitter.off(['after-filtering'], function () {
- return _this7.update();
- });
- this.emitter.off(['after-page-change', 'after-clearing-filters'], function (tf, pageNb) {
- return _this7.updatePage(pageNb);
- });
- this.emitter.off(['after-page-length-change'], function (tf, index) {
- return _this7.updatePageLength(index);
- });
- this.emitter.off(['column-sorted'], function (tf, index, descending) {
- return _this7.updateSort(index, descending);
- });
- this.emitter.off(['sort-initialized'], function () {
- return _this7._syncSort();
- });
- this.emitter.off(['columns-visibility-initialized'], function () {
- return _this7._syncColsVisibility();
- });
- this.emitter.off(['column-shown', 'column-hidden'], function (tf, feature, colIndex, hiddenCols) {
- return _this7.updateColsVisibility(hiddenCols);
- });
- this.emitter.off(['filters-visibility-initialized'], function () {
- return _this7._syncFiltersVisibility();
- });
- this.emitter.off(['filters-toggled'], function (tf, extension, visible) {
- return _this7.updateFiltersVisibility(visible);
- });
-
- if (this.enableHash) {
- this.hash.destroy();
- this.hash = null;
- }
-
- if (this.enableStorage) {
- this.storage.destroy();
- this.storage = null;
- }
-
- this.initialized = false;
- };
-
- return State;
- }(_feature.Feature);
-
-/***/ },
-/* 27 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Hash = exports.hasHashChange = undefined;
-
- var _event = __webpack_require__(1);
-
- var _root = __webpack_require__(2);
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- var JSON = _root.root.JSON;
- var location = _root.root.location;
- var decodeURIComponent = _root.root.decodeURIComponent;
-
- var hasHashChange = exports.hasHashChange = function hasHashChange() {
- var docMode = _root.root.documentMode;
- return 'onhashchange' in _root.root && (docMode === undefined || docMode > 7);
- };
-
- /**
- * Manages the URL hash reflecting the features state to be persisted
- *
- * @export
- * @class Hash
- */
-
- var Hash = exports.Hash = function () {
-
- /**
- * Creates an instance of Hash
- *
- * @param {State} state Instance of State
- */
-
- function Hash(state) {
- _classCallCheck(this, Hash);
-
- this.state = state;
- this.lastHash = null;
- this.emitter = state.emitter;
- }
-
- /**
- * Initializes the Hash object
- */
-
-
- Hash.prototype.init = function init() {
- var _this = this;
-
- if (!hasHashChange()) {
- return;
- }
-
- this.lastHash = location.hash;
-
- this.emitter.on(['state-changed'], function (tf, state) {
- return _this.update(state);
- });
- this.emitter.on(['initialized'], function () {
- return _this.sync();
- });
- (0, _event.addEvt)(_root.root, 'hashchange', function () {
- return _this.sync();
- });
- };
-
- /**
- * Updates the URL hash based on a state change
- *
- * @param {State} state Instance of State
- */
-
-
- Hash.prototype.update = function update(state) {
- var hash = '#' + JSON.stringify(state);
- if (this.lastHash === hash) {
- return;
- }
-
- location.hash = hash;
- this.lastHash = hash;
- };
-
- /**
- * Converts a URL hash into a state JSON object
- *
- * @param {String} hash URL hash fragment
- * @returns {Object} JSON object
- */
-
-
- Hash.prototype.parse = function parse(hash) {
- if (hash.indexOf('#') === -1) {
- return null;
- }
- hash = hash.substr(1);
- return JSON.parse(decodeURIComponent(hash));
- };
-
- /**
- * Applies current hash state to features
- */
-
-
- Hash.prototype.sync = function sync() {
- var state = this.parse(location.hash);
- if (!state) {
- return;
- }
- // override current state with persisted one and sync features
- this.state.overrideAndSync(state);
- };
-
- /**
- * Release Hash event subscriptions and clear fields
- */
-
-
- Hash.prototype.destroy = function destroy() {
- var _this2 = this;
-
- this.emitter.off(['state-changed'], function (tf, state) {
- return _this2.update(state);
- });
- this.emitter.off(['initialized'], function () {
- return _this2.sync();
- });
- (0, _event.removeEvt)(_root.root, 'hashchange', function () {
- return _this2.sync();
- });
-
- this.state = null;
- this.lastHash = null;
- this.emitter = null;
- };
-
- return Hash;
- }();
-
-/***/ },
-/* 28 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Storage = exports.hasStorage = undefined;
-
- var _cookie = __webpack_require__(29);
-
- var _cookie2 = _interopRequireDefault(_cookie);
-
- var _root = __webpack_require__(2);
-
- 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 JSON = _root.root.JSON;
- var localStorage = _root.root.localStorage;
- var location = _root.root.location;
-
- var hasStorage = exports.hasStorage = function hasStorage() {
- return 'Storage' in _root.root;
- };
-
- /**
- * Stores the features state in browser's local storage or cookie
- *
- * @export
- * @class Storage
- */
-
- var Storage = exports.Storage = function () {
-
- /**
- * Creates an instance of Storage
- *
- * @param {State} state Instance of State
- */
-
- function Storage(state) {
- _classCallCheck(this, Storage);
-
- this.state = state;
- this.tf = state.tf;
- this.enableLocalStorage = state.enableLocalStorage && hasStorage();
- this.enableCookie = state.enableCookie && !this.enableLocalStorage;
- this.emitter = state.emitter;
- this.duration = state.cookieDuration;
- }
-
- /**
- * Initializes the Storage object
- */
-
-
- Storage.prototype.init = function init() {
- var _this = this;
-
- this.emitter.on(['state-changed'], function (tf, state) {
- return _this.save(state);
- });
- this.emitter.on(['initialized'], function () {
- return _this.sync();
- });
- };
-
- /**
- * Persists the features state on state changes
- *
- * @param {State} state Instance of State
- */
-
-
- Storage.prototype.save = function save(state) {
- if (this.enableLocalStorage) {
- localStorage[this.getKey()] = JSON.stringify(state);
- } else {
- _cookie2.default.write(this.getKey(), JSON.stringify(state), this.duration);
- }
- };
-
- /**
- * Turns stored string into a State JSON object
- *
- * @returns {Object} JSON object
- */
-
-
- Storage.prototype.retrieve = function retrieve() {
- var state = null;
- if (this.enableLocalStorage) {
- state = localStorage[this.getKey()];
- } else {
- state = _cookie2.default.read(this.getKey());
- }
-
- if (!state) {
- return null;
- }
- return JSON.parse(state);
- };
-
- /**
- * Removes persisted state from storage
- */
-
-
- Storage.prototype.remove = function remove() {
- if (this.enableLocalStorage) {
- localStorage.removeItem(this.getKey());
- } else {
- _cookie2.default.remove(this.getKey());
- }
- };
-
- /**
- * Applies persisted state to features
- */
-
-
- Storage.prototype.sync = function sync() {
- var state = this.retrieve();
- if (!state) {
- return;
- }
- // override current state with persisted one and sync features
- this.state.overrideAndSync(state);
- };
-
- /**
- * Returns the storage key
- *
- * @returns {String} Key
- */
-
-
- Storage.prototype.getKey = function getKey() {
- return JSON.stringify({
- key: this.tf.prfxTf + '_' + this.tf.id,
- path: location.pathname
- });
- };
-
- /**
- * Release Storage event subscriptions and clear fields
- */
-
-
- Storage.prototype.destroy = function destroy() {
- var _this2 = this;
-
- this.emitter.off(['state-changed'], function (tf, state) {
- return _this2.save(state);
- });
- this.emitter.off(['initialized'], function () {
- return _this2.sync();
- });
-
- this.remove();
-
- this.state = null;
- this.emitter = null;
- };
-
- return Storage;
- }();
-
-/***/ },
-/* 29 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _root = __webpack_require__(2);
-
- /**
- * Cookie utilities
- */
-
- var doc = _root.root.document;
-
- exports.default = {
- write: function write(name, value, hours) {
- var expire = '';
- if (hours) {
- expire = new Date(new Date().getTime() + hours * 3600000);
- expire = '; expires=' + expire.toGMTString();
- }
- doc.cookie = name + '=' + escape(value) + expire;
- },
- read: function read(name) {
- var cookieValue = '',
- search = name + '=';
- if (doc.cookie.length > 0) {
- var cookie = doc.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];
- }
- };
-
-/***/ }
-/******/ ])
-});
-;
-//# 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,r){for(var o,a,l=0,h=[];la;a++)r[a]=arguments[a];if(r.forEach(function(t){"object"===("undefined"==typeof t?"undefined":n(t))&&"TABLE"===t.nodeName?(e.tbl=t,e.id=t.id||"tf_"+(new Date).getTime()+"_"):(0,l.isString)(t)?(e.id=t,e.tbl=(0,o.elm)(t)):(0,l.isNumber)(t)?e.startRow=t:(0,l.isObj)(t)&&(e.cfg=t)}),!this.tbl||"TABLE"!==this.tbl.nodeName||0===this.getRowsNb())throw new Error("Could not instantiate TableFilter: HTML table\n DOM element not found.");var h=this.cfg;this.emitter=new f.Emitter,this.refRow=null===this.startRow?2:this.startRow+1;try{this.nbCells=this.getCellsNb(this.refRow)}catch(p){this.nbCells=this.getCellsNb(0)}this.basePath=h.base_path||"tablefilter/",this.fltGrid=h.grid!==!1,this.gridLayout=Boolean(h.grid_layout),this.filtersRowIndex=isNaN(h.filters_row_index)?0:h.filters_row_index,this.headersRow=isNaN(h.headers_row_index)?0===this.filtersRowIndex?1:0:h.headers_row_index,this.fltCellTag=(0,l.isString)(h.filters_cell_tag)?h.filters_cell_tag:F.CELL_TAG,this.fltIds=[],this.validRowsIndex=[],this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.infDivCssClass=h.inf_div_css_class||"inf",this.lDivCssClass=h.left_div_css_class||"ldiv",this.rDivCssClass=h.right_div_css_class||"rdiv",this.mDivCssClass=h.middle_div_css_class||"mdiv",this.contDivCssClass=h.content_div_css_class||"cont",this.stylePath=h.style_path||this.basePath+"style/",this.stylesheet=h.stylesheet||this.stylePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=h.flts_row_css_class||"fltrow",this.enableIcons=h.enable_icons!==!1,this.alternateRows=Boolean(h.alternate_rows),this.hasColWidths=(0,l.isArray)(h.col_widths),this.colWidths=this.hasColWidths?h.col_widths:[],this.fltCssClass=h.flt_css_class||"flt",this.fltMultiCssClass=h.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=h.flt_small_css_class||"flt_s",this.singleFltCssClass=h.single_flt_css_class||"single_flt",this.enterKey=h.enter_key!==!1,this.onBeforeFilter=(0,l.isFn)(h.on_before_filter)?h.on_before_filter:null,this.onAfterFilter=(0,l.isFn)(h.on_after_filter)?h.on_after_filter:null,this.caseSensitive=Boolean(h.case_sensitive),this.hasExactMatchByCol=(0,l.isArray)(h.columns_exact_match),this.exactMatchByCol=this.hasExactMatchByCol?h.columns_exact_match:[],this.exactMatch=Boolean(h.exact_match),this.linkedFilters=Boolean(h.linked_filters),this.disableExcludedOptions=Boolean(h.disable_excluded_options),this.activeFilterId=null,this.hasVisibleRows=Boolean(h.rows_always_visible),this.visibleRows=this.hasVisibleRows?h.rows_always_visible:[],this.isExternalFlt=Boolean(h.external_flt_grid),this.externalFltTgtIds=h.external_flt_grid_ids||[],this.externalFltEls=[],this.onFiltersLoaded=(0,l.isFn)(h.on_filters_loaded)?h.on_filters_loaded:null,this.singleSearchFlt=Boolean(h.single_filter),this.onRowValidated=(0,l.isFn)(h.on_row_validated)?h.on_row_validated:null,this.customCellDataCols=h.custom_cell_data_cols?h.custom_cell_data_cols:[],this.customCellData=(0,l.isFn)(h.custom_cell_data)?h.custom_cell_data:null,this.watermark=h.watermark||"",this.isWatermarkArray=(0,l.isArray)(this.watermark),this.toolBarTgtId=h.toolbar_target_id||null,this.help=(0,l.isUndef)(h.help_instructions)?void 0:Boolean(h.help_instructions),this.popupFilters=Boolean(h.popup_filters),this.markActiveColumns=Boolean(h.mark_active_columns),this.activeColumnsCssClass=h.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=(0,l.isFn)(h.on_before_active_column)?h.on_before_active_column:null,this.onAfterActiveColumn=(0,l.isFn)(h.on_after_active_column)?h.on_after_active_column:null,this.displayAllText=h.display_all_text||"Clear",this.enableEmptyOption=Boolean(h.enable_empty_option),this.emptyText=h.empty_text||"(Empty)",this.enableNonEmptyOption=Boolean(h.enable_non_empty_option),this.nonEmptyText=h.non_empty_text||"(Non empty)",this.onSlcChange=h.on_change!==!1,this.sortSlc=h.sort_select!==!1,this.isSortNumAsc=Boolean(h.sort_num_asc),this.sortNumAsc=this.isSortNumAsc?h.sort_num_asc:[],this.isSortNumDesc=Boolean(h.sort_num_desc),this.sortNumDesc=this.isSortNumDesc?h.sort_num_desc:[],this.loadFltOnDemand=Boolean(h.load_filters_on_demand),this.hasCustomOptions=(0,l.isObj)(h.custom_options),this.customOptions=h.custom_options,this.rgxOperator=h.regexp_operator||"rgx:",this.emOperator=h.empty_operator||"[empty]",this.nmOperator=h.nonempty_operator||"[nonempty]",this.orOperator=h.or_operator||"||",this.anOperator=h.and_operator||"&&",this.grOperator=h.greater_operator||">",this.lwOperator=h.lower_operator||"<",this.leOperator=h.lower_equal_operator||"<=",this.geOperator=h.greater_equal_operator||">=",this.dfOperator=h.different_operator||"!",this.lkOperator=h.like_operator||"*",this.eqOperator=h.equal_operator||"=",this.stOperator=h.start_with_operator||"{",this.enOperator=h.end_with_operator||"}",this.curExp=h.cur_exp||"^[¥£€$]",this.separator=h.separator||",",this.rowsCounter=Boolean(h.rows_counter),this.statusBar=Boolean(h.status_bar),this.loader=Boolean(h.loader),this.displayBtn=Boolean(h.btn),this.btnText=h.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=h.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(h.btn_reset),this.btnResetCssClass=h.btn_reset_css_class||"reset",this.onBeforeReset=(0,l.isFn)(h.on_before_reset)?h.on_before_reset:null,this.onAfterReset=(0,l.isFn)(h.on_after_reset)?h.on_after_reset:null,this.paging=Boolean(h.paging),this.nbHiddenRows=0,this.autoFilter=Boolean(h.auto_filter),this.autoFilterDelay=isNaN(h.auto_filter_delay)?F.AUTO_FILTER_DELAY:h.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(h.highlight_keywords),this.noResults=(0,l.isObj)(h.no_results_message)||Boolean(h.no_results_message),this.state=(0,l.isObj)(h.state)||Boolean(h.state),this.defaultDateType=h.default_date_type||"DMY",this.thousandsSeparator=h.thousands_separator||",",this.decimalSeparator=h.decimal_separator||".",this.hasColNbFormat=(0,l.isArray)(h.col_number_format),this.colNbFormat=this.hasColNbFormat?h.col_number_format:null,this.hasColDateType=(0,l.isArray)(h.col_date_type),this.colDateType=this.hasColDateType?h.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.prfxResponsive="resp",this.extensions=h.extensions,this.hasExtensions=(0,l.isArray)(this.extensions),this.enableDefaultTheme=Boolean(h.enable_default_theme),this.hasThemes=this.enableDefaultTheme||(0,l.isArray)(h.themes),this.themes=h.themes||[],this.themesPath=h.themes_path||this.stylePath+"themes/",this.responsive=Boolean(h.responsive),this.Mod={},this.ExtRegistry={}}return t.prototype.init=function(){var t=this;if(!this.initialized){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(),e.help||(e.help=new w.Help(this)),this.help&&e.help.init(),this.state&&(e.state||(e.state=new P.State(this)),e.state.init()),this.gridLayout&&(e.gridLayout||(e.gridLayout=new u.GridLayout(this)),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new d.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new g.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new m.PopupFilter(this)),e.popupFilter.init()),this.fltGrid){var n=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb();for(var r=0;i>r;r++){this.emitter.emit("before-filter-init",this,r);var a=(0,o.createElm)(this.fltCellTag),l=this.getFilterType(r);this.singleSearchFlt&&(a.colSpan=this.nbCells),this.gridLayout||n.appendChild(a),s=r===i-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.singleSearchFlt&&(l=F.INPUT,s=this.singleFltCssClass),l===F.SELECT||l===F.MULTIPLE?(e.dropdown||(e.dropdown=new v.Dropdown(this)),e.dropdown.init(r,this.isExternalFlt,a)):l===F.CHECKLIST?(e.checkList||(e.checkList=new b.CheckList(this)),e.checkList.init(r,this.isExternalFlt,a)):this._buildInputFilter(r,s,a),r===i-1&&this.displayBtn&&this._buildSubmitButton(r,a),this.emitter.emit("after-filter-init",this,r)}this.emitter.on(["filter-focus"],function(e,i){return t.setActiveFilterId(i.id)})}else this._initNoFilters();this.hasVisibleRows&&(this.emitter.on(["after-filtering"],function(){return t.enforceVisibility()}),this.enforceVisibility()),this.rowsCounter&&(e.rowsCounter=new y.RowsCounter(this),e.rowsCounter.init()),this.statusBar&&(e.statusBar=new _.StatusBar(this),e.statusBar.init()),this.paging&&(e.paging?e.paging.reset():(e.paging=new C.Paging(this),e.paging.init())),this.btnReset&&(e.clearButton=new x.ClearButton(this),e.clearButton.init()),this.hasColWidths&&!this.gridLayout&&this.setColWidths(),this.alternateRows&&(e.alternateRows=new E.AlternateRows(this),e.alternateRows.init()),this.noResults&&(e.noResults||(e.noResults=new T.NoResults(this)),e.noResults.init()),this.gridLayout||((0,o.addClass)(this.tbl,this.prfxTf),this.responsive&&(0,o.addClass)(this.tbl,this.prfxResponsive)),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.initialized=!0,this.emitter.emit("initialized",this)}},t.prototype.detectKey=function(t){if(this.enterKey&&t){var e=(0,r.keyCode)(t);e===F.ENTER_KEY?(this.filter(),(0,r.cancelEvt)(t),(0,r.stopEvt)(t)):(this.isUserTyping=!0,c.root.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},t.prototype.onKeyUp=function(t){function e(){c.root.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null,this.isUserTyping||(this.filter(),this.isUserTyping=null)}if(this.autoFilter){var i=(0,r.keyCode)(t);this.isUserTyping=!1,i!==F.ENTER_KEY&&i!==F.TAB_KEY&&i!==F.ESC_KEY&&i!==F.UP_ARROW_KEY&&i!==F.DOWN_ARROW_KEY?null===this.autoFilterTimer&&(this.autoFilterTimer=c.root.setInterval(e.bind(this),this.autoFilterDelay)):(c.root.clearInterval(this.autoFilterTimer),this.autoFilterTimer=null)}},t.prototype.onKeyDown=function(){this.autoFilter&&(this.isUserTyping=!0)},t.prototype.onInpFocus=function(t){var e=(0,r.targetEvt)(t);this.emitter.emit("filter-focus",this,e)},t.prototype.onInpBlur=function(){this.autoFilter&&(this.isUserTyping=!1,c.root.clearInterval(this.autoFilterTimer)),this.emitter.emit("filter-blur",this)},t.prototype._insertFiltersRow=function(){if(!this.gridLayout){var t=void 0,e=(0,o.tag)(this.tbl,"thead");return t=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display=F.NONE),this.emitter.emit("filters-row-inserted",this,t),t}},t.prototype._initNoFilters=function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb())},t.prototype._buildInputFilter=function(t,e,i){var s=this,n=this.getFilterType(t),a=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=n===F.INPUT?"text":"hidden",h=(0,o.createElm)(F.INPUT,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&h.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),h.className=e||this.fltCssClass,(0,r.addEvt)(h,"focus",function(t){return s.onInpFocus(t)}),a?((0,o.elm)(a).appendChild(h),this.externalFltEls.push(h)):i.appendChild(h),this.fltIds.push(h.id),(0,r.addEvt)(h,"keypress",function(t){return s.detectKey(t)}),(0,r.addEvt)(h,"keydown",function(){return s.onKeyDown()}),(0,r.addEvt)(h,"keyup",function(t){return s.onKeyUp(t)}),(0,r.addEvt)(h,"blur",function(){return s.onInpBlur()})},t.prototype._buildSubmitButton=function(t,e){var i=this,s=this.isExternalFlt?this.externalFltTgtIds[t]:null,n=(0,o.createElm)(F.INPUT,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);n.className=this.btnCssClass,s?(0,o.elm)(s).appendChild(n):e.appendChild(n),(0,r.addEvt)(n,"click",function(){return i.filter()})},t.prototype.feature=function(t){return this.Mod[t]},t.prototype.initExtensions=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)},t.prototype.loadExtension=function(t){var e=this;if(t&&t.name){var s=t.name,n=t.path,r=void 0;s&&n?r=t.path+s:(s=s.replace(".js",""),r="extensions/{}/{}".replace(/{}/g,s)),i.e(1,function(i){var n=[i(30)("./"+r)];(function(i){var n=new i["default"](e,t);n.init(),e.ExtRegistry[s]=n}).apply(null,n)})}},t.prototype.extension=function(t){return this.ExtRegistry[t]},t.prototype.hasExtension=function(t){return!(0,l.isEmpty)(this.ExtRegistry[t])},t.prototype.destroyExtensions=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]=void 0)}},t.prototype.loadThemes=function(){var t=this.themes;if(this.emitter.emit("before-loading-themes",this),this.enableDefaultTheme){var e={name:"default"};this.themes.push(e)}if((0,l.isArray)(t))for(var i=0,s=t.length;s>i;i++){var n=t[i],r=n.name,o=n.path,a=this.prfxTf+r;r&&!o?o=this.themesPath+r+"/"+r+".css":!r&&n.path&&(r="theme{0}".replace("{0}",i)),this.isImported(o,"link")||this["import"](a,o,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)},t.prototype.getStylesheet=function(){var t=arguments.length<=0||void 0===arguments[0]?"default":arguments[0];return(0,o.elm)(this.prfxTf+t)},t.prototype.destroy=function(){var t=this;if(this.initialized){var e=this.Mod,i=this.emitter;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.markActiveColumns&&(this.clearActiveColumns(),i.off(["before-filtering"],function(){return t.clearActiveColumns()}),i.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions(),this.validateAllRows(),this.fltGrid&&!this.gridLayout&&this.tbl.deleteRow(this.filtersRowIndex),i.emit("destroy",this),Object.keys(e).forEach(function(t){var i=e[t];i&&(0,l.isFn)(i.destroy)&&i.destroy()}),this.hasVisibleRows&&i.off(["after-filtering"],function(){return t.enforceVisibility()}),this.linkedFilters&&i.off(["after-filtering"],function(){return t.linkFilters()}),this.emitter.off(["filter-focus"],function(e,i){return t.setActiveFilterId(i.id)}),(0,o.removeClass)(this.tbl,this.prfxTf),(0,o.removeClass)(this.tbl,this.prfxResponsive),this.nbHiddenRows=0,this.validRowsIndex=[],this.fltIds=[],this.initialized=!1}},t.prototype.setToolbar=function(){if(!this.infDiv){var t=(0,o.createElm)("div",["id",this.prfxInfDiv+this.id]);if(t.className=this.infDivCssClass,this.toolBarTgtId)(0,o.elm)(this.toolBarTgtId).appendChild(t);else if(this.gridLayout){var e=this.Mod.gridLayout;e.tblMainCont.appendChild(t),t.className=e.infDivCssClass}else{var i=(0,o.createElm)("caption");i.appendChild(t),this.tbl.insertBefore(i,this.tbl.firstChild)}this.infDiv=(0,o.elm)(this.prfxInfDiv+this.id);var s=(0,o.createElm)("div",["id",this.prfxLDiv+this.id]);s.className=this.lDivCssClass,t.appendChild(s),this.lDiv=(0,o.elm)(this.prfxLDiv+this.id);var n=(0,o.createElm)("div",["id",this.prfxRDiv+this.id]);n.className=this.rDivCssClass,t.appendChild(n),this.rDiv=(0,o.elm)(this.prfxRDiv+this.id);var r=(0,o.createElm)("div",["id",this.prfxMDiv+this.id]);r.className=this.mDivCssClass,t.appendChild(r),this.mDiv=(0,o.elm)(this.prfxMDiv+this.id),(0,l.isUndef)(this.help)&&(this.Mod.help.enabled=!0,this.emitter.emit("init-help",this))}},t.prototype.removeToolbar=function(){if(this.infDiv){(0,o.removeElm)(this.infDiv),this.infDiv=null;var t=this.tbl,e=(0,o.tag)(t,"caption");e.length>0&&[].forEach.call(e,function(e){return t.removeChild(e)})}},t.prototype.removeExternalFlts=function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;e>i;i++){var s=t[i],n=(0,o.elm)(s);n&&(n.innerHTML="")}},t.prototype.isCustomOptions=function(t){return this.hasCustomOptions&&-1!==this.customOptions.cols.indexOf(t)},t.prototype.getCustomOptions=function(t){if(!(0,l.isEmpty)(t)&&this.isCustomOptions(t)){for(var e=this.customOptions,i=e.cols,s=[],n=[],r=i.indexOf(t),o=e.values[r],a=e.texts[r],h=e.sorts[r],p=0,c=o.length;c>p;p++)n.push(o[p]),a[p]?s.push(a[p]):s.push(o[p]);return h&&(n.sort(),s.sort()),[n,s]}},t.prototype.filter=function(){function t(t,e,i){if(this.highlightKeywords&&e){t=t.replace(b,""),t=t.replace(y,""),t=t.replace(_,""),t=t.replace(C,"");var s=t;(u.test(t)||d.test(t)||g.test(t)||m.test(t)||v.test(t))&&(s=(0,o.getText)(i)),""!==s&&this.emitter.emit("highlight-keyword",this,i,s)}}function e(t,e,i){t=(0,a.matchCase)(t,this.caseSensitive);var s=void 0,n=this.hasColDateType?this.colDateType[i]:this.defaultDateType,r=g.test(t),o=u.test(t),l=m.test(t),T=d.test(t),P=v.test(t),F=y.test(t),S=b.test(t),R=_.test(t),O=C.test(t),I=x===t,N=w===t,L=E.test(t),k=r&&(0,h.isValidDate)(t.replace(g,""),n),D=o&&(0,h.isValidDate)(t.replace(u,""),n),B=l&&(0,h.isValidDate)(t.replace(m,""),n),A=T&&(0,h.isValidDate)(t.replace(d,""),n),H=P&&(0,h.isValidDate)(t.replace(v,""),n),M=F&&(0,h.isValidDate)(t.replace(y,""),n),j=void 0,U=void 0;if((0,h.isValidDate)(e,n))j=(0,h.formatDate)(e,n),k?(U=(0,h.formatDate)(t.replace(g,""),n),s=U>j):D?(U=(0,h.formatDate)(t.replace(u,""),n),s=U>=j):A?(U=(0,h.formatDate)(t.replace(d,""),n),s=j>=U):B?(U=(0,h.formatDate)(t.replace(m,""),n),s=j>U):H?(U=(0,h.formatDate)(t.replace(v,""),n),s=j.toString()!==U.toString()):M?(U=(0,h.formatDate)(t.replace(y,""),n),s=j.toString()===U.toString()):b.test(t)?s=(0,a.contains)(t.replace(b,""),e,!1,this.caseSensitive):(0,h.isValidDate)(t,n)?(U=(0,h.formatDate)(t,n),s=j.toString()===U.toString()):s=I?(0,a.isEmpty)(e):N?!(0,a.isEmpty)(e):(0,a.contains)(t,e,this.isExactMatch(i),this.caseSensitive);else if(this.hasColNbFormat&&this.colNbFormat[i]?(c=(0,p.removeNbFormat)(e,this.colNbFormat[i]),f=this.colNbFormat[i]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(c=(0,p.removeNbFormat)(e,"us"),f="us"):(c=(0,p.removeNbFormat)(e,"eu"),f="eu"),o)s=c<=(0,p.removeNbFormat)(t.replace(u,""),f);else if(T)s=c>=(0,p.removeNbFormat)(t.replace(d,""),f);else if(r)s=c<(0,p.removeNbFormat)(t.replace(g,""),f);else if(l)s=c>(0,p.removeNbFormat)(t.replace(m,""),f);else if(P)s=!(0,a.contains)(t.replace(v,""),e,!1,this.caseSensitive);else if(S)s=(0,a.contains)(t.replace(b,""),e,!1,this.caseSensitive);else if(F)s=(0,a.contains)(t.replace(y,""),e,!0,this.caseSensitive);else if(R)s=0===e.indexOf(t.replace(_,""));else if(O){var V=t.replace(C,"");s=e.lastIndexOf(V,e.length-1)===e.length-1-(V.length-1)&&e.lastIndexOf(V,e.length-1)>-1}else if(I)s=(0,a.isEmpty)(e);else if(N)s=!(0,a.isEmpty)(e);else if(L)try{var z=t.replace(E,""),K=new RegExp(z);s=K.test(e)}catch(W){s=!1}else c&&this.hasColNbFormat&&this.colNbFormat[i]&&!this.singleSearchFlt?(t=(0,p.removeNbFormat)(t,f),s=c===t||(0,a.contains)(t.toString(),c.toString(),this.isExactMatch(i),this.caseSensitive)):s=(0,a.contains)(t,e,this.isExactMatch(i),this.caseSensitive);return s}if(this.fltGrid&&this.initialized){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,s=this.getRowsNb(!0),n=0;this.validRowsIndex=[];for(var r=this.getFiltersValue(),c=void 0,f=void 0,u=new RegExp(this.leOperator),d=new RegExp(this.geOperator),g=new RegExp(this.lwOperator),m=new RegExp(this.grOperator),v=new RegExp(this.dfOperator),b=new RegExp((0,a.rgxEsc)(this.lkOperator)),y=new RegExp(this.eqOperator),_=new RegExp(this.stOperator),C=new RegExp(this.enOperator),x=this.emOperator,w=this.nmOperator,E=new RegExp((0,a.rgxEsc)(this.rgxOperator)),T=this.refRow;s>T;T++){i[T].style.display="";var P=i[T].cells,F=P.length;if(F===this.nbCells){for(var S=[],R=!0,O=!1,I=0;F>I;I++){var N=r[this.singleSearchFlt?0:I];if(""!==N){var L=(0,a.matchCase)(this.getCellData(P[I]),this.caseSensitive),k=N.toString().split(this.orOperator),D=k.length>1,B=N.toString().split(this.anOperator),A=B.length>1;if((0,l.isArray)(N)||D||A){var H=void 0,M=void 0,j=!1;M=(0,l.isArray)(N)?N:D?k:B;for(var U=0,V=M.length;V>U&&(H=(0,a.trim)(M[U]),j=e.call(this,H,L,I),t.call(this,H,j,P[I]),!(D&&j||A&&!j))&&(!(0,l.isArray)(N)||!j);U++);S[I]=j}else S[I]=e.call(this,(0,a.trim)(N),L,I),t.call(this,N,S[I],P[I]);S[I]||(R=!1),this.singleSearchFlt&&S[I]&&(O=!0),this.emitter.emit("cell-processed",this,I,P[I])}}this.singleSearchFlt&&O&&(R=!0),R?this.validateRow(T,!0):(this.validateRow(T,!1),n++),this.emitter.emit("row-processed",this,T,this.validRowsIndex.length,R)}}this.nbHiddenRows=n,this.onAfterFilter&&this.onAfterFilter.call(null,this),this.emitter.emit("after-filtering",this,r)}},t.prototype.getColValues=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,r=this.getRowsNb(!0),o=[];e&&o.push(this.getHeadersText()[t]);for(var a=this.refRow;r>a;a++){var l=!1;s.length>0&&(l=-1!==s.indexOf(a));var h=n[a].cells,c=h.length;if(c===this.nbCells&&!l)for(var f=0;c>f;f++)if(f===t&&""===n[a].style.display){var u=this.getCellData(h[f]),d=this.colNbFormat?this.colNbFormat[t]:void 0,g=i?(0,p.removeNbFormat)(u,d):u;o.push(g)}}return o}},t.prototype.getFilterValue=function(t){if(this.fltGrid){var e="",i=this.getFilterElement(t);if(!i)return e;var s=this.getFilterType(t);return s!==F.MULTIPLE&&s!==F.CHECKLIST?e=i.value:s===F.MULTIPLE?e=this.feature("dropdown").getValues(t):s===F.CHECKLIST&&(e=this.feature("checkList").getValues(t)),((0,l.isArray)(e)&&0===e.length||1===e.length&&""===e[0])&&(e=""),e}},t.prototype.getFiltersValue=function(){if(this.fltGrid){for(var t=[],e=0,i=this.fltIds.length;i>e;e++){var s=this.getFilterValue(e);(0,l.isArray)(s)?t.push(s):t.push((0,a.trim)(s))}return t}},t.prototype.getFilterId=function(t){return this.fltGrid?this.fltIds[t]:void 0},t.prototype.getFiltersByType=function(t,e){if(this.fltGrid){for(var i=[],s=0,n=this.fltIds.length;n>s;s++){var r=this.getFilterType(s);if(r===t.toLowerCase()){var o=e?s:this.fltIds[s];i.push(o)}}return i}},t.prototype.getFilterElement=function(t){var e=this.fltIds[t];return(0,o.elm)(e)},t.prototype.getCellsNb=function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=this.tbl.rows[t];return e.cells.length},t.prototype.getRowsNb=function(t){var e=(0,l.isUndef)(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)},t.prototype.getCellData=function(t){var e=t.cellIndex;return this.customCellData&&-1!==this.customCellDataCols.indexOf(e)?this.customCellData.call(null,this,t,e):(0,o.getText)(t)},t.prototype.getTableData=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=this.getRowsNb(!0),n=[];if(t){var r=this.getHeadersText(e);n.push([this.getHeadersRowIndex(),r])}for(var o=this.refRow;s>o;o++){for(var a=[o,[]],l=i[o].cells,h=0,p=l.length;p>h;h++)if(!(e&&this.hasExtension("colsVisibility")&&this.extension("colsVisibility").isColHidden(h))){var c=this.getCellData(l[h]);a[1].push(c)}n.push(a)}return n},t.prototype.getFilteredData=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 r=this.getValidRows(!0),o=0;on;n++){var o=i[n],a=o[1],h=a[t];s.push(h)}return s},t.prototype.getRowDisplay=function(t){return t.style.display},t.prototype.validateRow=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?"":F.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))}},t.prototype.validateAllRows=function(){if(this.initialized){this.validRowsIndex=[];for(var t=this.refRow;t0,r=n?null:S.createDocumentFragment(),a=0;e>a;a++){var l=void 0;n?l=s[a]:(l=(0,o.createElm)("col",["id",this.id+"_col_"+a]),r.appendChild(l)),l.style.width=i[a]}n||t.insertBefore(r,t.firstChild)}},t.prototype.enforceVisibility=function(){if(this.hasVisibleRows)for(var t=this.getRowsNb(!0),e=0,i=this.visibleRows.length;i>e;e++){var s=this.visibleRows[e];t>=s&&this.validateRow(s,!0)}},t.prototype.clearFilters=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.filter(),this.onAfterReset&&this.onAfterReset.call(null,this),this.emitter.emit("after-clearing-filters",this)}},t.prototype.clearActiveColumns=function(){for(var t=0,e=this.getCellsNb(this.headersRow);e>t;t++)(0,o.removeClass)(this.getHeaderElement(t),this.activeColumnsCssClass)},t.prototype.markActiveColumn=function(t){var e=this.getHeaderElement(t);(0,o.hasClass)(e,this.activeColumnsCssClass)||(this.onBeforeActiveColumn&&this.onBeforeActiveColumn.call(null,this,t),(0,o.addClass)(e,this.activeColumnsCssClass),this.onAfterActiveColumn&&this.onAfterActiveColumn.call(null,this,t))},t.prototype.getActiveFilterId=function(){return this.activeFilterId},t.prototype.setActiveFilterId=function(t){this.activeFilterId=t},t.prototype.getColumnIndexFromFilterId=function(){var t=arguments.length<=0||void 0===arguments[0]?"":arguments[0],e=t.split("_")[0];return e=e.split(this.prfxFlt)[1],parseInt(e,10)},t.prototype.activateFilter=function(t){(0,l.isUndef)(t)||this.setActiveFilterId(this.getFilterId(t))},t.prototype.linkFilters=function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(F.SELECT,!0),e=this.getFiltersByType(F.MULTIPLE,!0),i=this.getFiltersByType(F.CHECKLIST,!0),s=t.concat(e);s=s.concat(i);for(var n=this.getColumnIndexFromFilterId(this.activeFilterId),r=0,a=s.length;a>r;r++){var l=(0,o.elm)(this.fltIds[s[r]]),h=this.getFilterValue(s[r]);if(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]))||h===this.displayAllText){if(this.loadFltOnDemand){var p=(0,o.createOpt)(this.displayAllText,"");l.innerHTML="",l.appendChild(p)}-1!==i.indexOf(s[r])?this.emitter.emit("build-checklist-filter",this,s[r]):this.emitter.emit("build-select-filter",this,s[r],!0),this.setFilterValue(s[r],h)}}}},t.prototype.isExactMatch=function(t){var e=this.getFilterType(t);return this.exactMatchByCol[t]||this.exactMatch||e!==F.INPUT},t.prototype.isImported=function(t){for(var e=arguments.length<=1||void 0===arguments[1]?"script":arguments[1],i=!1,s="script"===e?"src":"href",n=(0,o.tag)(S,e),r=0,a=n.length;a>r;r++)if(!(0,l.isUndef)(n[r][s])&&n[r][s].match(t)){i=!0;break}return i},t.prototype["import"]=function(t,e,i){var s=this,n=arguments.length<=3||void 0===arguments[3]?"script":arguments[3];if(!this.isImported(e,n)){var r=this,a=!1,l=void 0,h=(0,o.tag)(S,"head")[0];l="link"===n.toLowerCase()?(0,o.createElm)("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):(0,o.createElm)("script",["id",t],["type","text/javascript"],["src",e]),l.onload=l.onreadystatechange=function(){a||s.readyState&&"loaded"!==s.readyState&&"complete"!==s.readyState||(a=!0,"function"==typeof i&&i.call(null,r))},l.onerror=function(){throw new Error("TableFilter could not load: "+e)},h.appendChild(l)}},t.prototype.isInitialized=function(){return this.initialized;
+},t.prototype.getFiltersId=function(){return this.fltIds||[]},t.prototype.getValidRows=function(t){if(!t)return this.validRowsIndex;var e=this.getRowsNb(!0);this.validRowsIndex=[];for(var i=this.refRow;e>i;i++){var s=this.tbl.rows[i];this.paging?"true"!==s.getAttribute("validRow")&&null!==s.getAttribute("validRow")||this.validRowsIndex.push(s.rowIndex):this.getRowDisplay(s)!==F.NONE&&this.validRowsIndex.push(s.rowIndex)}return this.validRowsIndex},t.prototype.getFiltersRowIndex=function(){return this.filtersRowIndex},t.prototype.getHeadersRowIndex=function(){return this.headersRow},t.prototype.getStartRowIndex=function(){return this.refRow},t.prototype.getLastRowIndex=function(){var t=this.getRowsNb(!0);return t-1},t.prototype.getHeaderElement=function(t){for(var e=this.gridLayout?this.Mod.gridLayout.headTbl:this.tbl,i=(0,o.tag)(e,"thead"),s=this.headersRow,n=void 0,r=0;ri;i++)e[i]=arguments[i];var s=e[0];if(!(0,r.isString)(s))return null;for(var n=a.createElement(s),o=0;o2)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});var n=(e.isValidDate=function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!==e.length&&"DDMMMYYYY"===e){var i=n(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,r=void 0;if("Y"===e.substring(0,1)?(s=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,r=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"===e.substring(1,2)?(s=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,r=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(s=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,r=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),s.test(t)===!1&&r.test(t)===!1)return!1;var o=t.split(RegExp.$1),a=void 0,l=void 0,h=void 0;a="M"===e.substring(0,1)?o[0]:"M"===e.substring(1,2)?o[1]:o[2],l="D"===e.substring(0,1)?o[0]:"D"===e.substring(1,2)?o[1]:o[2],h="Y"===e.substring(0,1)?o[0]:"Y"===e.substring(1,2)?o[1]:o[2],parseInt(h,10)<=50&&(h=(parseInt(h,10)+2e3).toString()),parseInt(h,10)<=99&&(h=(parseInt(h,10)+1900).toString());var p=new Date(parseInt(h,10),parseInt(a,10)-1,parseInt(l,10),0,0,0,0);return parseInt(l,10)!==p.getDate()?!1:parseInt(a,10)-1===p.getMonth()},e.formatDate=function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var n=void 0,r=void 0;switch(e.toUpperCase()){case"DDMMMYYYY":r=t.replace(/[- \/.]/g," ").split(" "),n=new Date(i(r[2]),s(r[1])-1,r[0]);break;case"DMY":r=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(r[2]),r[1]-1,r[0]);break;case"MDY":r=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(r[2]),r[0]-1,r[1]);break;case"YMD":r=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(r[0]),r[1]-1,r[2]);break;default:r=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(r[2]),r[1]-1,r[0])}return n})},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.removeNbFormat=function(t){var e=arguments.length<=1||void 0===arguments[1]?"us":arguments[1];if(t){var i=t;return i="us"===e.toLowerCase()?+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")}Object.defineProperty(e,"__esModule",{value:!0});e.Emitter=function(){function t(){i(this,t),this.events={}}return t.prototype.on=function(t,e){var i=this;t.forEach(function(t){i.events[t]=i.events[t]||[],i.events[t].push(e)})},t.prototype.off=function(t,e){var i=this;t.forEach(function(t){t in i.events&&i.events[t].splice(i.events[t].indexOf(e),1)})},t.prototype.emit=function(t){if(t in this.events)for(var e=0;e0&&s.removeChild(E[0]),this.headTbl.style.tableLayout="fixed",s.style.tableLayout="fixed",this.headTbl.cellPadding=s.cellPadding,this.headTbl.cellSpacing=s.cellSpacing,e.setColWidths(this.headTbl),s.style.width="",this.headTbl.style.width=s.clientWidth+"px",(0,h.addEvt)(this.tblCont,"scroll",function(e){var i=(0,h.targetEvt)(e),s=i.scrollLeft;t.headTblCont.scrollLeft=s});var T=(i.extensions||[]).filter(function(t){return"sort"===t.name});1===T.length&&(T[0].async_sort=!0,T[0].trigger_ids=d),this.tblHasColTag=(0,a.tag)(s,"col").length>0;var P=function(){for(var t=e.nbCells-1;t>=0;t--){var i=(0,a.createElm)("col",["id",e.id+"_col_"+t]);s.insertBefore(i,s.firstChild),i.style.width=e.colWidths[t],this.colElms[t]=i}this.tblHasColTag=!0};if(this.tblHasColTag)for(var F=(0,a.tag)(s,"col"),S=0;Se;e++){var s=void 0,n=t.tbl.rows[t.getHeadersRowIndex()].cells[e];s=""!==n.width?n.width:""!==n.style.width?parseInt(n.style.width,10):this.defaultColWidth,t.colWidths[e]=s}t.hasColWidths=!0,t.setColWidths()}},e.prototype.destroy=function(){var t=this.tf,e=t.tbl;if(this.initialized){var i=(0,a.removeElm)(e);this.tblMainCont.parentNode.insertBefore(i,this.tblMainCont),(0,a.removeElm)(this.tblMainCont),this.tblMainCont=null,this.headTblCont=null,this.headTbl=null,this.tblCont=null,e.outerHTML=this.sourceTblHtml,this.tf.tbl=(0,a.elm)(t.id),this.initialized=!1}},e}(o.Feature)},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s="Not implemented.";e.Feature=function(){function t(e,s){i(this,t),this.tf=e,this.feature=s,this.enabled=e[s],this.config=e.config(),this.emitter=e.emitter,this.initialized=!1}return t.prototype.init=function(){throw new Error(s)},t.prototype.reset=function(){this.enable(),this.init()},t.prototype.destroy=function(){throw new Error(s)},t.prototype.enable=function(){this.enabled=!0},t.prototype.disable=function(){this.enabled=!1},t.prototype.isEnabled=function(){return this.enabled},t}()},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.INPUT="input",e.SELECT="select",e.MULTIPLE="multiple",e.CHECKLIST="checklist",e.NONE="none",e.ENTER_KEY=13,e.TAB_KEY=9,e.ESC_KEY=27,e.UP_ARROW_KEY=38,e.DOWN_ARROW_KEY=40,e.HEADER_TAG="TH",e.CELL_TAG="TD",e.AUTO_FILTER_DELAY=750},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.Loader=void 0;var o=i(10),a=i(3),l=i(4),h=i(2),p=i(11);e.Loader=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"loader")),o=r.config;return r.loaderTgtId=o.loader_target_id||null,r.loaderDiv=null,r.loaderText=o.loader_text||"Loading...",r.loaderHtml=o.loader_html||null,r.loaderCssClass=o.loader_css_class||"loader",r.loaderCloseDelay=250,r.onShowLoader=(0,l.isFn)(o.on_show_loader)?o.on_show_loader:null,r.onHideLoader=(0,l.isFn)(o.on_hide_loader)?o.on_hide_loader:null,r.prfxLoader="load_",r}return r(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,i=this.emitter,s=(0,a.createElm)("div",["id",this.prfxLoader+e.id]);s.className=this.loaderCssClass;var n=this.loaderTgtId?(0,a.elm)(this.loaderTgtId):e.tbl.parentNode;this.loaderTgtId?n.appendChild(s):n.insertBefore(s,e.tbl),this.loaderDiv=s,this.loaderHtml?this.loaderDiv.innerHTML=this.loaderHtml:this.loaderDiv.appendChild((0,a.createText)(this.loaderText)),this.show(p.NONE),i.on(["before-filtering","before-populating-filter","before-page-change","before-clearing-filters","before-page-length-change","before-reset-page","before-reset-page-length","before-loading-extensions","before-loading-themes"],function(){return t.show("")}),i.on(["after-filtering","after-populating-filter","after-page-change","after-clearing-filters","after-page-length-change","after-reset-page","after-reset-page-length","after-loading-extensions","after-loading-themes"],function(){return t.show(p.NONE)}),this.initialized=!0}},e.prototype.show=function(t){var e=this;if(this.isEnabled()){var i=function(){e.loaderDiv&&(e.onShowLoader&&t!==p.NONE&&e.onShowLoader.call(null,e),e.loaderDiv.style.display=t,e.onHideLoader&&t===p.NONE&&e.onHideLoader.call(null,e))},s=t===p.NONE?this.loaderCloseDelay:1;h.root.setTimeout(i,s)}},e.prototype.destroy=function(){var t=this;if(this.initialized){var e=this.emitter;(0,a.removeElm)(this.loaderDiv),this.loaderDiv=null,e.off(["before-filtering","before-populating-filter","before-page-change","before-clearing-filters","before-page-length-change","before-reset-page","before-reset-page-length","before-loading-extensions","before-loading-themes"],function(){return t.show("")}),e.off(["after-filtering","after-populating-filter","after-page-change","after-clearing-filters","after-page-length-change","after-reset-page","after-reset-page-length","after-loading-extensions","after-loading-themes"],function(){return t.show(p.NONE)}),this.initialized=!1}},e}(o.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.HighlightKeyword=void 0;var n=i(3),r=i(4);e.HighlightKeyword=function(){function t(e){s(this,t);var i=e.config();this.highlightCssClass=i.highlight_css_class||"keyword",this.tf=e,this.emitter=e.emitter}return t.prototype.init=function(){var t=this;this.emitter.on(["before-filtering","destroy"],function(){return t.unhighlightAll()}),this.emitter.on(["highlight-keyword"],function(e,i,s){return t.highlight(i,s,t.highlightCssClass)})},t.prototype.highlight=function(t,e,i){if(t.hasChildNodes)for(var s=t.childNodes,r=0;r',r.popUpDivCssClass=o.popup_div_css_class||"popUpFilter",r.onBeforePopUpOpen=(0,a.isFn)(o.on_before_popup_filter_open)?o.on_before_popup_filter_open:null,r.onAfterPopUpOpen=(0,a.isFn)(o.on_after_popup_filter_open)?o.on_after_popup_filter_open:null,r.onBeforePopUpClose=(0,a.isFn)(o.on_before_popup_filter_close)?o.on_before_popup_filter_close:null,r.onAfterPopUpClose=(0,a.isFn)(o.on_after_popup_filter_close)?o.on_after_popup_filter_close:null,r.popUpFltSpans=[],r.popUpFltImgs=[],r.popUpFltElms=r.popUpFltElmCache||[],r.popUpFltAdjustToContainer=!0,r.prfxPopUpSpan="popUpSpan_",r.prfxPopUpDiv="popUpDiv_",r}return r(e,t),e.prototype.onClick=function(t){var e=(0,h.targetEvt)(t).parentNode,i=parseInt(e.getAttribute("ci"),10);if(this.closeAll(i),this.toggle(i),this.popUpFltAdjustToContainer){var s=this.popUpFltElms[i],n=this.tf.getHeaderElement(i),r=.95*n.clientWidth;s.style.width=parseInt(r,10)+"px"}(0,h.cancelEvt)(t),(0,h.stopEvt)(t)},e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&(e.headersRow=0);for(var i=0;im;m++)if(!i.hasVisibleRows||-1===i.visibleRows.indexOf(m)){var v=r[m].cells,b=v.length;if(b===i.nbCells&&!this.isCustom)for(var y=0;b>y;y++)if(t===y&&(!e||e&&i.disableExcludedOptions)||t===y&&e&&(""===r[m].style.display&&!i.paging||i.paging&&(!i.validRowsIndex||i.validRowsIndex&&-1!==i.validRowsIndex.indexOf(m))&&(void 0===c||c===t||c!==t&&-1!==i.validRowsIndex.indexOf(m)))){var _=i.getCellData(v[y]),C=(0,h.matchCase)(_,i.caseSensitive);if((0,l.has)(this.opts,C,i.caseSensitive)||this.opts.push(_),e&&i.disableExcludedOptions){var x=g[y];x||(x=i.getFilteredDataCol(y)),(0,l.has)(x,C,i.caseSensitive)||(0,l.has)(d,C,i.caseSensitive)||d.push(_)}}}if(this.isCustom){var w=i.getCustomOptions(t);this.opts=w[0],this.optsTxt=w[1]}if(i.sortSlc&&!this.isCustom&&(i.caseSensitive?(this.opts.sort(),d&&d.sort()):(this.opts.sort(p.ignoreCase),d&&d.sort(p.ignoreCase))),-1!==i.sortNumAsc.indexOf(t))try{this.opts.sort(p.numSortAsc),d&&d.sort(p.numSortAsc),this.isCustom&&this.optsTxt.sort(p.numSortAsc)}catch(E){throw new Error(u.replace("{0}",t).replace("{1}","ascending"))}if(-1!==i.sortNumDesc.indexOf(t))try{this.opts.sort(p.numSortDesc),d&&d.sort(p.numSortDesc),this.isCustom&&this.optsTxt.sort(p.numSortDesc)}catch(E){throw new Error(u.replace("{0}",t).replace("{1}","ascending"))}this.addOptions(t,n,e,d),this.emitter.emit("after-populating-filter",i,t,n)},e.prototype.addOptions=function(t,e,i,s){var n=this.tf,r=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var o=0;or;r++)if((0,s.matchCase)(t[r].toString(),n)===e)return!0;return!1}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ignoreCase=function(t,e){var i=t.toLowerCase(),s=e.toLowerCase();return s>i?-1:i>s?1:0},e.numSortAsc=function(t,e){return t-e},e.numSortDesc=function(t,e){return e-t}},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.CheckList=void 0;var o=i(10),a=i(3),l=i(16),h=i(5),p=i(17),c=i(1),f=i(4),u=i(11),d="Filter options for column {0} cannot be sorted in {1} manner.";e.CheckList=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"checkList")),o=r.config;return r.containers=[],r.containerCssClass=o.div_checklist_css_class||"div_checklist",r.filterCssClass=o.checklist_css_class||"flt_checklist",r.itemCssClass=o.checklist_item_css_class||"flt_checklist_item",r.selectedItemCssClass=o.checklist_selected_item_css_class||"flt_checklist_slc_item",r.activateText=o.activate_checklist_text||"Click to load filter data",r.disabledItemCssClass=o.checklist_item_disabled_css_class||"flt_checklist_item_disabled",r.enableResetOption=o.enable_checklist_reset_filter!==!1,r.prfx="chkdiv_",r.isCustom=!1,r.opts=[],r.optsTxt=[],r.excludedOpts=[],r}return r(e,t),e.prototype.onChange=function(t){var e=(0,c.targetEvt)(t),i=this.tf;this.emitter.emit("filter-focus",i,e),i.filter()},e.prototype.optionClick=function(t){this.setCheckListValues(t.target),this.onChange(t)},e.prototype.onCheckListClick=function(t){var e=this,i=(0,c.targetEvt)(t);if(this.tf.loadFltOnDemand&&"0"===i.getAttribute("filled")){var s=i.getAttribute("ct"),n=this.containers[s];this.build(s),(0,c.removeEvt)(n,"click",function(t){return e.onCheckListClick(t)})}},e.prototype.init=function(t,e,i){var s=this,n=this.tf,r=e?n.externalFltTgtIds[t]:null,o=(0,a.createElm)("div",["id",this.prfx+t+"_"+n.id],["ct",t],["filled","0"]);o.className=this.containerCssClass,r?((0,a.elm)(r).appendChild(o),n.externalFltEls.push(o)):i.appendChild(o),this.containers[t]=o,n.fltIds.push(n.prfxFlt+t+"_"+n.id),n.loadFltOnDemand?((0,c.addEvt)(o,"click",function(t){return s.onCheckListClick(t)}),o.appendChild((0,a.createText)(this.activateText))):this.build(t),this.emitter.on(["build-checklist-filter"],function(t,e,i){return s.build(e,i)}),this.emitter.on(["select-checklist-options"],function(t,e,i){return s.selectOptions(e,i)}),this.initialized=!0},e.prototype.build=function(t){var e=this,i=this.tf;t=parseInt(t,10),this.emitter.emit("before-populating-filter",i,t),this.opts=[],this.optsTxt=[];var s=this.containers[t],n=(0,a.createElm)("ul",["id",i.fltIds[t]],["colIndex",t]);n.className=this.filterCssClass,(0,c.addEvt)(n,"change",function(t){return e.onChange(t)});var r=i.tbl.rows,o=i.getRowsNb(!0),f=i.caseSensitive;this.isCustom=i.isCustomOptions(t);var u=void 0,g=i.getActiveFilterId();i.linkedFilters&&g&&(u=i.getColumnIndexFromFilterId(g));var m=[];i.linkedFilters&&i.disableExcludedOptions&&(this.excludedOpts=[]),s.innerHTML="";for(var v=i.refRow;o>v;v++)if(!i.hasVisibleRows||-1===i.visibleRows.indexOf(v)){var b=r[v].cells,y=b.length;if(y===i.nbCells&&!this.isCustom)for(var _=0;y>_;_++)if(t===_&&(!i.linkedFilters||i.linkedFilters&&i.disableExcludedOptions)||t===_&&i.linkedFilters&&(""===r[v].style.display&&!i.paging||i.paging&&(!u||u===t||u!==t&&-1!==i.validRowsIndex.indexOf(v)))){var C=i.getCellData(b[_]),x=(0,h.matchCase)(C,f);(0,l.has)(this.opts,x,f)||this.opts.push(C);var w=m[_];i.linkedFilters&&i.disableExcludedOptions&&(w||(w=i.getFilteredDataCol(_)),(0,l.has)(w,x,f)||(0,l.has)(this.excludedOpts,x,f)||this.excludedOpts.push(C))}}if(this.isCustom){var E=i.getCustomOptions(t);this.opts=E[0],this.optsTxt=E[1]}if(i.sortSlc&&!this.isCustom&&(f?(this.opts.sort(),this.excludedOpts&&this.excludedOpts.sort()):(this.opts.sort(p.ignoreCase),this.excludedOpts&&this.excludedOpts.sort(p.ignoreCase))),-1!==i.sortNumAsc.indexOf(t))try{this.opts.sort(p.numSortAsc),this.excludedOpts&&this.excludedOpts.sort(p.numSortAsc),this.isCustom&&this.optsTxt.sort(p.numSortAsc)}catch(T){throw new Error(d.replace("{0}",t).replace("{1}","ascending"))}if(-1!==i.sortNumDesc.indexOf(t))try{this.opts.sort(p.numSortDesc),this.excludedOpts&&this.excludedOpts.sort(p.numSortDesc),this.isCustom&&this.optsTxt.sort(p.numSortDesc)}catch(T){throw new Error(d.replace("{0}",t).replace("{1}","descending"))}this.addChecks(t,n),i.loadFltOnDemand&&(s.innerHTML=""),s.appendChild(n),s.setAttribute("filled","1"),this.emitter.emit("after-populating-filter",i,t,s)},e.prototype.addChecks=function(t,e){for(var i=this,s=this.tf,n=this.addTChecks(t,e),r=0;rr;r++){var o=(0,a.tag)(s,"li")[r],p=(0,a.tag)(o,"label")[0],c=(0,a.tag)(o,"input")[0],f=(0,h.matchCase)((0,a.getText)(p),i.caseSensitive);""!==f&&(0,l.has)(e,f,i.caseSensitive)?c.checked=!0:-1!==e.indexOf(i.nmOperator)&&f===(0,h.matchCase)(i.nonEmptyText,i.caseSensitive)?c.checked=!0:-1!==e.indexOf(i.emOperator)&&f===(0,h.matchCase)(i.emptyText,i.caseSensitive)?c.checked=!0:c.checked=!1,this.setCheckListValues(c)}}},e.prototype.getValues=function(t){var e=this.tf,i=e.getFilterElement(t),s=i.getAttribute("value"),n=(0,f.isEmpty)(s)?"":s;return n=n.substr(0,n.length-3),n=n.split(" "+e.orOperator+" ")},e.prototype.destroy=function(){var t=this;this.emitter.off(["build-checklist-filter"],function(e,i,s){return t.build(i,s)}),this.emitter.off(["select-checklist-options"],function(e,i,s){return t.selectOptions(i,s)})},e}(o.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.RowsCounter=void 0;var o=i(10),a=i(3),l=i(4);e.RowsCounter=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"rowsCounter")),o=r.config;return r.rowsCounterTgtId=o.rows_counter_target_id||null,r.rowsCounterDiv=null,r.rowsCounterSpan=null,r.rowsCounterText=o.rows_counter_text||"Rows: ",r.fromToTextSeparator=o.from_to_text_separator||"-",r.overText=o.over_text||" / ",r.totRowsCssClass=o.tot_rows_css_class||"tot",r.prfxCounter="counter_",r.prfxTotRows="totrows_span_",r.prfxTotRowsTxt="totRowsTextSpan_",r.onBeforeRefreshCounter=(0,l.isFn)(o.on_before_refresh_counter)?o.on_before_refresh_counter:null,r.onAfterRefreshCounter=(0,l.isFn)(o.on_after_refresh_counter)?o.on_after_refresh_counter:null,r}return r(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,i=(0,a.createElm)("div",["id",this.prfxCounter+e.id]);i.className=this.totRowsCssClass;var s=(0,a.createElm)("span",["id",this.prfxTotRows+e.id]),n=(0,a.createElm)("span",["id",this.prfxTotRowsTxt+e.id]);n.appendChild((0,a.createText)(this.rowsCounterText)),this.rowsCounterTgtId||e.setToolbar();var r=this.rowsCounterTgtId?(0,a.elm)(this.rowsCounterTgtId):e.lDiv;this.rowsCounterTgtId?(r.appendChild(n),r.appendChild(s)):(i.appendChild(n),i.appendChild(s),r.appendChild(i)),this.rowsCounterDiv=i,this.rowsCounterSpan=s,this.emitter.on(["after-filtering","grouped-by-page"],function(){return t.refresh(e.getValidRowsNb())}),this.emitter.on(["rows-changed"],function(){return t.refresh()}),this.initialized=!0,this.refresh()}},e.prototype.refresh=function(t){if(this.initialized&&this.isEnabled()){var e=this.tf;this.onBeforeRefreshCounter&&this.onBeforeRefreshCounter.call(null,e,this.rowsCounterSpan);var i;if(e.paging){var s=e.feature("paging");if(s){var n=parseInt(s.startPagingRow,10)+(e.getValidRowsNb()>0?1:0),r=n+s.pagingLength-1<=e.getValidRowsNb()?n+s.pagingLength-1:e.getValidRowsNb();i=n+this.fromToTextSeparator+r+this.overText+e.getValidRowsNb()}}else i=t&&""!==t?t:e.getFilterableRowsNb()-e.nbHiddenRows;this.rowsCounterSpan.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,i)}},e.prototype.destroy=function(){var t=this;this.initialized&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?(0,a.removeElm)(this.rowsCounterDiv):(0,a.elm)(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.getValidRowsNb())}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)},e}(o.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.StatusBar=void 0;var o=i(10),a=i(2),l=i(3),h=i(4);e.StatusBar=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"statusBar")),o=r.config;return r.statusBarTgtId=o.status_bar_target_id||null,r.statusBarDiv=null,r.statusBarSpan=null,r.statusBarSpanText=null,r.statusBarText=o.status_bar_text||"",r.statusBarCssClass=o.status_bar_css_class||"status",r.statusBarCloseDelay=250,r.onBeforeShowMsg=(0,h.isFn)(o.on_before_show_msg)?o.on_before_show_msg:null,r.onAfterShowMsg=(0,h.isFn)(o.on_after_show_msg)?o.on_after_show_msg:null,r.msgFilter=o.msg_filter||"Filtering data...",r.msgPopulate=o.msg_populate||"Populating filter...",r.msgPopulateCheckList=o.msg_populate_checklist||"Populating list...",r.msgChangePage=o.msg_change_page||"Collecting paging data...",r.msgClear=o.msg_clear||"Clearing filters...",r.msgChangeResults=o.msg_change_results||"Changing results per page...",r.msgResetPage=o.msg_reset_page||"Re-setting page...",r.msgResetPageLength=o.msg_reset_page_length||"Re-setting page length...",r.msgSort=o.msg_sort||"Sorting data...",r.msgLoadExtensions=o.msg_load_extensions||"Loading extensions...",r.msgLoadThemes=o.msg_load_themes||"Loading theme(s)...",r.prfxStatus="status_",r.prfxStatusSpan="statusSpan_",r.prfxStatusTxt="statusText_",r}return r(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,i=this.emitter,s=(0,l.createElm)("div",["id",this.prfxStatus+e.id]);s.className=this.statusBarCssClass;var n=(0,l.createElm)("span",["id",this.prfxStatusSpan+e.id]),r=(0,l.createElm)("span",["id",this.prfxStatusTxt+e.id]);r.appendChild((0,l.createText)(this.statusBarText)),this.statusBarTgtId||e.setToolbar();var o=this.statusBarTgtId?(0,l.elm)(this.statusBarTgtId):e.lDiv;this.statusBarTgtId?(o.appendChild(r),o.appendChild(n)):(s.appendChild(r),s.appendChild(n),o.appendChild(s)),this.statusBarDiv=s,this.statusBarSpan=n,this.statusBarSpanText=r,i.on(["before-filtering"],function(){return t.message(t.msgFilter)}),i.on(["before-populating-filter"],function(){return t.message(t.msgPopulate)}),i.on(["before-page-change"],function(){return t.message(t.msgChangePage)}),i.on(["before-clearing-filters"],function(){return t.message(t.msgClear)}),i.on(["before-page-length-change"],function(){return t.message(t.msgChangeResults)}),i.on(["before-reset-page"],function(){return t.message(t.msgResetPage)}),i.on(["before-reset-page-length"],function(){return t.message(t.msgResetPageLength)}),i.on(["before-loading-extensions"],function(){return t.message(t.msgLoadExtensions)}),i.on(["before-loading-themes"],function(){return t.message(t.msgLoadThemes)}),i.on(["after-filtering","after-populating-filter","after-page-change","after-clearing-filters","after-page-length-change","after-reset-page","after-reset-page-length","after-loading-extensions","after-loading-themes"],function(){return t.message("")}),this.initialized=!0}},e.prototype.message=function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?"":arguments[0];if(this.isEnabled()){this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,e);var i=""===e?this.statusBarCloseDelay:1;a.root.setTimeout(function(){t.initialized&&(t.statusBarSpan.innerHTML=e,t.onAfterShowMsg&&t.onAfterShowMsg.call(null,t.tf,e))},i)}},e.prototype.destroy=function(){var t=this;if(this.initialized){var e=this.emitter;this.statusBarDiv.innerHTML="",this.statusBarTgtId||(0,l.removeElm)(this.statusBarDiv),this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarDiv=null,e.off(["before-filtering"],function(){return t.message(t.msgFilter)}),e.off(["before-populating-filter"],function(){return t.message(t.msgPopulate)}),e.off(["before-page-change"],function(){return t.message(t.msgChangePage)}),e.off(["before-clearing-filters"],function(){return t.message(t.msgClear)}),e.off(["before-page-length-change"],function(){return t.message(t.msgChangeResults)}),e.off(["before-reset-page"],function(){return t.message(t.msgResetPage)}),e.off(["before-reset-page-length"],function(){return t.message(t.msgResetPageLength)}),e.off(["before-loading-extensions"],function(){return t.message(t.msgLoadExtensions)}),e.off(["before-loading-themes"],function(){return t.message(t.msgLoadThemes)}),e.off(["after-filtering","after-populating-filter","after-page-change","after-clearing-filters","after-page-length-change","after-reset-page","after-reset-page-length","after-loading-extensions","after-loading-themes"],function(){return t.message("")}),this.initialized=!1}},e}(o.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.Paging=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},a=i(10),l=i(3),h=i(4),p=i(1),c=i(11);e.Paging=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"paging")),o=r.config;r.btnPageCssClass=o.paging_btn_css_class||"pgInp",r.pagingSlc=null,r.resultsPerPageSlc=null,r.pagingTgtId=o.paging_target_id||null,r.pagingLength=isNaN(o.paging_length)?10:o.paging_length,r.resultsPerPageTgtId=o.results_per_page_target_id||null,r.pgSlcCssClass=o.paging_slc_css_class||"pgSlc",r.pgInpCssClass=o.paging_inp_css_class||"pgNbInp",r.resultsPerPage=o.results_per_page||null,r.hasResultsPerPage=(0,h.isArray)(r.resultsPerPage),r.resultsSlcCssClass=o.results_slc_css_class||"rspg",r.resultsSpanCssClass=o.results_span_css_class||"rspgSpan",r.startPagingRow=0,r.nbPages=0,r.currentPageNb=1,r.btnNextPageText=o.btn_next_page_text||">",r.btnPrevPageText=o.btn_prev_page_text||"<",r.btnLastPageText=o.btn_last_page_text||">|",r.btnFirstPageText=o.btn_first_page_text||"|<",r.btnNextPageHtml=o.btn_next_page_html||(i.enableIcons?'':null),r.btnPrevPageHtml=o.btn_prev_page_html||(i.enableIcons?'':null),r.btnFirstPageHtml=o.btn_first_page_html||(i.enableIcons?'':null),r.btnLastPageHtml=o.btn_last_page_html||(i.enableIcons?'':null),r.pageText=o.page_text||" Page ",r.ofText=o.of_text||" of ",r.nbPgSpanCssClass=o.nb_pages_css_class||"nbpg",r.hasPagingBtns=o.paging_btns!==!1,r.pageSelectorType=o.page_selector_type||c.SELECT,r.onBeforeChangePage=(0,h.isFn)(o.on_before_change_page)?o.on_before_change_page:null,r.onAfterChangePage=(0,h.isFn)(o.on_after_change_page)?o.on_after_change_page:null,r.prfxSlcPages="slcPages_",r.prfxSlcResults="slcResults_",r.prfxSlcResultsTxt="slcResultsTxt_",r.prfxBtnNextSpan="btnNextSpan_",r.prfxBtnPrevSpan="btnPrevSpan_",r.prfxBtnLastSpan="btnLastSpan_",r.prfxBtnFirstSpan="btnFirstSpan_",r.prfxBtnNext="btnNext_",r.prfxBtnPrev="btnPrev_",r.prfxBtnLast="btnLast_",r.prfxBtnFirst="btnFirst_",r.prfxPgSpan="pgspan_",r.prfxPgBeforeSpan="pgbeforespan_",r.prfxPgAfterSpan="pgafterspan_";var a=i.refRow,l=i.getRowsNb(!0);r.nbPages=Math.ceil((l-a)/r.pagingLength);var f=r;return r.evt={slcIndex:function(){return f.pageSelectorType===c.SELECT?f.pagingSlc.options.selectedIndex:parseInt(f.pagingSlc.value,10)-1},nbOpts:function(){return f.pageSelectorType===c.SELECT?parseInt(f.pagingSlc.options.length,10)-1:f.nbPages-1},next:function(){var t=f.evt.slcIndex()0?f.evt.slcIndex()-1:f.evt.nbOpts();f.changePage(t)},last:function(){f.changePage(f.evt.nbOpts())},first:function(){f.changePage(0)},_detectKey:function(t){var e=(0,p.keyCode)(t);e===c.ENTER_KEY&&(i.sorted?(i.filter(),f.changePage(f.evt.slcIndex())):f.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},r}return r(e,t),e.prototype.init=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===c.SELECT&&(t=(0,l.createElm)(c.SELECT,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,(0,p.addEvt)(t,"change",s.slcPagesChange)),this.pageSelectorType===c.INPUT&&(t=(0,l.createElm)(c.INPUT,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,(0,p.addEvt)(t,"keypress",s._detectKey));var n=(0,l.createElm)("span",["id",this.prfxBtnNextSpan+i.id]),r=(0,l.createElm)("span",["id",this.prfxBtnPrevSpan+i.id]),o=(0,l.createElm)("span",["id",this.prfxBtnLastSpan+i.id]),a=(0,l.createElm)("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)n.innerHTML=this.btnNextPageHtml,(0,p.addEvt)(n,"click",s.next);else{var h=(0,l.createElm)(c.INPUT,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);h.className=this.btnPageCssClass,(0,p.addEvt)(h,"click",s.next),n.appendChild(h)}if(this.btnPrevPageHtml)r.innerHTML=this.btnPrevPageHtml,(0,p.addEvt)(r,"click",s.prev);else{var f=(0,l.createElm)(c.INPUT,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);f.className=this.btnPageCssClass,(0,p.addEvt)(f,"click",s.prev),r.appendChild(f)}if(this.btnLastPageHtml)o.innerHTML=this.btnLastPageHtml,(0,p.addEvt)(o,"click",s.last);else{var u=(0,l.createElm)(c.INPUT,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);u.className=this.btnPageCssClass,(0,p.addEvt)(u,"click",s.last),o.appendChild(u)}if(this.btnFirstPageHtml)a.innerHTML=this.btnFirstPageHtml,(0,p.addEvt)(a,"click",s.first);else{var d=(0,l.createElm)(c.INPUT,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);d.className=this.btnPageCssClass,(0,p.addEvt)(d,"click",s.first),a.appendChild(d)}}this.pagingTgtId||i.setToolbar();var g=this.pagingTgtId?(0,l.elm)(this.pagingTgtId):i.mDiv;g.appendChild(a),g.appendChild(r);var m=(0,l.createElm)("span",["id",this.prfxPgBeforeSpan+i.id]);m.appendChild((0,l.createText)(this.pageText)),m.className=this.nbPgSpanCssClass,g.appendChild(m),g.appendChild(t);var v=(0,l.createElm)("span",["id",this.prfxPgAfterSpan+i.id]);v.appendChild((0,l.createText)(this.ofText)),v.className=this.nbPgSpanCssClass,g.appendChild(v);var b=(0,l.createElm)("span",["id",this.prfxPgSpan+i.id]);b.className=this.nbPgSpanCssClass,b.appendChild((0,l.createText)(" "+this.nbPages+" ")),g.appendChild(b),g.appendChild(n),g.appendChild(o),this.pagingSlc=(0,l.elm)(this.prfxSlcPages+i.id),this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["change-page"],function(t,i){return e.setPage(i)}),this.emitter.on(["change-page-results"],function(t,i){return e.changeResultsPerPage(i)}),this.initialized=!0}},e.prototype.reset=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())},e.prototype.resetPagingInfo=function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)},e.prototype.setPagingInfo=function(t){var e=this.tf,i=this.pagingTgtId?(0,l.elm)(this.pagingTgtId):e.mDiv,s=(0,l.elm)(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===c.SELECT&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===c.SELECT)for(var n=0;nr;r++){var a=e.validRowsIndex[r],l=i[a],p=l.getAttribute("validRow"),f=!1;r>=s&&n>r?((0,h.isNull)(p)||Boolean("true"===p))&&(l.style.display="",f=!0):l.style.display=c.NONE,this.emitter.emit("row-paged",e,a,r,f)}this.emitter.emit("grouped-by-page",e,this)},e.prototype.getPage=function(){return this.currentPageNb},e.prototype.setPage=function(t){var e=this.tf;if(e.isInitialized()&&this.isEnabled()){var i=this.evt,s="undefined"==typeof t?"undefined":o(t);if("string"===s)switch(t.toLowerCase()){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)}},e.prototype.setResultsPerPage=function(){var t=this,e=this.tf,i=this.evt;if(!this.resultsPerPageSlc&&this.resultsPerPage){i.slcResultsChange=function(e){t.onChangeResultsPerPage(),e.target.blur()};var s=(0,l.createElm)(c.SELECT,["id",this.prfxSlcResults+e.id]);s.className=this.resultsSlcCssClass;var n=this.resultsPerPage[0],r=this.resultsPerPage[1],o=(0,l.createElm)("span",["id",this.prfxSlcResultsTxt+e.id]);o.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var a=this.resultsPerPageTgtId?(0,l.elm)(this.resultsPerPageTgtId):e.rDiv;o.appendChild((0,l.createText)(n));var h=e.feature("help");h&&h.btn?(h.btn.parentNode.insertBefore(o,h.btn),h.btn.parentNode.insertBefore(s,h.btn)):(a.appendChild(o),a.appendChild(s));for(var f=0;f=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t+1),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===c.SELECT?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,this.startPagingRow=this.pageSelectorType===c.SELECT?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t+1)),this.emitter.emit("after-page-change",e,t+1))},e.prototype.changeResultsPerPage=function(t){this.isEnabled()&&!isNaN(t)&&(this.resultsPerPageSlc.value=t,this.onChangeResultsPerPage())},e.prototype.onChangeResultsPerPage=function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-page-length-change",t);var e=this.resultsPerPageSlc,i=e.selectedIndex,s=this.pageSelectorType===c.SELECT?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[i].value,10),this.startPagingRow=this.pagingLength*s,!isNaN(this.pagingLength)&&(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===c.SELECT)){var n=this.pagingSlc.options.length-1<=s?this.pagingSlc.options.length-1:s;this.pagingSlc.options[n].selected=!0}this.emitter.emit("after-page-length-change",t,this.pagingLength)}},e.prototype.resetPage=function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",t);var e=t.feature("store").getPageNb();""!==e&&this.changePage(e-1),this.emitter.emit("after-reset-page",t,e)}},e.prototype.resetPageLength=function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",t);var e=t.feature("store").getPageLength();""!==e&&(this.resultsPerPageSlc.options[e].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",t,e)}},e.prototype.destroy=function(){var t=this,e=this.tf;if(this.initialized){var i=(0,l.elm)(this.prfxBtnNextSpan+e.id),s=(0,l.elm)(this.prfxBtnPrevSpan+e.id),n=(0,l.elm)(this.prfxBtnLastSpan+e.id),r=(0,l.elm)(this.prfxBtnFirstSpan+e.id),o=(0,l.elm)(this.prfxPgBeforeSpan+e.id),a=(0,l.elm)(this.prfxPgAfterSpan+e.id),h=(0,l.elm)(this.prfxPgSpan+e.id),f=this.evt;this.pagingSlc&&(this.pageSelectorType===c.SELECT?(0,p.removeEvt)(this.pagingSlc,"change",f.slcPagesChange):this.pageSelectorType===c.INPUT&&(0,p.removeEvt)(this.pagingSlc,"keypress",f._detectKey),(0,l.removeElm)(this.pagingSlc)),i&&((0,p.removeEvt)(i,"click",f.next),(0,l.removeElm)(i)),s&&((0,p.removeEvt)(s,"click",f.prev),(0,l.removeElm)(s)),n&&((0,p.removeEvt)(n,"click",f.last),(0,l.removeElm)(n)),r&&((0,p.removeEvt)(r,"click",f.first),(0,l.removeElm)(r)),o&&(0,l.removeElm)(o),a&&(0,l.removeElm)(a),h&&(0,l.removeElm)(h),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["change-page"],function(e,i){return t.setPage(i)}),this.emitter.off(["change-page-results"],function(e,i){return t.changeResultsPerPage(i)}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}},e}(a.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.ClearButton=void 0;var o=i(10),a=i(3),l=i(1);e.ClearButton=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"btnReset")),o=r.config;return r.btnResetTgtId=o.btn_reset_target_id||null,r.btnResetEl=null,r.btnResetText=o.btn_reset_text||"Reset",r.btnResetTooltip=o.btn_reset_tooltip||"Clear filters",r.btnResetHtml=o.btn_reset_html||(i.enableIcons?'':null),r.prfxResetSpan="resetspan_",r}return r(e,t),e.prototype.onClick=function(){this.isEnabled()&&this.tf.clearFilters()},e.prototype.init=function(){var t=this,e=this.tf;
+if(!this.initialized){var i=(0,a.createElm)("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var s=this.btnResetTgtId?(0,a.elm)(this.btnResetTgtId):e.rDiv;if(s.appendChild(i),this.btnResetHtml){i.innerHTML=this.btnResetHtml;var n=i.firstChild;(0,l.addEvt)(n,"click",function(){return t.onClick()})}else{var r=(0,a.createElm)("a",["href","javascript:voelm(0);"]);r.className=e.btnResetCssClass,r.appendChild((0,a.createText)(this.btnResetText)),i.appendChild(r),(0,l.addEvt)(r,"click",function(){return t.onClick()})}this.btnResetEl=i.firstChild,this.initialized=!0}},e.prototype.destroy=function(){var t=this.tf;if(this.initialized){var e=(0,a.elm)(this.prfxResetSpan+t.id);e&&(0,a.removeElm)(e),this.btnResetEl=null,this.initialized=!1}},e}(o.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.Help=void 0;var o=i(10),a=i(3),l=i(1),h=i(11),p="https://github.com/koalyptus/TableFilter/wiki/4.-Filter-operators",c="http://koalyptus.github.io/TableFilter/";e.Help=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"help")),o=r.config;return r.tgtId=o.help_instructions_target_id||null,r.contTgtId=o.help_instructions_container_target_id||null,r.instrText=o.help_instructions_text?o.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
',r.instrHtml=o.help_instructions_html||null,r.btnText=o.help_instructions_btn_text||"?",r.btnHtml=o.help_instructions_btn_html||null,r.btnCssClass=o.help_instructions_btn_css_class||"helpBtn",r.contCssClass=o.help_instructions_container_css_class||"helpCont",r.btn=null,r.cont=null,r.defaultHtml='',r.prfxHelpSpan="helpSpan_",r.prfxHelpDiv="helpDiv_",r.emitter.on(["init-help"],function(){return r.init()}),r}return r(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,i=(0,a.createElm)("span",["id",this.prfxHelpSpan+e.id]),s=(0,a.createElm)("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var n=this.tgtId?(0,a.elm)(this.tgtId):e.rDiv;n.appendChild(i);var r=this.contTgtId?(0,a.elm)(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var o=i.firstChild;(0,l.addEvt)(o,"click",function(){return t.toggle()}),r.appendChild(s)}else{r.appendChild(s);var h=(0,a.createElm)("a",["href","javascript:void(0);"]);h.className=this.btnCssClass,h.appendChild((0,a.createText)(this.btnText)),i.appendChild(h),(0,l.addEvt)(h,"click",function(){return t.toggle()})}this.instrHtml?(this.contTgtId&&r.appendChild(s),s.innerHTML=this.instrHtml,this.contTgtId||(s.className=this.contCssClass,(0,l.addEvt)(s,"dblclick",function(){return t.toggle()}))):(s.innerHTML=this.instrText,s.className=this.contCssClass,(0,l.addEvt)(s,"dblclick",function(){return t.toggle()})),s.innerHTML+=this.defaultHtml,(0,l.addEvt)(s,"click",function(){return t.toggle()}),this.cont=s,this.btn=i,this.initialized=!0}},e.prototype.toggle=function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||t===h.NONE?this.cont.style.display="inline":this.cont.style.display=h.NONE}},e.prototype.destroy=function(){this.initialized&&((0,a.removeElm)(this.btn),this.btn=null,this.cont&&((0,a.removeElm)(this.cont),this.cont=null,this.initialized=!1))},e}(o.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.AlternateRows=void 0;var o=i(10),a=i(3);e.AlternateRows=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"alternateRows")),o=r.config;return r.evenCss=o.even_row_css_class||"even",r.oddCss=o.odd_row_css_class||"odd",r}return r(e,t),e.prototype.init=function(){var t=this;this.initialized||(this.processAll(),this.emitter.on(["row-processed","row-paged"],function(e,i,s,n){return t.processRow(i,s,n)}),this.emitter.on(["column-sorted"],function(){return t.processAll()}),this.initialized=!0)},e.prototype.processAll=function(){if(this.isEnabled())for(var t=this.tf,e=t.getValidRows(!0),i=e.length,s=0,n=0;i>n;n++){var r=e[n];this.setRowBg(r,s),s++}},e.prototype.processRow=function(t,e,i){i?this.setRowBg(t,e):this.removeRowBg(t)},e.prototype.setRowBg=function(t,e){if(this.isEnabled()&&!isNaN(t)){var i=this.tf.tbl.rows,s=isNaN(e)?t:e;this.removeRowBg(t),(0,a.addClass)(i[t],s%2?this.evenCss:this.oddCss)}},e.prototype.removeRowBg=function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;(0,a.removeClass)(e[t],this.oddCss),(0,a.removeClass)(e[t],this.evenCss)}},e.prototype.destroy=function(){var t=this;if(this.initialized){for(var e=this.tf.getRowsNb(!0),i=0;e>i;i++)this.removeRowBg(i);this.emitter.off(["row-processed","row-paged"],function(e,i,s,n){return t.processRow(i,s,n)}),this.emitter.off(["column-sorted"],function(){return t.processAll()}),this.initialized=!1}},e}(o.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.NoResults=void 0;var o=i(10),a=i(3),l=i(4),h=i(11);e.NoResults=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"noResults")),o=r.config.no_results_message;return r.content=o.content||"No results",r.customContainer=o.custom_container||null,r.customContainerId=o.custom_container_id||null,r.isExternal=!(0,l.isEmpty)(r.customContainer)||!(0,l.isEmpty)(r.customContainerId),r.cssClass=o.css_class||"no-results",r.cont=null,r.onBeforeShowMsg=(0,l.isFn)(o.on_before_show_msg)?o.on_before_show_msg:null,r.onAfterShowMsg=(0,l.isFn)(o.on_after_show_msg)?o.on_after_show_msg:null,r.onBeforeHideMsg=(0,l.isFn)(o.on_before_hide_msg)?o.on_before_hide_msg:null,r.onAfterHideMsg=(0,l.isFn)(o.on_after_hide_msg)?o.on_after_hide_msg:null,r.prfxNoResults="nores_",r}return r(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,i=this.customContainer||(0,a.elm)(this.customContainerId)||e.tbl,s=(0,a.createElm)("div",["id",this.prfxNoResults+e.id]);s.className=this.cssClass,s.innerHTML=this.content,this.isExternal?i.appendChild(s):i.parentNode.insertBefore(s,i.nextSibling),this.cont=s,this.emitter.on(["after-filtering"],function(){return t.toggle()}),this.initialized=!0,this.hide()}},e.prototype.toggle=function(){this.tf.getValidRowsNb()>0?this.hide():this.show()},e.prototype.show=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))},e.prototype.hide=function(){this.initialized&&this.isEnabled()&&(this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this),this.cont.style.display=h.NONE,this.onBeforeHideMsg&&this.onBeforeHideMsg.call(null,this.tf,this))},e.prototype.setWidth=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"},e.prototype.destroy=function(){var t=this;this.initialized&&((0,a.removeElm)(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)},e}(o.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.State=void 0;var o=i(10),a=i(27),l=i(28),h=i(5),p=i(4);e.State=function(t){function e(i){s(this,e);var r=n(this,t.call(this,i,"state")),o=r.config.state;return r.enableHash=o===!0||(0,p.isArray)(o.types)&&-1!==o.types.indexOf("hash"),r.enableLocalStorage=(0,p.isArray)(o.types)&&-1!==o.types.indexOf("local_storage"),r.enableCookie=(0,p.isArray)(o.types)&&-1!==o.types.indexOf("cookie"),r.persistFilters=o.filters!==!1,r.persistPageNumber=Boolean(o.page_number),r.persistPageLength=Boolean(o.page_length),r.persistSort=Boolean(o.sort),r.persistColsVisibility=Boolean(o.columns_visibility),r.persistFiltersVisibility=Boolean(o.filters_visibility),r.cookieDuration=isNaN(o.cookie_duration)?87600:parseInt(o.cookie_duration,10),r.enableStorage=r.enableLocalStorage||r.enableCookie,r.hash=null,r.pageNb=null,r.pageLength=null,r.sort=null,r.hiddenCols=null,r.filtersVisibility=null,r.state={},r.prfxCol="col_",r.pageNbKey="page",r.pageLengthKey="page_length",r.filtersVisKey="filters_visibility",r}return r(e,t),e.prototype.init=function(){var t=this;this.initialized||(this.emitter.on(["after-filtering"],function(){return t.update()}),this.emitter.on(["after-page-change","after-clearing-filters"],function(e,i){return t.updatePage(i)}),this.emitter.on(["after-page-length-change"],function(e,i){return t.updatePageLength(i)}),this.emitter.on(["column-sorted"],function(e,i,s){return t.updateSort(i,s)}),this.emitter.on(["sort-initialized"],function(){return t._syncSort()}),this.emitter.on(["columns-visibility-initialized"],function(){return t._syncColsVisibility()}),this.emitter.on(["column-shown","column-hidden"],function(e,i,s,n){return t.updateColsVisibility(n)}),this.emitter.on(["filters-visibility-initialized"],function(){return t._syncFiltersVisibility()}),this.emitter.on(["filters-toggled"],function(e,i,s){return t.updateFiltersVisibility(s)}),this.enableHash&&(this.hash=new a.Hash(this),this.hash.init()),this.enableStorage&&(this.storage=new l.Storage(this),this.storage.init()),this.initialized=!0)},e.prototype.update=function(){var t=this;if(this.isEnabled()){var e=this.state,i=this.tf;if(this.persistFilters){var s=i.getFiltersValue();s.forEach(function(i,s){var n=""+t.prfxCol+s;(0,p.isString)(i)&&(0,h.isEmpty)(i)?e.hasOwnProperty(n)&&(e[n].flt=void 0):(e[n]=e[n]||{},e[n].flt=i)})}if(this.persistPageNumber&&((0,p.isNull)(this.pageNb)?e[this.pageNbKey]=void 0:e[this.pageNbKey]=this.pageNb),this.persistPageLength&&((0,p.isNull)(this.pageLength)?e[this.pageLengthKey]=void 0:e[this.pageLengthKey]=this.pageLength),this.persistSort&&!(0,p.isNull)(this.sort)){Object.keys(e).forEach(function(i){-1!==i.indexOf(t.prfxCol)&&e[i]&&(e[i].sort=void 0)});var n=""+this.prfxCol+this.sort.column;e[n]=e[n]||{},e[n].sort={descending:this.sort.descending}}this.persistColsVisibility&&((0,p.isNull)(this.hiddenCols)||(Object.keys(e).forEach(function(i){-1!==i.indexOf(t.prfxCol)&&e[i]&&(e[i].hidden=void 0)}),this.hiddenCols.forEach(function(i){var s=""+t.prfxCol+i;e[s]=e[s]||{},e[s].hidden=!0}))),this.persistFiltersVisibility&&((0,p.isNull)(this.filtersVisibility)?e[this.filtersVisKey]=void 0:e[this.filtersVisKey]=this.filtersVisibility),this.emitter.emit("state-changed",i,e)}},e.prototype.updatePage=function(t){this.pageNb=t,this.update()},e.prototype.updatePageLength=function(t){this.pageLength=t,this.update()},e.prototype.updateSort=function(t,e){this.sort={column:t,descending:e},this.update()},e.prototype.updateColsVisibility=function(t){this.hiddenCols=t,this.update()},e.prototype.updateFiltersVisibility=function(t){this.filtersVisibility=t,this.update()},e.prototype.override=function(t){this.state=t},e.prototype.sync=function(){var t=this.state,e=this.tf;if(this._syncFilters(),this.persistPageNumber){var i=t[this.pageNbKey];this.emitter.emit("change-page",e,i)}if(this.persistPageLength){var s=t[this.pageLengthKey];this.emitter.emit("change-page-results",e,s)}this._syncSort(),this._syncColsVisibility(),this._syncFiltersVisibility()},e.prototype.overrideAndSync=function(t){this.disable(),this.override(t),this.sync(),this.enable()},e.prototype._syncFilters=function(){var t=this;if(this.persistFilters){var e=this.state,i=this.tf;Object.keys(e).forEach(function(s){if(-1!==s.indexOf(t.prfxCol)){var n=parseInt(s.replace(t.prfxCol,""),10),r=e[s].flt;i.setFilterValue(n,r)}}),i.filter()}},e.prototype._syncSort=function(){var t=this;if(this.persistSort){var e=this.state,i=this.tf;Object.keys(e).forEach(function(s){if(-1!==s.indexOf(t.prfxCol)){var n=parseInt(s.replace(t.prfxCol,""),10);if(!(0,p.isUndef)(e[s].sort)){var r=e[s].sort;t.emitter.emit("sort",i,n,r.descending)}}})}},e.prototype._syncColsVisibility=function(){var t=this;if(this.persistColsVisibility){var e=this.state,i=this.tf,s=[];Object.keys(e).forEach(function(i){if(-1!==i.indexOf(t.prfxCol)){var n=parseInt(i.replace(t.prfxCol,""),10);(0,p.isUndef)(e[i].hidden)||s.push(n)}}),s.forEach(function(e){t.emitter.emit("hide-column",i,e)})}},e.prototype._syncFiltersVisibility=function(){if(this.persistFiltersVisibility){var t=this.state,e=this.tf,i=t[this.filtersVisKey];this.filtersVisibility=i,this.emitter.emit("show-filters",e,i)}},e.prototype.destroy=function(){var t=this;this.initialized&&(this.state={},this.emitter.off(["after-filtering"],function(){return t.update()}),this.emitter.off(["after-page-change","after-clearing-filters"],function(e,i){return t.updatePage(i)}),this.emitter.off(["after-page-length-change"],function(e,i){return t.updatePageLength(i)}),this.emitter.off(["column-sorted"],function(e,i,s){return t.updateSort(i,s)}),this.emitter.off(["sort-initialized"],function(){return t._syncSort()}),this.emitter.off(["columns-visibility-initialized"],function(){return t._syncColsVisibility()}),this.emitter.off(["column-shown","column-hidden"],function(e,i,s,n){return t.updateColsVisibility(n)}),this.emitter.off(["filters-visibility-initialized"],function(){return t._syncFiltersVisibility()}),this.emitter.off(["filters-toggled"],function(e,i,s){return t.updateFiltersVisibility(s)}),this.enableHash&&(this.hash.destroy(),this.hash=null),this.enableStorage&&(this.storage.destroy(),this.storage=null),this.initialized=!1)},e}(o.Feature)},function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.hasHashChange=void 0;var n=i(1),r=i(2),o=r.root.JSON,a=r.root.location,l=r.root.decodeURIComponent,h=e.hasHashChange=function(){var t=r.root.documentMode;return"onhashchange"in r.root&&(void 0===t||t>7)};e.Hash=function(){function t(e){s(this,t),this.state=e,this.lastHash=null,this.emitter=e.emitter}return t.prototype.init=function(){var t=this;h()&&(this.lastHash=a.hash,this.emitter.on(["state-changed"],function(e,i){return t.update(i)}),this.emitter.on(["initialized"],function(){return t.sync()}),(0,n.addEvt)(r.root,"hashchange",function(){return t.sync()}))},t.prototype.update=function(t){var e="#"+o.stringify(t);this.lastHash!==e&&(a.hash=e,this.lastHash=e)},t.prototype.parse=function(t){return-1===t.indexOf("#")?null:(t=t.substr(1),o.parse(l(t)))},t.prototype.sync=function(){var t=this.parse(a.hash);t&&this.state.overrideAndSync(t)},t.prototype.destroy=function(){var t=this;this.emitter.off(["state-changed"],function(e,i){return t.update(i)}),this.emitter.off(["initialized"],function(){return t.sync()}),(0,n.removeEvt)(r.root,"hashchange",function(){return t.sync()}),this.state=null,this.lastHash=null,this.emitter=null},t}()},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")}Object.defineProperty(e,"__esModule",{value:!0}),e.Storage=e.hasStorage=void 0;var r=i(29),o=s(r),a=i(2),l=a.root.JSON,h=a.root.localStorage,p=a.root.location,c=e.hasStorage=function(){return"Storage"in a.root};e.Storage=function(){function t(e){n(this,t),this.state=e,this.tf=e.tf,this.enableLocalStorage=e.enableLocalStorage&&c(),this.enableCookie=e.enableCookie&&!this.enableLocalStorage,this.emitter=e.emitter,this.duration=e.cookieDuration}return t.prototype.init=function(){var t=this;this.emitter.on(["state-changed"],function(e,i){return t.save(i)}),this.emitter.on(["initialized"],function(){return t.sync()})},t.prototype.save=function(t){this.enableLocalStorage?h[this.getKey()]=l.stringify(t):o["default"].write(this.getKey(),l.stringify(t),this.duration)},t.prototype.retrieve=function(){var t=null;return t=this.enableLocalStorage?h[this.getKey()]:o["default"].read(this.getKey()),t?l.parse(t):null},t.prototype.remove=function(){this.enableLocalStorage?h.removeItem(this.getKey()):o["default"].remove(this.getKey())},t.prototype.sync=function(){var t=this.retrieve();t&&this.state.overrideAndSync(t)},t.prototype.getKey=function(){return l.stringify({key:this.tf.prfxTf+"_"+this.tf.id,path:p.pathname})},t.prototype.destroy=function(){var t=this;this.emitter.off(["state-changed"],function(e,i){return t.save(i)}),this.emitter.off(["initialized"],function(){return t.sync()}),this.remove(),this.state=null,this.emitter=null},t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=i(2),n=s.root.document;e["default"]={write:function(t,e,i){var s="";i&&(s=new Date((new Date).getTime()+36e5*i),s="; expires="+s.toGMTString()),n.cookie=t+"="+escape(e)+s},read:function(t){var e="",i=t+"=";if(n.cookie.length>0){var s=n.cookie,r=s.indexOf(i);if(-1!==r){r+=i.length;var o=s.indexOf(";",r);-1===o&&(o=s.length),e=unescape(s.substring(r,o))}}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]}}}])});
\ No newline at end of file
diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js
index ad39b31c..816acc61 100644
--- a/dist/tablefilter/tf-1.js
+++ b/dist/tablefilter/tf-1.js
@@ -1,2332 +1,8 @@
-webpackJsonp([1],{
+/**
+ * tablefilter v0.2.37 by Max Guglielmi
+ * build date: 2016-06-13T09:12:36.277Z
+ * MIT License
+ */
-/***/ 30:
-/***/ function(module, exports, __webpack_require__) {
-
- var map = {
- "./array": 16,
- "./array.js": 16,
- "./const": 11,
- "./const.js": 11,
- "./cookie": 29,
- "./cookie.js": 29,
- "./date": 6,
- "./date.js": 6,
- "./dom": 3,
- "./dom.js": 3,
- "./emitter": 8,
- "./emitter.js": 8,
- "./event": 1,
- "./event.js": 1,
- "./extensions/advancedGrid/adapterEzEditTable": 31,
- "./extensions/advancedGrid/adapterEzEditTable.js": 31,
- "./extensions/advancedGrid/advancedGrid": 32,
- "./extensions/advancedGrid/advancedGrid.js": 32,
- "./extensions/colOps/colOps": 33,
- "./extensions/colOps/colOps.js": 33,
- "./extensions/colsVisibility/colsVisibility": 34,
- "./extensions/colsVisibility/colsVisibility.js": 34,
- "./extensions/filtersVisibility/filtersVisibility": 35,
- "./extensions/filtersVisibility/filtersVisibility.js": 35,
- "./extensions/sort/adapterSortabletable": 36,
- "./extensions/sort/adapterSortabletable.js": 36,
- "./extensions/sort/sort": 37,
- "./extensions/sort/sort.js": 37,
- "./feature": 10,
- "./feature.js": 10,
- "./helpers": 7,
- "./helpers.js": 7,
- "./modules/alternateRows": 24,
- "./modules/alternateRows.js": 24,
- "./modules/checkList": 18,
- "./modules/checkList.js": 18,
- "./modules/clearButton": 22,
- "./modules/clearButton.js": 22,
- "./modules/dropdown": 15,
- "./modules/dropdown.js": 15,
- "./modules/gridLayout": 9,
- "./modules/gridLayout.js": 9,
- "./modules/hash": 27,
- "./modules/hash.js": 27,
- "./modules/help": 23,
- "./modules/help.js": 23,
- "./modules/highlightKeywords": 13,
- "./modules/highlightKeywords.js": 13,
- "./modules/loader": 12,
- "./modules/loader.js": 12,
- "./modules/noResults": 25,
- "./modules/noResults.js": 25,
- "./modules/paging": 21,
- "./modules/paging.js": 21,
- "./modules/popupFilter": 14,
- "./modules/popupFilter.js": 14,
- "./modules/rowsCounter": 19,
- "./modules/rowsCounter.js": 19,
- "./modules/state": 26,
- "./modules/state.js": 26,
- "./modules/statusBar": 20,
- "./modules/statusBar.js": 20,
- "./modules/storage": 28,
- "./modules/storage.js": 28,
- "./root": 2,
- "./root.js": 2,
- "./sort": 17,
- "./sort.js": 17,
- "./string": 5,
- "./string.js": 5,
- "./types": 4,
- "./types.js": 4
- };
- 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 = 30;
-
-
-/***/ },
-
-/***/ 31:
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _const = __webpack_require__(11);
-
- var _root = __webpack_require__(2);
-
- 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 INSTANTIATION_ERROR = 'Failed to instantiate EditTable object.\n \n"ezEditTable" dependency not found.';
-
- var AdapterEzEditTable = function (_Feature) {
- _inherits(AdapterEzEditTable, _Feature);
-
- /**
- * 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
-
- var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, cfg.name));
-
- _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';
-
- // 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.enable();
- return _this;
- }
-
- /**
- * Conditionally load ezEditTable library and set advanced grid
- * @return {[type]} [description]
- */
-
-
- AdapterEzEditTable.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
- var tf = this.tf;
- if (_root.root.EditTable) {
- this._setAdvancedGrid();
- } else {
- var path = this.vendorPath + this.filename;
- tf.import(this.filename, path, function () {
- return _this2._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 _this2._toggleForInputFilter();
- });
-
- this.initialized = true;
- };
-
- /**
- * Instantiate ezEditTable component for advanced grid features
- * @private
- */
-
-
- AdapterEzEditTable.prototype._setAdvancedGrid = function _setAdvancedGrid() {
- var tf = this.tf;
-
- //start row for EditTable constructor needs to be calculated
- var startRow,
- cfg = this.cfg,
- thead = (0, _dom.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') {
- /* eslint-disable */
- slc.SelectRowByIndex(nextRowIndex);
- /* eslint-enable */
- } else {
- /* eslint-disable */
- et.ClearSelections();
- /* eslint-enable */
- var cellIndex = selectedElm.cellIndex,
- row = tf.tbl.rows[nextRowIndex];
- if (et.defaultSelection === 'both') {
- /* eslint-disable */
- slc.SelectRowByIndex(nextRowIndex);
- /* eslint-enable */
- }
- if (row) {
- /* eslint-disable */
- slc.SelectCell(row.cells[cellIndex]);
- /* eslint-enable */
- }
- }
- //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,
-
- /* eslint-disable */
- keyCode = e !== undefined ? et.Event.GetKey(e) : 0,
-
- /* eslint-enable */
- 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;
- /* eslint-disable */
- var row = slc.GetActiveRow();
- /* eslint-enable */
- if (row) {
- row.scrollIntoView(false);
- }
- /* eslint-disable */
- var cell = slc.GetActiveCell();
- /* eslint-enable */
- 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.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.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 {
- /* eslint-disable */
- this._ezEditTable = new EditTable(tf.id, cfg, startRow);
- this._ezEditTable.Init();
- /* eslint-enable */
- } catch (e) {
- throw new Error(INSTANTIATION_ERROR);
- }
-
- this.initialized = true;
- };
-
- /**
- * Reset advanced grid when previously removed
- */
-
-
- AdapterEzEditTable.prototype.reset = function reset() {
- var ezEditTable = this._ezEditTable;
- if (ezEditTable) {
- if (this.cfg.selection) {
- /* eslint-disable */
- ezEditTable.Selection.Set();
- /* eslint-enable */
- }
- if (this.cfg.editable) {
- /* eslint-disable */
- ezEditTable.Editable.Set();
- /* eslint-enable */
- }
- }
- };
-
- /**
- * Toggle behaviour
- */
-
-
- AdapterEzEditTable.prototype.toggle = function toggle() {
- var ezEditTable = this._ezEditTable;
- if (ezEditTable.editable) {
- /* eslint-disable */
- ezEditTable.Editable.Remove();
- /* eslint-enable */
- } else {
- /* eslint-disable */
- ezEditTable.Editable.Set();
- /* eslint-enable */
- }
- if (ezEditTable.selection) {
- /* eslint-disable */
- ezEditTable.Selection.Remove();
- /* eslint-enable */
- } else {
- /* eslint-disable */
- ezEditTable.Selection.Set();
- /* eslint-enable */
- }
- };
-
- AdapterEzEditTable.prototype._toggleForInputFilter = function _toggleForInputFilter() {
- var tf = this.tf;
- if (!tf.getActiveFilterId()) {
- return;
- }
- var colIndex = tf.getColumnIndexFromFilterId(tf.getActiveFilterId());
- var filterType = tf.getFilterType(colIndex);
- if (filterType === _const.INPUT) {
- this.toggle();
- }
- };
-
- /**
- * Remove advanced grid
- */
-
-
- AdapterEzEditTable.prototype.destroy = function destroy() {
- var _this3 = this;
-
- if (!this.initialized) {
- return;
- }
- var ezEditTable = this._ezEditTable;
- if (ezEditTable) {
- if (this.cfg.selection) {
- /* eslint-disable */
- ezEditTable.Selection.ClearSelections();
- ezEditTable.Selection.Remove();
- /* eslint-enable */
- }
- if (this.cfg.editable) {
- /* eslint-disable */
- ezEditTable.Editable.Remove();
- /* eslint-enable */
- }
- }
-
- this.emitter.off(['filter-focus', 'filter-blur'], function () {
- return _this3._toggleForInputFilter();
- });
- this.initialized = false;
- };
-
- return AdapterEzEditTable;
- }(_feature.Feature);
-
- exports.default = AdapterEzEditTable;
-
-/***/ },
-
-/***/ 32:
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _adapterEzEditTable = __webpack_require__(31);
-
- var _adapterEzEditTable2 = _interopRequireDefault(_adapterEzEditTable);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- exports.default = _adapterEzEditTable2.default;
-
-/***/ },
-
-/***/ 33:
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- 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 ColOps = function (_Feature) {
- _inherits(ColOps, _Feature);
-
- /**
- * Column calculations
- * @param {Object} tf TableFilter instance
- */
-
- function ColOps(tf, opts) {
- _classCallCheck(this, ColOps);
-
- //calls function before col operation
-
- var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, opts.name));
-
- _this.onBeforeOperation = (0, _types.isFn)(opts.on_before_operation) ? opts.on_before_operation : null;
- //calls function after col operation
- _this.onAfterOperation = (0, _types.isFn)(opts.on_after_operation) ? opts.on_after_operation : null;
-
- _this.opts = opts;
- _this.enable();
- return _this;
- }
-
- ColOps.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
- // subscribe to events
- this.tf.emitter.on(['after-filtering'], function () {
- return _this2.calc();
- });
-
- this.calc();
- this.initialized = true;
- };
-
- /**
- * 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.
- */
-
-
- ColOps.prototype.calc = function calc() {
- var tf = this.tf;
- if (!tf.isInitialized()) {
- 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 = (0, _types.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 ((0, _types.isArray)(labelId) && (0, _types.isArray)(colIndex) && (0, _types.isArray)(operation)) {
- 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] = operation[k].toLowerCase();
- decThisCol[mThisCol] = decimalPrecision[k];
- labThisCol[mThisCol] = labelId[k];
- oTypeThisCol = (0, _types.isArray)(outputType) ? 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++) {
- /* eslint-disable */
- if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) {
- /* eslint-enable */
- 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 ((0, _dom.elm)(labThisCol[i])) {
- switch (oTypeThisCol.toLowerCase()) {
- case 'innerhtml':
- if (isNaN(result) || !isFinite(result) || nbvalues === 0) {
- (0, _dom.elm)(labThisCol[i]).innerHTML = '.';
- } else {
- (0, _dom.elm)(labThisCol[i]).innerHTML = result;
- }
- break;
- case 'setvalue':
- (0, _dom.elm)(labThisCol[i]).value = result;
- break;
- case 'createtextnode':
- var oldnode = (0, _dom.elm)(labThisCol[i]).firstChild;
- var txtnode = (0, _dom.createText)(result);
- (0, _dom.elm)(labThisCol[i]).replaceChild(txtnode, oldnode);
- break;
- } //switch
- }
- } else {
- try {
- if (isNaN(result) || !isFinite(result) || nbvalues === 0) {
- (0, _dom.elm)(labThisCol[i]).innerHTML = '.';
- } else {
- (0, _dom.elm)(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);
- }
- };
-
- ColOps.prototype.destroy = function destroy() {
- var _this3 = this;
-
- if (!this.initialized) {
- return;
- }
- // unsubscribe to events
- this.tf.emitter.off(['after-filtering'], function () {
- return _this3.calc();
- });
- this.initialized = false;
- };
-
- return ColOps;
- }(_feature.Feature);
-
- exports.default = ColOps;
-
-/***/ },
-
-/***/ 34:
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- var _event = __webpack_require__(1);
-
- 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 ColsVisibility = function (_Feature) {
- _inherits(ColsVisibility, _Feature);
-
- /**
- * Columns Visibility extension
- * @param {Object} tf TableFilter instance
- * @param {Object} f Extension's configuration
- */
-
- function ColsVisibility(tf, f) {
- _classCallCheck(this, ColsVisibility);
-
- // Configuration object
-
- var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, f.name));
-
- 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 = (0, _dom.tag)(tf.tbl, 'col').length > 0;
-
- //callback invoked just after cols manager is loaded
- _this.onLoaded = (0, _types.isFn)(f.on_loaded) ? f.on_loaded : null;
- //calls function before cols manager is opened
- _this.onBeforeOpen = (0, _types.isFn)(f.on_before_open) ? f.on_before_open : null;
- //calls function after cols manager is opened
- _this.onAfterOpen = (0, _types.isFn)(f.on_after_open) ? f.on_after_open : null;
- //calls function before cols manager is closed
- _this.onBeforeClose = (0, _types.isFn)(f.on_before_close) ? f.on_before_close : null;
- //calls function after cols manager is closed
- _this.onAfterClose = (0, _types.isFn)(f.on_after_close) ? f.on_after_close : null;
-
- //callback before col is hidden
- _this.onBeforeColHidden = (0, _types.isFn)(f.on_before_col_hidden) ? f.on_before_col_hidden : null;
- //callback after col is hidden
- _this.onAfterColHidden = (0, _types.isFn)(f.on_after_col_hidden) ? f.on_after_col_hidden : null;
- //callback before col is displayed
- _this.onBeforeColDisplayed = (0, _types.isFn)(f.on_before_col_displayed) ? f.on_before_col_displayed : null;
- //callback after col is displayed
- _this.onAfterColDisplayed = (0, _types.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.enable();
- return _this;
- }
-
- ColsVisibility.prototype.toggle = 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);
- }
- };
-
- ColsVisibility.prototype.checkItem = 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) {
- (0, _dom.addClass)(li, this.listSlcItemCssClass);
- } else {
- (0, _dom.removeClass)(li, this.listSlcItemCssClass);
- }
-
- var hide = false;
- if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) {
- hide = true;
- }
- this.setHidden(colIndex, hide);
- };
-
- ColsVisibility.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized || !this.manager) {
- return;
- }
-
- this.emitter.on(['hide-column'], function (tf, colIndex) {
- return _this2.hideCol(colIndex);
- });
-
- this.buildBtn();
- this.buildManager();
-
- this.initialized = true;
- this.emitter.emit('columns-visibility-initialized', this.tf, this);
-
- // Hide columns at start at very end of initialization
- this._hideAtStart();
- };
-
- /**
- * Build main button UI
- */
-
-
- ColsVisibility.prototype.buildBtn = function buildBtn() {
- var _this3 = this;
-
- if (this.btnEl) {
- return;
- }
- var tf = this.tf;
- var span = (0, _dom.createElm)('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 : (0, _dom.elm)(this.btnTgtId);
-
- if (!this.btnTgtId) {
- var firstChild = targetEl.firstChild;
- firstChild.parentNode.insertBefore(span, firstChild);
- } else {
- targetEl.appendChild(span);
- }
-
- if (!this.btnHtml) {
- var btn = (0, _dom.createElm)('a', ['href', 'javascript:;']);
- btn.className = this.btnCssClass;
- btn.title = this.desc;
-
- btn.innerHTML = this.btnText;
- span.appendChild(btn);
- if (!this.enableHover) {
- (0, _event.addEvt)(btn, 'click', function (evt) {
- return _this3.toggle(evt);
- });
- } else {
- (0, _event.addEvt)(btn, 'mouseover', function (evt) {
- return _this3.toggle(evt);
- });
- }
- } else {
- //Custom html
- span.innerHTML = this.btnHtml;
- var colVisEl = span.firstChild;
- if (!this.enableHover) {
- (0, _event.addEvt)(colVisEl, 'click', function (evt) {
- return _this3.toggle(evt);
- });
- } else {
- (0, _event.addEvt)(colVisEl, 'mouseover', function (evt) {
- return _this3.toggle(evt);
- });
- }
- }
-
- this.spanEl = span;
- this.btnEl = this.spanEl.firstChild;
-
- if (this.onLoaded) {
- this.onLoaded.call(null, this);
- }
- };
-
- /**
- * Build columns manager UI
- */
-
-
- ColsVisibility.prototype.buildManager = function buildManager() {
- var _this4 = this;
-
- var tf = this.tf;
-
- var container = !this.contElTgtId ? (0, _dom.createElm)('div', ['id', this.prfxCont + tf.id]) : (0, _dom.elm)(this.contElTgtId);
- container.className = this.contCssClass;
-
- //Extension description
- var extNameLabel = (0, _dom.createElm)('p');
- extNameLabel.innerHTML = this.text;
- container.appendChild(extNameLabel);
-
- //Headers list
- var ul = (0, _dom.createElm)('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) {
- (function () {
- var li = (0, _dom.createCheckItem)('col__' + tf.id, _this4.tickAllText, _this4.tickAllText);
- (0, _dom.addClass)(li, _this4.listItemCssClass);
- ul.appendChild(li);
- li.check.checked = !_this4.tickToHide;
-
- (0, _event.addEvt)(li.check, 'click', function () {
- for (var h = 0; h < headerRow.cells.length; h++) {
- var itm = (0, _dom.elm)('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 = (0, _dom.createCheckItem)('col_' + i + '_' + tf.id, cellText, cellText);
- (0, _dom.addClass)(liElm, this.listItemCssClass);
- if (!this.tickToHide) {
- (0, _dom.addClass)(liElm, this.listSlcItemCssClass);
- }
- ul.appendChild(liElm);
- if (!this.tickToHide) {
- liElm.check.checked = true;
- }
-
- (0, _event.addEvt)(liElm.check, 'click', function (evt) {
- var elm = (0, _event.targetEvt)(evt);
- var lbl = elm.parentNode;
- _this4.checkItem(lbl);
- });
- }
-
- //separator
- var p = (0, _dom.createElm)('p', ['align', 'center']);
- var btn = void 0;
- //Close link
- if (!this.btnCloseHtml) {
- btn = (0, _dom.createElm)('a', ['href', 'javascript:;']);
- btn.className = this.btnCloseCssClass;
- btn.innerHTML = this.btnCloseText;
- (0, _event.addEvt)(btn, 'click', function (evt) {
- return _this4.toggle(evt);
- });
- p.appendChild(btn);
- } else {
- p.innerHTML = this.btnCloseHtml;
- btn = p.firstChild;
- (0, _event.addEvt)(btn, 'click', function (evt) {
- return _this4.toggle(evt);
- });
- }
-
- container.appendChild(ul);
- container.appendChild(p);
-
- this.btnEl.parentNode.insertBefore(container, this.btnEl);
- this.contEl = container;
- };
-
- /**
- * Hide or show specified columns
- * @param {Numner} colIndex Column index
- * @param {Boolean} hide Hide column if true or show if false
- */
-
-
- ColsVisibility.prototype.setHidden = 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 = void 0;
- var headTbl = void 0;
- var gridColElms = void 0;
- if (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.colElms;
- 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;
- }
- if (this.onAfterColHidden) {
- this.onAfterColHidden.call(null, this, colIndex);
- }
- this.emitter.emit('column-hidden', tf, this, colIndex, this.hiddenCols);
- }
-
- if (!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.colElms;
- 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;
- }
- if (this.onAfterColDisplayed) {
- this.onAfterColDisplayed.call(null, this, colIndex);
- }
- this.emitter.emit('column-shown', tf, this, colIndex, this.hiddenCols);
- }
- };
-
- /**
- * Show specified column
- * @param {Number} colIndex Column index
- */
-
-
- ColsVisibility.prototype.showCol = function showCol(colIndex) {
- if (colIndex === undefined || !this.isColHidden(colIndex)) {
- return;
- }
- if (this.manager && this.contEl) {
- var itm = (0, _dom.elm)('col_' + colIndex + '_' + this.tf.id);
- if (itm) {
- itm.click();
- }
- } else {
- this.setHidden(colIndex, false);
- }
- };
-
- /**
- * Hide specified column
- * @param {Number} colIndex Column index
- */
-
-
- ColsVisibility.prototype.hideCol = function hideCol(colIndex) {
- if (colIndex === undefined || this.isColHidden(colIndex)) {
- return;
- }
- if (this.manager && this.contEl) {
- var itm = (0, _dom.elm)('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
- */
-
-
- ColsVisibility.prototype.isColHidden = function isColHidden(colIndex) {
- if (this.hiddenCols.indexOf(colIndex) !== -1) {
- return true;
- }
- return false;
- };
-
- /**
- * Toggle visibility of specified column
- * @param {Number} colIndex Column index
- */
-
-
- ColsVisibility.prototype.toggleCol = function toggleCol(colIndex) {
- if (colIndex === undefined || this.isColHidden(colIndex)) {
- this.showCol(colIndex);
- } else {
- this.hideCol(colIndex);
- }
- };
-
- /**
- * Return the indexes of the columns currently hidden
- * @return {Array} column indexes
- */
-
-
- ColsVisibility.prototype.getHiddenCols = function getHiddenCols() {
- return this.hiddenCols;
- };
-
- /**
- * Remove the columns manager
- */
-
-
- ColsVisibility.prototype.destroy = function destroy() {
- var _this5 = this;
-
- if (!this.initialized) {
- return;
- }
- if ((0, _dom.elm)(this.contElTgtId)) {
- (0, _dom.elm)(this.contElTgtId).innerHTML = '';
- } else {
- this.contEl.innerHTML = '';
- (0, _dom.removeElm)(this.contEl);
- this.contEl = null;
- }
- this.btnEl.innerHTML = '';
- (0, _dom.removeElm)(this.btnEl);
- this.btnEl = null;
-
- this.emitter.off(['hide-column'], function (tf, colIndex) {
- return _this5.hideCol(colIndex);
- });
-
- this.initialized = false;
- };
-
- ColsVisibility.prototype._getHeaderText = 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 (0, _dom.getText)(n);
- }
- }
- continue;
- }
- return '';
- };
-
- ColsVisibility.prototype._hideCells = 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' : '';
- }
- }
- };
-
- ColsVisibility.prototype._hideAtStart = function _hideAtStart() {
- var _this6 = this;
-
- if (!this.atStart) {
- return;
- }
- this.atStart.forEach(function (colIdx) {
- _this6.hideCol(colIdx);
- });
- };
-
- return ColsVisibility;
- }(_feature.Feature);
-
- exports.default = ColsVisibility;
-
-/***/ },
-
-/***/ 35:
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _feature = __webpack_require__(10);
-
- var _dom = __webpack_require__(3);
-
- var _types = __webpack_require__(4);
-
- var _event = __webpack_require__(1);
-
- 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 FiltersVisibility = function (_Feature) {
- _inherits(FiltersVisibility, _Feature);
-
- /**
- * Filters Row Visibility extension
- * @param {Object} tf TableFilter instance
- * @param {Object} f Config
- */
-
- function FiltersVisibility(tf, f) {
- _classCallCheck(this, FiltersVisibility);
-
- var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, f.name));
-
- _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 = '';
- _this.icnCollapseHtml = '';
- _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 = !(0, _types.isUndef)(f.filters_row_index) ? f.filters_row_index : tf.getFiltersRowIndex();
-
- _this.visibleAtStart = !(0, _types.isUndef)(f.visible_at_start) ? Boolean(f.visible_at_start) : true;
-
- // Prefix
- _this.prfx = 'fltsVis_';
-
- //callback before filters row is shown
- _this.onBeforeShow = (0, _types.isFn)(f.on_before_show) ? f.on_before_show : null;
- //callback after filters row is shown
- _this.onAfterShow = (0, _types.isFn)(f.on_after_show) ? f.on_after_show : null;
- //callback before filters row is hidden
- _this.onBeforeHide = (0, _types.isFn)(f.on_before_hide) ? f.on_before_hide : null;
- //callback after filters row is hidden
- _this.onAfterHide = (0, _types.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.enable();
- return _this;
- }
-
- /**
- * Initialise extension
- */
-
-
- FiltersVisibility.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
-
- this.buildUI();
- this.initialized = true;
- this.emitter.on(['show-filters'], function (tf, visible) {
- return _this2.show(visible);
- });
- this.emitter.emit('filters-visibility-initialized', this.tf, this);
- };
-
- /**
- * Build UI elements
- */
-
-
- FiltersVisibility.prototype.buildUI = function buildUI() {
- var _this3 = this;
-
- var tf = this.tf;
- var span = (0, _dom.createElm)('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 : (0, _dom.elm)(this.targetId);
-
- if (!this.targetId) {
- var firstChild = targetEl.firstChild;
- firstChild.parentNode.insertBefore(span, firstChild);
- } else {
- targetEl.appendChild(span);
- }
-
- var btn = void 0;
- if (!this.btnHtml) {
- btn = (0, _dom.createElm)('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;
- }
-
- (0, _event.addEvt)(btn, 'click', function () {
- return _this3.toggle();
- });
-
- this.contEl = span;
- this.btnEl = btn;
-
- if (!this.visibleAtStart) {
- this.toggle();
- }
- };
-
- /**
- * Toggle filters visibility
- */
-
-
- FiltersVisibility.prototype.toggle = function toggle() {
- var tf = this.tf;
- var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl;
- var fltRow = tbl.rows[this.filtersRowIndex];
- var isDisplayed = fltRow.style.display === '';
-
- this.show(!isDisplayed);
- };
-
- /**
- * Show or hide filters
- *
- * @param {boolean} [visible=true] Visibility flag
- */
-
-
- FiltersVisibility.prototype.show = function show() {
- var visible = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
-
- var tf = this.tf;
- var tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl;
- var fltRow = tbl.rows[this.filtersRowIndex];
-
- if (this.onBeforeShow && visible) {
- this.onBeforeShow.call(this, this);
- }
- if (this.onBeforeHide && !visible) {
- this.onBeforeHide.call(null, this);
- }
-
- fltRow.style.display = visible ? '' : 'none';
- if (this.enableIcon && !this.btnHtml) {
- this.btnEl.innerHTML = visible ? this.collapseBtnHtml : this.expandBtnHtml;
- }
-
- if (this.onAfterShow && visible) {
- this.onAfterShow.call(null, this);
- }
- if (this.onAfterHide && !visible) {
- this.onAfterHide.call(null, this);
- }
-
- this.emitter.emit('filters-toggled', tf, this, visible);
- };
-
- /**
- * Destroy the UI
- */
-
-
- FiltersVisibility.prototype.destroy = function destroy() {
- var _this4 = this;
-
- if (!this.initialized) {
- return;
- }
-
- this.emitter.off(['show-filters'], function (tf, visible) {
- return _this4.show(visible);
- });
-
- this.btnEl.innerHTML = '';
- (0, _dom.removeElm)(this.btnEl);
- this.btnEl = null;
-
- this.contEl.innerHTML = '';
- (0, _dom.removeElm)(this.contEl);
- this.contEl = null;
- this.initialized = false;
- };
-
- return FiltersVisibility;
- }(_feature.Feature);
-
- exports.default = FiltersVisibility;
-
-/***/ },
-
-/***/ 36:
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _feature = __webpack_require__(10);
-
- var _types = __webpack_require__(4);
-
- var _dom = __webpack_require__(3);
-
- var _event = __webpack_require__(1);
-
- var _date = __webpack_require__(6);
-
- var _helpers = __webpack_require__(7);
-
- var _const = __webpack_require__(11);
-
- 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 AdapterSortableTable = function (_Feature) {
- _inherits(AdapterSortableTable, _Feature);
-
- /**
- * SortableTable Adapter module
- * @param {Object} tf TableFilter instance
- */
-
- function AdapterSortableTable(tf, opts) {
- _classCallCheck(this, AdapterSortableTable);
-
- var _this = _possibleConstructorReturn(this, _Feature.call(this, tf, opts.name));
-
- _this.name = opts.name;
- _this.desc = opts.description || 'Sortable table';
-
- //indicates if table previously sorted
- _this.sorted = false;
-
- _this.sortTypes = (0, _types.isArray)(opts.types) ? opts.types : [];
- _this.sortColAtStart = (0, _types.isArray)(opts.sort_col_at_start) ? opts.sort_col_at_start : null;
- _this.asyncSort = Boolean(opts.async_sort);
- _this.triggerIds = (0, _types.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 = (0, _types.isFn)(opts.on_sort_loaded) ? opts.on_sort_loaded : null;
- // callback invoked before table is sorted
- _this.onBeforeSort = (0, _types.isFn)(opts.on_before_sort) ? opts.on_before_sort : null;
- // callback invoked after table is sorted
- _this.onAfterSort = (0, _types.isFn)(opts.on_after_sort) ? opts.on_after_sort : null;
-
- _this.enable();
- return _this;
- }
-
- AdapterSortableTable.prototype.init = function init() {
- var _this2 = this;
-
- if (this.initialized) {
- return;
- }
- var tf = this.tf;
- var adpt = this;
-
- // SortableTable class sanity check (sortabletable.js)
- if ((0, _types.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.stt.descending);
- }
-
- adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn, adpt.stt.descending);
- };
-
- this.emitter.on(['sort'], function (tf, colIdx, desc) {
- return _this2.sortByColumnIndex(colIdx, desc);
- });
-
- this.initialized = true;
- this.emitter.emit('sort-initialized', tf, this);
- };
-
- /**
- * Sort specified column
- * @param {Number} colIdx Column index
- * @param {Boolean} desc Optional: descending manner
- */
-
-
- AdapterSortableTable.prototype.sortByColumnIndex = function sortByColumnIndex(colIdx, desc) {
- this.stt.sort(colIdx, desc);
- };
-
- AdapterSortableTable.prototype.overrideSortableTable = 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 !== _const.CELL_TAG && el.tagName !== _const.HEADER_TAG) {
- 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 = void 0;
- 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 = void 0,
- c = void 0;
-
- for (var i = 0; i < l; i++) {
- c = cells[i];
- if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') {
- c.style.cursor = 'pointer';
- img = (0, _dom.createElm)('img', ['src', adpt.imgPath + adpt.imgBlank]);
- c.appendChild(img);
- if (stt.sortTypes[i] !== null) {
- c.setAttribute('_sortType', stt.sortTypes[i]);
- }
- (0, _event.addEvt)(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 = void 0,
- l = void 0,
- img = void 0;
-
- // 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((0, _dom.elm)(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 = (0, _dom.createElm)('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 (0, _dom.getText)(oNode);
- }
- };
- };
-
- AdapterSortableTable.prototype.addSortType = function addSortType() {
- var args = arguments;
- SortableTable.prototype.addSortType(args[0], args[1], args[2], args[3]);
- };
-
- AdapterSortableTable.prototype.setSortTypes = function setSortTypes() {
- var _this3 = this;
-
- var tf = this.tf,
- sortTypes = this.sortTypes,
- _sortTypes = [];
-
- for (var i = 0; i < tf.nbCells; i++) {
- var colType = void 0;
-
- if (sortTypes[i]) {
- colType = sortTypes[i].toLowerCase();
- if (colType === _const.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 = _this3.triggerIds;
- for (var j = 0; j < triggers.length; j++) {
- if (triggers[j] === null) {
- continue;
- }
- var trigger = (0, _dom.elm)(triggers[j]);
- if (trigger) {
- trigger.style.cursor = 'pointer';
-
- (0, _event.addEvt)(trigger, 'click', function (evt) {
- var elm = evt.target;
- if (!_this3.tf.sort) {
- return;
- }
- _this3.stt.asyncSort(triggers.indexOf(elm.id));
- });
- trigger.setAttribute('_sortType', _sortTypes[j]);
- }
- }
- })();
- }
- };
-
- /**
- * Destroy sort
- */
-
-
- AdapterSortableTable.prototype.destroy = function destroy() {
- var _this4 = this;
-
- if (!this.initialized) {
- return;
- }
- var tf = this.tf;
- this.emitter.off(['sort'], function (tf, colIdx, desc) {
- return _this4.sortByColumnIndex(colIdx, desc);
- });
- 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 = (0, _dom.tag)(header, 'img');
-
- if (img.length === 1) {
- header.removeChild(img[0]);
- }
- }
- this.initialized = false;
- };
-
- return AdapterSortableTable;
- }(_feature.Feature);
-
- //Converters
-
-
- exports.default = AdapterSortableTable;
- function usNumberConverter(s) {
- return (0, _helpers.removeNbFormat)(s, 'us');
- }
- function euNumberConverter(s) {
- return (0, _helpers.removeNbFormat)(s, 'eu');
- }
- function dateConverter(s, format) {
- return (0, _date.formatDate)(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;
- }
- }
-
-/***/ },
-
-/***/ 37:
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _adapterSortabletable = __webpack_require__(36);
-
- var _adapterSortabletable2 = _interopRequireDefault(_adapterSortabletable);
-
- var _root = __webpack_require__(2);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- if (!_root.root.SortableTable) {
- __webpack_require__(38);
- }
-
- exports.default = _adapterSortabletable2.default;
-
-/***/ },
-
-/***/ 38:
-/***/ function(module, exports, __webpack_require__) {
-
- __webpack_require__(39)(__webpack_require__(40)+"\n\n// SCRIPT-LOADER FOOTER\n//# sourceURL=script:///C:/Users/max.guglielmi/Documents/dev/perso/javascript/GitHub/TableFilter/libs/sortabletable.js")
-
-/***/ },
-
-/***/ 39:
-/***/ function(module, exports) {
-
- /*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
- */
- module.exports = function(src) {
- if (typeof execScript !== "undefined")
- execScript(src);
- else
- eval.call(null, src);
- }
-
-
-/***/ },
-
-/***/ 40:
-/***/ 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],{30:function(e,t,n){function r(e){return n(o(e))}function o(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./array":16,"./array.js":16,"./const":11,"./const.js":11,"./cookie":29,"./cookie.js":29,"./date":6,"./date.js":6,"./dom":3,"./dom.js":3,"./emitter":8,"./emitter.js":8,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":31,"./extensions/advancedGrid/adapterEzEditTable.js":31,"./extensions/advancedGrid/advancedGrid":32,"./extensions/advancedGrid/advancedGrid.js":32,"./extensions/colOps/colOps":33,"./extensions/colOps/colOps.js":33,"./extensions/colsVisibility/colsVisibility":34,"./extensions/colsVisibility/colsVisibility.js":34,"./extensions/filtersVisibility/filtersVisibility":35,"./extensions/filtersVisibility/filtersVisibility.js":35,"./extensions/sort/adapterSortabletable":36,"./extensions/sort/adapterSortabletable.js":36,"./extensions/sort/sort":37,"./extensions/sort/sort.js":37,"./feature":10,"./feature.js":10,"./helpers":7,"./helpers.js":7,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":15,"./modules/dropdown.js":15,"./modules/gridLayout":9,"./modules/gridLayout.js":9,"./modules/hash":27,"./modules/hash.js":27,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":13,"./modules/highlightKeywords.js":13,"./modules/loader":12,"./modules/loader.js":12,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":14,"./modules/popupFilter.js":14,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/state":26,"./modules/state.js":26,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/storage":28,"./modules/storage.js":28,"./root":2,"./root.js":2,"./sort":17,"./sort.js":17,"./string":5,"./string.js":5,"./types":4,"./types.js":4};r.keys=function(){return Object.keys(i)},r.resolve=o,e.exports=r,r.id=30},31:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(10),l=n(3),a=n(11),d=n(2),c='Failed to instantiate EditTable object.\n \n"ezEditTable" dependency not found.',u=function(e){function t(n,i){r(this,t);var s=o(this,e.call(this,n,i.name));return s.initialized=!1,s.desc=i.description||"ezEditTable adapter",s.filename=i.filename||"ezEditTable.js",s.vendorPath=i.vendor_path,s.loadStylesheet=Boolean(i.load_stylesheet),s.stylesheet=i.stylesheet||s.vendorPath+"ezEditTable.css",s.stylesheetName=i.stylesheet_name||"ezEditTableCss",i.scroll_into_view=i.scroll_into_view===!1?!1:n.gridLayout,s._ezEditTable=null,s.cfg=i,s.enable(),s}return i(t,e),t.prototype.init=function(){var e=this;if(!this.initialized){var t=this.tf;if(d.root.EditTable)this._setAdvancedGrid();else{var n=this.vendorPath+this.filename;t["import"](this.filename,n,function(){return e._setAdvancedGrid()})}this.loadStylesheet&&!t.isImported(this.stylesheet,"link")&&t["import"](this.stylesheetName,this.stylesheet,null,"link"),this.emitter.on(["filter-focus","filter-blur"],function(){return e._toggleForInputFilter()}),this.initialized=!0}},t.prototype._setAdvancedGrid=function(){var e,t=this.tf,n=this.cfg,r=(0,l.tag)(t.tbl,"thead");e=r.length>0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var o=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var s=0,a=0;if(i){var d=function(e,n,r){var o=e.Selection,i=function(r){if("row"===e.defaultSelection)o.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,s=t.tbl.rows[r];"both"===e.defaultSelection&&o.SelectRowByIndex(r),s&&o.SelectCell(s.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var l=t.tbl.rows[r];l&&l.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var l,d=t.validRowsIndex,c=d.length,u="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,p=void 0!==r?e.Event.GetKey(r):0,f=-1!==d.indexOf(u.rowIndex),b=t.feature("paging"),m=34===p||33===p?b&&b.pagingLength||e.nbRowsPerPage:1;if(f)34!==p&&33!==p?(s=d.indexOf(u.rowIndex),a=u.rowIndex):(l=34===p?c-1>=s+m?d[s+m]:[c-1]:s-m<=d[0]?d[0]:d[s-m],a=l,s=d.indexOf(l),i(l));else{if(u.rowIndex>a)if(u.rowIndex>=d[c-1])l=d[c-1];else{var y=s+m;l=y>c-1?d[c-1]:d[y]}else if(u.rowIndex<=d[0])l=d[0];else{var g=d[s-m];l=g?g:d[0]}a=u.rowIndex,i(l)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var o=t.feature("paging");e.nbRowsPerPage=o.pagingLength;var i=t.validRowsIndex,s=i.length,l=parseInt(o.startPagingRow,10)+parseInt(o.pagingLength,10),a=r.rowIndex;a===i[s-1]&&o.currentPageNb!==o.nbPages?o.setPage("last"):a===i[0]&&1!==o.currentPageNb?o.setPage("first"):a>i[l-1]&&ai[0]&&o.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,o=r.GetActiveRow();o&&o.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var h=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var b=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),b&&b.call(null,arguments[0],arguments[1],arguments[2])}}}if(o){var m=n.on_added_dom_row;if(n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),m&&m.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var y=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),y&&y.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){throw new Error(c)}this.initialized=!0},t.prototype.reset=function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())},t.prototype.toggle=function(){var e=this._ezEditTable;e.editable?e.Editable.Remove():e.Editable.Set(),e.selection?e.Selection.Remove():e.Selection.Set()},t.prototype._toggleForInputFilter=function(){var e=this.tf;if(e.getActiveFilterId()){var t=e.getColumnIndexFromFilterId(e.getActiveFilterId()),n=e.getFilterType(t);n===a.INPUT&&this.toggle()}},t.prototype.destroy=function(){var e=this;if(this.initialized){var t=this._ezEditTable;t&&(this.cfg.selection&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return e._toggleForInputFilter()}),this.initialized=!1}},t}(s.Feature);t["default"]=u},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(31),i=r(o);t["default"]=i["default"]},33:function(module,exports,__webpack_require__){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _feature=__webpack_require__(10),_dom=__webpack_require__(3),_types=__webpack_require__(4),ColOps=function(_Feature){function ColOps(e,t){_classCallCheck(this,ColOps);var n=_possibleConstructorReturn(this,_Feature.call(this,e,t.name));return n.onBeforeOperation=(0,_types.isFn)(t.on_before_operation)?t.on_before_operation:null,n.onAfterOperation=(0,_types.isFn)(t.on_after_operation)?t.on_after_operation:null,n.opts=t,n.enable(),n}return _inherits(ColOps,_Feature),ColOps.prototype.init=function(){var e=this;this.initialized||(this.tf.emitter.on(["after-filtering"],function(){return e.calc()}),this.calc(),this.initialized=!0)},ColOps.prototype.calc=function calc(){var tf=this.tf;if(tf.isInitialized()){this.onBeforeOperation&&this.onBeforeOperation.call(null,tf);var opts=this.opts,labelId=opts.id,colIndex=opts.col,operation=opts.operation,outputType=opts.write_method,totRowIndex=opts.tot_row_index,excludeRow=opts.exclude_row,decimalPrecision=(0,_types.isUndef)(opts.decimal_precision)?2:opts.decimal_precision,ucolIndex=[],ucolMax=0;ucolIndex[ucolMax]=colIndex[0];for(var ii=1;ii=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if((0,_types.isArray)(labelId)&&(0,_types.isArray)(colIndex)&&(0,_types.isArray)(operation))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;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),(0,_dom.elm)(labThisCol[i]))switch(oTypeThisCol.toLowerCase()){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?(0,_dom.elm)(labThisCol[i]).innerHTML=".":(0,_dom.elm)(labThisCol[i]).innerHTML=result;break;case"setvalue":(0,_dom.elm)(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=(0,_dom.elm)(labThisCol[i]).firstChild,txtnode=(0,_dom.createText)(result);(0,_dom.elm)(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?(0,_dom.elm)(labThisCol[i]).innerHTML=".":(0,_dom.elm)(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf)}},ColOps.prototype.destroy=function(){var e=this;this.initialized&&(this.tf.emitter.off(["after-filtering"],function(){return e.calc()}),this.initialized=!1)},ColOps}(_feature.Feature);exports["default"]=ColOps},34:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(10),l=n(3),a=n(4),d=n(1),c=function(e){function t(n,i){r(this,t);var s=o(this,e.call(this,n,i.name)),d=n.config();return s.initialized=!1,s.name=i.name,s.desc=i.description||"Columns visibility manager",s.spanEl=null,s.btnEl=null,s.contEl=null,s.tickToHide=i.tick_to_hide!==!1,s.manager=i.manager!==!1,s.headersTbl=i.headers_table||!1,s.headersIndex=i.headers_index||1,s.contElTgtId=i.container_target_id||null,s.headersText=i.headers_text||null,s.btnTgtId=i.btn_target_id||null,s.btnText=i.btn_text||"Columns▼",s.btnHtml=i.btn_html||null,s.btnCssClass=i.btn_css_class||"colVis",s.btnCloseText=i.btn_close_text||"Close",s.btnCloseHtml=i.btn_close_html||null,s.btnCloseCssClass=i.btn_close_css_class||s.btnCssClass,s.stylesheet=i.stylesheet||"colsVisibility.css",s.prfx="colVis_",s.spanCssClass=i.span_css_class||"colVisSpan",s.prfxCont=s.prfx+"Cont_",s.contCssClass=i.cont_css_class||"colVisCont",s.listCssClass=d.list_css_class||"cols_checklist",s.listItemCssClass=d.checklist_item_css_class||"cols_checklist_item",s.listSlcItemCssClass=d.checklist_selected_item_css_class||"cols_checklist_slc_item",s.text=i.text||(s.tickToHide?"Hide: ":"Show: "),s.atStart=i.at_start||null,s.enableHover=Boolean(i.enable_hover),s.enableTickAll=Boolean(i.enable_tick_all),s.tickAllText=i.tick_all_text||"Select all:",s.hiddenCols=[],s.tblHasColTag=(0,l.tag)(n.tbl,"col").length>0,s.onLoaded=(0,a.isFn)(i.on_loaded)?i.on_loaded:null,s.onBeforeOpen=(0,a.isFn)(i.on_before_open)?i.on_before_open:null,s.onAfterOpen=(0,a.isFn)(i.on_after_open)?i.on_after_open:null,s.onBeforeClose=(0,a.isFn)(i.on_before_close)?i.on_before_close:null,s.onAfterClose=(0,a.isFn)(i.on_after_close)?i.on_after_close:null,s.onBeforeColHidden=(0,a.isFn)(i.on_before_col_hidden)?i.on_before_col_hidden:null,s.onAfterColHidden=(0,a.isFn)(i.on_after_col_hidden)?i.on_after_col_hidden:null,s.onBeforeColDisplayed=(0,a.isFn)(i.on_before_col_displayed)?i.on_before_col_displayed:null,s.onAfterColDisplayed=(0,a.isFn)(i.on_after_col_displayed)?i.on_after_col_displayed:null,n.gridLayout&&(s.headersTbl=n.feature("gridLayout").headTbl,s.headersIndex=0,s.onAfterColDisplayed=function(){},s.onAfterColHidden=function(){}),n["import"](i.name+"Style",n.stylePath+s.stylesheet,null,"link"),s.enable(),s}return i(t,e),t.prototype.toggle=function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,o=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),o&&"inline"===e&&o.call(null,this)},t.prototype.checkItem=function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?(0,l.addClass)(t,this.listSlcItemCssClass):(0,l.removeClass)(t,this.listSlcItemCssClass);var o=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(o=!0),this.setHidden(r,o)}},t.prototype.init=function(){var e=this;!this.initialized&&this.manager&&(this.emitter.on(["hide-column"],function(t,n){return e.hideCol(n)}),this.buildBtn(),this.buildManager(),this.initialized=!0,this.emitter.emit("columns-visibility-initialized",this.tf,this),this._hideAtStart())},t.prototype.buildBtn=function(){var e=this;if(!this.btnEl){var t=this.tf,n=(0,l.createElm)("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?(0,l.elm)(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var o=r.firstChild;o.parentNode.insertBefore(n,o)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?(0,d.addEvt)(i,"mouseover",function(t){return e.toggle(t)}):(0,d.addEvt)(i,"click",function(t){return e.toggle(t)})}else{var s=(0,l.createElm)("a",["href","javascript:;"]);s.className=this.btnCssClass,s.title=this.desc,s.innerHTML=this.btnText,n.appendChild(s),this.enableHover?(0,d.addEvt)(s,"mouseover",function(t){return e.toggle(t)}):(0,d.addEvt)(s,"click",function(t){return e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}},t.prototype.buildManager=function(){var e=this,t=this.tf,n=this.contElTgtId?(0,l.elm)(this.contElTgtId):(0,l.createElm)("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=(0,l.createElm)("p");r.innerHTML=this.text,n.appendChild(r);var o=(0,l.createElm)("ul",["id","ul"+this.name+"_"+t.id]);o.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,s=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[s];this.enableTickAll&&!function(){var n=(0,l.createCheckItem)("col__"+t.id,e.tickAllText,e.tickAllText);(0,l.addClass)(n,e.listItemCssClass),o.appendChild(n),n.check.checked=!e.tickToHide,(0,d.addEvt)(n.check,"click",function(){for(var e=0;e',s.icnCollapseHtml='',s.defaultText="Toggle filters",s.targetId=i.target_id||null,s.enableIcon=i.enable_icon!==!1,s.btnText=i.btn_text||"",s.collapseBtnHtml=s.enableIcon?s.icnCollapseHtml+s.btnText:s.btnText||s.defaultText,s.expandBtnHtml=s.enableIcon?s.icnExpandHtml+s.btnText:s.btnText||s.defaultText,s.btnHtml=i.btn_html||null,s.btnCssClass=i.btn_css_class||"btnExpClpFlt",s.contCssClass=i.cont_css_class||"expClpFlt",s.filtersRowIndex=(0,a.isUndef)(i.filters_row_index)?n.getFiltersRowIndex():i.filters_row_index,s.visibleAtStart=(0,a.isUndef)(i.visible_at_start)?!0:Boolean(i.visible_at_start),s.prfx="fltsVis_",s.onBeforeShow=(0,a.isFn)(i.on_before_show)?i.on_before_show:null,s.onAfterShow=(0,a.isFn)(i.on_after_show)?i.on_after_show:null,s.onBeforeHide=(0,a.isFn)(i.on_before_hide)?i.on_before_hide:null,s.onAfterHide=(0,a.isFn)(i.on_after_hide)?i.on_after_hide:null,n["import"](i.name+"Style",n.stylePath+s.stylesheet,null,"link"),s.enable(),s}return i(t,e),t.prototype.init=function(){var e=this;this.initialized||(this.buildUI(),this.initialized=!0,this.emitter.on(["show-filters"],function(t,n){return e.show(n)}),this.emitter.emit("filters-visibility-initialized",this.tf,this))},t.prototype.buildUI=function(){var e=this,t=this.tf,n=(0,l.createElm)("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?(0,l.elm)(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var o=r.firstChild;o.parentNode.insertBefore(n,o)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=(0,l.createElm)("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),(0,d.addEvt)(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,this.visibleAtStart||this.toggle()},t.prototype.toggle=function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],r=""===n.style.display;this.show(!r)},t.prototype.show=function(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],t=this.tf,n=t.gridLayout?t.feature("gridLayout").headTbl:t.tbl,r=n.rows[this.filtersRowIndex];this.onBeforeShow&&e&&this.onBeforeShow.call(this,this),this.onBeforeHide&&!e&&this.onBeforeHide.call(null,this),r.style.display=e?"":"none",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=e?this.collapseBtnHtml:this.expandBtnHtml),this.onAfterShow&&e&&this.onAfterShow.call(null,this),this.onAfterHide&&!e&&this.onAfterHide.call(null,this),this.emitter.emit("filters-toggled",t,this,e)},t.prototype.destroy=function(){var e=this;this.initialized&&(this.emitter.off(["show-filters"],function(t,n){return e.show(n)}),this.btnEl.innerHTML="",(0,l.removeElm)(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",(0,l.removeElm)(this.contEl),this.contEl=null,this.initialized=!1)},t}(s.Feature);t["default"]=c},36:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(0,v.removeNbFormat)(e,"us")}function l(e){return(0,v.removeNbFormat)(e,"eu")}function a(e,t){return(0,T.formatDate)(e,t)}function d(e){return a(e,"DMY")}function c(e){return a(e,"MDY")}function u(e){return a(e,"YMD")}function h(e){return a(e,"DDMMMYYYY")}function p(e){var t=e.split(".");for(var n in t){for(var r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=p(e.value.toLowerCase()),r=p(t.value.toLowerCase());return n===r?0:r>n?-1:1}Object.defineProperty(t,"__esModule",{value:!0});var b=n(10),m=n(4),y=n(3),g=n(1),T=n(6),v=n(7),_=n(11),C=function(e){function t(n,i){r(this,t);var s=o(this,e.call(this,n,i.name));return s.name=i.name,s.desc=i.description||"Sortable table",s.sorted=!1,s.sortTypes=(0,m.isArray)(i.types)?i.types:[],s.sortColAtStart=(0,m.isArray)(i.sort_col_at_start)?i.sort_col_at_start:null,s.asyncSort=Boolean(i.async_sort),s.triggerIds=(0,m.isArray)(i.trigger_ids)?i.trigger_ids:[],s.imgPath=i.images_path||n.themesPath,s.imgBlank=i.image_blank||"blank.png",s.imgClassName=i.image_class_name||"sort-arrow",s.imgAscClassName=i.image_asc_class_name||"ascending",s.imgDescClassName=i.image_desc_class_name||"descending",s.customKey=i.custom_key||"data-tf-sortKey",s.onSortLoaded=(0,m.isFn)(i.on_sort_loaded)?i.on_sort_loaded:null,s.onBeforeSort=(0,m.isFn)(i.on_before_sort)?i.on_before_sort:null,s.onAfterSort=(0,m.isFn)(i.on_after_sort)?i.on_after_sort:null,s.enable(),s}return i(t,e),t.prototype.init=function(){var e=this;if(!this.initialized){var t=this.tf,n=this;if((0,m.isUndef)(SortableTable))throw new Error("SortableTable class not found.");this.overrideSortableTable(),this.setSortTypes();var r=n.sortColAtStart;r&&this.stt.sort(r[0],r[1]),this.onSortLoaded&&this.onSortLoaded.call(null,t,this),this.stt.onbeforesort=function(){n.onBeforeSort&&n.onBeforeSort.call(null,t,n.stt.sortColumn),t.paging&&t.feature("paging").disable()},this.stt.onsort=function(){if(n.sorted=!0,t.paging){var e=t.feature("paging");t.getValidRows(!0),e.enable(),e.setPage(e.getPage())}n.onAfterSort&&n.onAfterSort.call(null,t,n.stt.sortColumn,n.stt.descending),n.emitter.emit("column-sorted",t,n.stt.sortColumn,n.stt.descending)},this.emitter.on(["sort"],function(t,n,r){return e.sortByColumnIndex(n,r)}),this.initialized=!0,this.emitter.emit("sort-initialized",t,this)}},t.prototype.sortByColumnIndex=function(e,t){this.stt.sort(e,t)},t.prototype.overrideSortableTable=function(){var e=this,t=this.tf;SortableTable.prototype.headerOnclick=function(t){if(e.initialized){for(var n=t.target||t.srcElement;n.tagName!==_.CELL_TAG&&n.tagName!==_.HEADER_TAG;)n=n.parentNode;this.sort(SortableTable.msie?SortableTable.getCellIndex(n):n.cellIndex)}},SortableTable.getCellIndex=function(e){var t=e.parentNode.cells,n=t.length,r=void 0;for(r=0;t[r]!==e&&n>r;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var o=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=o.length,s=void 0,l=void 0,a=0;i>a;a++)l=o[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(l.style.cursor="pointer",s=(0,y.createElm)("img",["src",e.imgPath+e.imgBlank]),l.appendChild(s),null!==r.sortTypes[a]&&l.setAttribute("_sortType",r.sortTypes[a]),(0,g.addEvt)(l,"click",r._headerOnclick)):(l.setAttribute("_sortType",n[a]),l._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,o=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var s=0;sl;l++){var a=n[l].getAttribute("_sortType");null!==a&&"None"!==a&&(o=n[l].lastChild||n[l],"img"!==o.nodeName.toLowerCase()&&(o=(0,y.createElm)("img",["src",e.imgPath+e.imgBlank]),n[l].appendChild(o)),l===t.sortColumn?o.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):o.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,o=r._sortTypeInfo[t];if(o&&o.getRowValue)return o.getRowValue(e,n);var i=e.cells[n],s=SortableTable.getInnerText(i);return r.getValueFromString(s,t)},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):(0,
+y.getText)(t):void 0}},t.prototype.addSortType=function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])},t.prototype.setSortTypes=function(){for(var e=this,t=this.tf,n=this.sortTypes,r=[],o=0;o0&&!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 babb98df..a0dbf28b 100644
--- a/src/modules/gridLayout.js
+++ b/src/modules/gridLayout.js
@@ -19,45 +19,128 @@ export class GridLayout extends Feature {
let f = this.config;
- //defines grid width
+ /**
+ * Grid-layout container width as CSS string
+ * @type {String}
+ */
this.width = f.grid_width || null;
- //defines grid height
+
+ /**
+ * Grid-layout container height as CSS string
+ * @type {String}
+ */
this.height = f.grid_height || null;
- //defines css class for main container
+
+ /**
+ * Css class for main container element
+ * @type {String}
+ */
this.mainContCssClass = f.grid_cont_css_class || 'grd_Cont';
- //defines css class for div containing table
+
+ /**
+ * Css class for body table container element
+ * @type {String}
+ */
this.contCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont';
- //defines css class for div containing headers' table
+
+ /**
+ * Css class for headers table container element
+ * @type {String}
+ */
this.headContCssClass = f.grid_tblHead_cont_css_class ||
'grd_headTblCont';
- //defines css class for div containing rows counter, paging etc.
+
+ /**
+ * Css class for toolbar container element (rows counter, paging etc.)
+ * @type {String}
+ */
this.infDivCssClass = f.grid_inf_grid_css_class || 'grd_inf';
- //defines which row contains column headers
+
+ /**
+ * Index of the headers row, default: 0
+ * @type {Number}
+ */
this.headRowIndex = f.grid_headers_row_index || 0;
- //array of headers row indexes to be placed in header table
+
+ /**
+ * Collection of the header row indexes to be moved into headers table
+ * @type {Array}
+ */
this.headRows = f.grid_headers_rows || [0];
- //generate filters in table headers
+
+ /**
+ * Enable or disable column filters generation, default: true
+ * @type {Boolean}
+ */
this.enableFilters = f.grid_enable_default_filters === false ?
false : true;
+
+ /**
+ * Enable or disable column headers, default: false
+ * @type {Boolean}
+ */
this.noHeaders = Boolean(f.grid_no_headers);
- //default col width
+
+ /**
+ * Grid-layout default column widht as CSS string
+ * @type {String}
+ */
this.defaultColWidth = f.grid_default_col_width || '100px';
+ /**
+ * List of column elements
+ * @type {Array}
+ * @private
+ */
this.colElms = [];
- //div containing grid elements if grid_layout true
+ /**
+ * Prefix for grid-layout main container ID
+ * @type {String}
+ * @private
+ */
this.prfxMainTblCont = 'gridCont_';
- //div containing table if grid_layout true
+
+ /**
+ * Prefix for grid-layout body table container ID
+ * @type {String}
+ * @private
+ */
this.prfxTblCont = 'tblCont_';
- //div containing headers table if grid_layout true
+
+ /**
+ * Prefix for grid-layout headers table container ID
+ * @type {String}
+ * @private
+ */
this.prfxHeadTblCont = 'tblHeadCont_';
- //headers' table if grid_layout true
+
+ /**
+ * Prefix for grid-layout headers table ID
+ * @type {String}
+ * @private
+ */
this.prfxHeadTbl = 'tblHead_';
- //id of td containing the filter if grid_layout true
+
+ /**
+ * Prefix for grid-layout filter's cell ID
+ * @type {String}
+ * @private
+ */
this.prfxGridFltTd = '_td_';
- //id of th containing column header if grid_layout true
+
+ /**
+ * Prefix for grid-layout header's cell ID
+ * @type {String}
+ * @private
+ */
this.prfxGridTh = 'tblHeadTh_';
+ /**
+ * Mark-up of original HTML table
+ * @type {String}
+ * @private
+ */
this.sourceTblHtml = tf.tbl.outerHTML;
// filters flag at TF level
@@ -85,25 +168,8 @@ export class GridLayout extends Feature {
tf.isExternalFlt = true;
- // default width of 100px if column widths not set
+ // Assign default column widths
this.setDefaultColWidths();
- // if (!tf.hasColWidths) {
- // tf.colWidths = [];
- // for (let k = 0; k < tf.nbCells; k++) {
- // let colW,
- // cell = tbl.rows[this.headRowIndex].cells[k];
- // if (cell.width !== '') {
- // colW = cell.width;
- // } else if (cell.style.width !== '') {
- // colW = parseInt(cell.style.width, 10);
- // } else {
- // colW = this.defaultColWidth;
- // }
- // tf.colWidths[k] = colW;
- // }
- // tf.hasColWidths = true;
- // }
- // tf.setColWidths();
let tblW;//initial table width
if (tbl.width !== '') {
@@ -195,7 +261,7 @@ export class GridLayout extends Feature {
//Headers row are moved from content table to headers table
if (!this.noHeaders) {
for (let i = 0; i < this.headRows.length; i++) {
- let headRow = tbl.rows[this.headRows[0]];
+ let headRow = tbl.rows[this.headRows[i]];
tH.appendChild(headRow);
}
} else {
@@ -306,12 +372,15 @@ export class GridLayout extends Feature {
this.initialized = true;
}
- setDefaultColWidths(){
+ /**
+ * Set grid-layout default column widths if column widths are not defined
+ * @private
+ */
+ setDefaultColWidths() {
let tf = this.tf;
- if (tf.hasColWidths){
+ if (tf.hasColWidths) {
return;
}
- // tf.colWidths = [];
for (let k = 0, len = tf.getCellsNb(); k < len; k++) {
let colW;
let cell = tf.tbl.rows[tf.getHeadersRowIndex()].cells[k];
diff --git a/src/tablefilter.js b/src/tablefilter.js
index 81c98aa0..ef5b04bb 100644
--- a/src/tablefilter.js
+++ b/src/tablefilter.js
@@ -1638,10 +1638,10 @@ export class TableFilter {
* @param {Boolean} includeHeaders Include the headers row
* @return {Number} Number of filterable rows
*/
- getRowsNb(includeHeaders){
+ getRowsNb(includeHeaders) {
let s = isUndef(this.refRow) ? 0 : this.refRow;
let ntrs = this.tbl.rows.length;
- if (includeHeaders){
+ if (includeHeaders) {
s = 0;
}
return parseInt(ntrs - s, 10);
diff --git a/test/test-dom-changes.html b/test/test-dom-changes.html
new file mode 100644
index 00000000..604b3e9a
--- /dev/null
+++ b/test/test-dom-changes.html
@@ -0,0 +1,78 @@
+
+
+
+
+ TableFilter DOM changes
+
+
+
+
+
+
+
+
+ From |
+ Destination |
+ Road Distance (km) |
+ By Air (hrs) |
+ By Rail (hrs) |
+
+
+ Sydney |
+ Adelaide |
+ 1412 |
+ 1.4 |
+ 25.3 |
+
+
+ Sydney |
+ Brisbane |
+ 982 |
+ 1.5 |
+ 16 |
+
+
+ Sydney |
+ Canberra |
+ 286 |
+ .6 |
+ 4.3 |
+
+
+ Sydney |
+ Melbourne |
+ 872 |
+ 1.1 |
+ 10.5 |
+
+
+ Adelaide |
+ Perth |
+ 2781 |
+ 3.1 |
+ 38 |
+
+
+ Adelaide |
+ Alice Springs |
+ 1533 |
+ 2 |
+ 20.25 |
+
+
+ Adelaide |
+ Brisbane |
+ 2045 |
+ 2.15 |
+ 40 |
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/test-dom-changes.js b/test/test-dom-changes.js
new file mode 100644
index 00000000..d1f04f48
--- /dev/null
+++ b/test/test-dom-changes.js
@@ -0,0 +1,165 @@
+
+var tf = new TableFilter('demo', {
+ base_path: '../dist/tablefilter/',
+ rows_counter: true
+});
+tf.init();
+var rowsCounter = tf.feature('rowsCounter');
+var rowToAdd = tf.tbl.rows[8];
+
+var tf1 = new TableFilter('demo', {
+ base_path: '../dist/tablefilter/',
+ rows_counter: true,
+ paging: true,
+ paging_length: 3
+});
+
+module('Sanity checks');
+test('Initial verifications', function() {
+ deepEqual(tf instanceof TableFilter, true, 'TableFilter instance');
+ deepEqual(tf.getFilterableRowsNb(), 7, 'Initial number of filterable rows');
+ deepEqual(tf.getValidRowsNb(), 0, 'Initial number of valid rows');
+ notEqual(rowsCounter, null, 'RowsCounter instanciated');
+ deepEqual(rowsCounter.rowsCounterSpan.innerHTML, '7', 'Initial rows count');
+});
+
+module('DOM changes');
+test('Can filter after row is removed', function() {
+ // setup
+ tf.clearFilters();
+ tf.tbl.deleteRow(-1);
+
+ // act
+ tf.filter();
+
+ // assert
+ deepEqual(tf.getFilterableRowsNb(), 6,
+ 'Number of filterable rows after row is removed');
+ deepEqual(tf.getValidRowsNb(), 6,
+ 'Number of valid rows after row is removed');
+ deepEqual(rowsCounter.rowsCounterSpan.innerHTML, '6',
+ 'Rows count after row is removed');
+});
+
+test('Can filter after row is added', function() {
+ // setup
+ tf.clearFilters();
+ tf.tbl.tBodies[0].appendChild(rowToAdd);
+
+ // act
+ tf.filter();
+
+ // assert
+ deepEqual(tf.getFilterableRowsNb(), 7,
+ 'Number of filterable rows after row is added');
+ deepEqual(tf.getValidRowsNb(), 7,
+ 'Number of valid rows after row is added');
+ deepEqual(rowsCounter.rowsCounterSpan.innerHTML, '7',
+ 'Rows count after row is added');
+});
+
+test('Can filter the added row', function() {
+ // setup
+ tf.clearFilters();
+ tf.setFilterValue(0, 'Adelaide');
+ tf.setFilterValue(1, 'Brisbane');
+
+ // act
+ tf.filter();
+
+ // assert
+ deepEqual(tf.getFilterableRowsNb(), 7,
+ 'Number of filterable rows after row is added');
+ deepEqual(tf.getValidRowsNb(), 1,
+ 'Number of valid rows after row is added');
+ deepEqual(rowsCounter.rowsCounterSpan.innerHTML, '1',
+ 'Rows count after row is added');
+});
+
+test('can destroy TableFilter', function() {
+ tf.clearFilters();
+ tf.destroy();
+ deepEqual(tf.isInitialized(), false, 'tf instance destroyed');
+});
+
+module('DOM changes with paging');
+test('Sanity checks', function() {
+ // setup
+ tf1.init();
+ var rowsCounter = tf1.feature('rowsCounter');
+
+ // assert
+ deepEqual(tf1 instanceof TableFilter, true, 'TableFilter instance');
+ deepEqual(tf1.paging, true, 'Paging is enabled');
+ deepEqual(tf1.getFilterableRowsNb(), 7,
+ 'Initial number of filterable rows');
+ deepEqual(tf1.getValidRowsNb(), 7, 'Initial number of valid rows');
+ notEqual(rowsCounter, null, 'RowsCounter instanciated');
+ deepEqual(rowsCounter.rowsCounterSpan.innerHTML, '1-3 / 7',
+ 'Initial rows count');
+});
+
+test('Can filter and change a page after row is removed', function() {
+ // setup
+ var paging = tf1.feature('paging');
+ var rowsCounter = tf1.feature('rowsCounter');
+ tf1.clearFilters();
+ tf1.tbl.deleteRow(-1);
+
+ // act
+ tf1.filter();
+ paging.setPage(2);
+
+ // assert
+ deepEqual(tf1.getFilterableRowsNb(), 6,
+ 'Number of filterable rows after row is removed');
+ deepEqual(tf1.getValidRowsNb(), 6,
+ 'Number of valid rows after row is removed');
+ deepEqual(rowsCounter.rowsCounterSpan.innerHTML, '4-6 / 6',
+ 'Rows count after row is removed');
+});
+
+test('Can filter and change page after row is added', function() {
+ // setup
+ var paging = tf1.feature('paging');
+ var rowsCounter = tf1.feature('rowsCounter');
+ tf1.clearFilters();
+ tf1.tbl.tBodies[0].appendChild(rowToAdd);
+
+ // act
+ tf1.filter();
+ paging.setPage(3);
+
+ // assert
+ deepEqual(tf1.getFilterableRowsNb(), 7,
+ 'Number of filterable rows after row is added');
+ deepEqual(tf1.getValidRowsNb(), 7,
+ 'Number of valid rows after row is added');
+ deepEqual(rowsCounter.rowsCounterSpan.innerHTML, '7-7 / 7',
+ 'Rows count after row is added');
+});
+
+test('Can filter the added row with paging', function() {
+ // setup
+ var paging = tf1.feature('paging');
+ var rowsCounter = tf1.feature('rowsCounter');
+ tf1.setFilterValue(0, 'Adelaide');
+ tf1.setFilterValue(1, 'Brisbane');
+
+ // act
+ paging.setPage(0);
+ tf1.filter();
+
+ // assert
+ deepEqual(tf1.getFilterableRowsNb(), 7,
+ 'Number of filterable rows after row is added');
+ deepEqual(tf1.getValidRowsNb(), 1,
+ 'Number of valid rows after row is added');
+ deepEqual(rowsCounter.rowsCounterSpan.innerHTML, '1-1 / 1',
+ 'Rows count after row is added');
+});
+
+test('can destroy TableFilter DOM elements', function() {
+ tf1.destroy();
+ deepEqual(tf1.isInitialized(), false, 'tf1 instance destroyed');
+});